Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Async Indexer for new LanguageServer #558

Merged
merged 128 commits into from
Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
b9b2554
IndexParser
brianbok Jan 25, 2019
cd1878d
Workspace Index Manage
brianbok Jan 26, 2019
6a6a38d
Sorting using as configured on repo
brianbok Jan 28, 2019
765653b
Removing unuseful empty property
brianbok Jan 28, 2019
b42d1f4
Moving directory reader to DirectoryInfo
brianbok Jan 28, 2019
8a4d3d6
EnumerateFiles returns non-lazily
brianbok Jan 28, 2019
33d768a
IndexParser throws FileNotFoundException
brianbok Jan 28, 2019
1db8030
Events on files
brianbok Jan 28, 2019
52dd812
Adding update event to index manager
brianbok Jan 29, 2019
7c535c3
Async IndexParser
brianbok Jan 29, 2019
05f3b4e
Async IndexManager
brianbok Jan 29, 2019
e5791d3
Check ArgumentNotNull using Diagnostics
brianbok Jan 29, 2019
b39ecf4
Async fixes
brianbok Jan 29, 2019
b767fbd
PythonVersions.LatestAvailable3X
brianbok Jan 29, 2019
703de21
SymbolIndex fixes
brianbok Jan 30, 2019
af85966
SymbolIndex moving method from HierarchicalSymbol
brianbok Jan 30, 2019
2c7dc2d
SymbolIndex corrections
brianbok Jan 30, 2019
26bef41
SymbolIndex return style
brianbok Jan 30, 2019
93d0464
Adding symbolIndex tests
brianbok Jan 30, 2019
c93c496
SymbolIndex return style
brianbok Jan 30, 2019
28685c6
Using strings (plain path) instead of Uri
brianbok Jan 30, 2019
0091933
More tests
brianbok Jan 31, 2019
c0a0387
More Uri to string type transforming
brianbok Jan 31, 2019
6e4a0f5
Removing FileNotFoundException
brianbok Jan 31, 2019
2e8ecdf
Single Line Return
brianbok Jan 31, 2019
332358f
SymbolIndex Interface
brianbok Jan 31, 2019
0048bf8
Fix AddRoot Test
brianbok Feb 1, 2019
8f4343e
Disposing test fix
brianbok Feb 1, 2019
36ed2e6
Blocking tests new fake
brianbok Feb 1, 2019
d58cc6b
Wait for AddRootTask in symbol querying
brianbok Feb 1, 2019
2b3d450
Refactor tests and async add root
brianbok Feb 2, 2019
36c6f85
Adding license header
brianbok Feb 2, 2019
a897585
TraverseBreadth variable rename
brianbok Feb 2, 2019
7a2b9c3
deleting unused variable
brianbok Feb 5, 2019
b493294
Limiting API
brianbok Feb 5, 2019
fb7f8b3
Dispose test fixed
brianbok Feb 5, 2019
c4dcf23
Limiting API fix and styling
brianbok Feb 5, 2019
aedb206
Dispose testing
brianbok Feb 5, 2019
ac2098a
Merge branch 'master' into indexer
brianbok Feb 7, 2019
1363efc
Moved everything into language server
brianbok Feb 7, 2019
d788f16
Tests refactor and connecting index to ls
brianbok Feb 7, 2019
98c18aa
Adding file events
brianbok Feb 8, 2019
eb83604
async fix
brianbok Feb 8, 2019
8b90ac7
Enumerable fix
brianbok Feb 8, 2019
fae4315
Delete copy of SymbolKind
brianbok Feb 8, 2019
d3f7da1
Revert "Delete copy of SymbolKind"
brianbok Feb 8, 2019
9c0cb66
Deleting cast
brianbok Feb 11, 2019
7d159bc
Async handling update of AST
brianbok Feb 11, 2019
a03c022
Versioned symbolindex
brianbok Feb 12, 2019
f6c854b
More versioned syncronization
brianbok Feb 12, 2019
6cf5057
Removing event handler from doc
brianbok Feb 13, 2019
4406a71
Safely executing matcher
brianbok Feb 13, 2019
ab650eb
Casting instead of 'as'
brianbok Feb 13, 2019
2617c92
Cast
brianbok Feb 13, 2019
a62bf81
Returning on execute matcher
brianbok Feb 13, 2019
fa32e97
Adding empty workspace path check
brianbok Feb 14, 2019
b38e22b
Merge branch 'master' into indexer
brianbok Feb 14, 2019
93e4d0d
Resolving race condition
brianbok Feb 14, 2019
80d4d39
Async rename
brianbok Feb 14, 2019
57d5ec8
Idling for index
brianbok Feb 14, 2019
78f12c8
Adding delay to idling
brianbok Feb 14, 2019
4a724c7
New async interface
brianbok Feb 15, 2019
0f331c2
Passed more tests
brianbok Feb 15, 2019
d3b4761
Removing fields of test
brianbok Feb 15, 2019
74e9bed
Passes every test again
brianbok Feb 15, 2019
59bccd2
Working version
brianbok Feb 15, 2019
0727619
Readonly fields
brianbok Feb 15, 2019
dc7b9eb
IndexParser refactoring
brianbok Feb 16, 2019
935f6ba
IndexParser fixes
brianbok Feb 16, 2019
6578616
No Tcs in IndexParser
brianbok Feb 16, 2019
e5bf1d8
Disposing streams
brianbok Feb 16, 2019
108259f
Implementing tcs pattern
brianbok Feb 16, 2019
1ff0935
PR comments fixes and typos
brianbok Feb 19, 2019
0bc72c3
Rework of tcs in indexmanager
brianbok Feb 19, 2019
2bba9dc
Delete unused variable
brianbok Feb 19, 2019
9c5bb3a
Disposal check
brianbok Feb 19, 2019
8de9f3a
TCS no reuse
brianbok Feb 19, 2019
e2bf0fe
Reorder layers
brianbok Feb 20, 2019
d04d375
Making interface for mostrecent symbols
brianbok Feb 20, 2019
f7f09fb
Copyright comments
brianbok Feb 20, 2019
9952681
Unused var
brianbok Feb 20, 2019
91b836c
Changin default delay
brianbok Feb 20, 2019
29ecef7
Rename and style correct
brianbok Feb 20, 2019
846f9a9
Getting rid of comment
brianbok Feb 20, 2019
8b19e45
Fix limiting in workspace symbols query
brianbok Feb 20, 2019
bad44b1
Better disposal
brianbok Feb 20, 2019
615e483
CancellationToken on querying
brianbok Feb 20, 2019
da29542
Walker walks annotated assignments
brianbok Feb 20, 2019
5dd8e2c
Removing use of MaybeEnumerate in Traverse
brianbok Feb 20, 2019
53766a6
Var instead of explicit Uri type
brianbok Feb 20, 2019
5384825
Null check
brianbok Feb 20, 2019
803b67f
max Concurrency handling
brianbok Feb 20, 2019
66f7ae4
Merge branch 'master' into indexer
brianbok Feb 20, 2019
8f704dd
Simple workspace querying
brianbok Feb 21, 2019
17a9d0a
Simplifying disposing
brianbok Feb 21, 2019
88ba453
Simplification
brianbok Feb 21, 2019
d9f8d57
Unused method
brianbok Feb 21, 2019
2c60d4f
CancellationToken
brianbok Feb 21, 2019
4825065
First state machine
brianbok Feb 21, 2019
fffb215
Tests for states of symbolIndex
brianbok Feb 21, 2019
25b6590
Rename of state
brianbok Feb 21, 2019
4a569ef
Comment on name of state
brianbok Feb 21, 2019
08f6287
File Open FileSystem back to how it was
brianbok Feb 21, 2019
05e711d
Server.Symbols
brianbok Feb 21, 2019
9213ca7
Reference to deleted field
brianbok Feb 21, 2019
0e3c42d
Extra new lines
brianbok Feb 21, 2019
9fcdbe5
Extra spaces
brianbok Feb 21, 2019
08858f0
Delete unused code
brianbok Feb 21, 2019
ccef536
Pattern matching in walker
brianbok Feb 21, 2019
d60b481
Merge branch 'master' into indexer
brianbok Feb 21, 2019
121a8b0
Unused methods
brianbok Feb 21, 2019
c83112b
Using matcher for checking files in workspace
brianbok Feb 21, 2019
eba45f2
State machine changes
brianbok Feb 21, 2019
3881c9c
Change exception type
brianbok Feb 21, 2019
5b87d0f
Double releasing semaphore fix`
brianbok Feb 21, 2019
58d5396
Removing continuewith in mostrecentdoc
brianbok Feb 22, 2019
0ae25d8
Setting state, only one assignment per method
brianbok Feb 22, 2019
8ef5750
Disposing index parser in symbol index
brianbok Feb 22, 2019
14d3d90
Make includePatterns optional for match
brianbok Feb 22, 2019
a87deac
Not calling excludePatterns if unnecessary
brianbok Feb 22, 2019
2ee4b55
Use of concurrent dictionary instead of lock on object
brianbok Feb 25, 2019
ad258cc
Const instead of static
brianbok Feb 25, 2019
190f8a5
Merge branch 'indexer' of github.com:brianbok/python-language-server …
brianbok Feb 25, 2019
4fb33db
IndexParser task creation in a cleaner way
brianbok Feb 25, 2019
61039d5
Use of disposablebag everywhere`
brianbok Feb 25, 2019
2a23b61
Delete unused fields and params
brianbok Feb 25, 2019
6e44942
More disposablebag usage
brianbok Feb 25, 2019
5485c9c
Unused imports
brianbok Feb 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Analysis/Ast/Impl/Microsoft.Python.Analysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<Content Include="get_search_paths.py">
Expand Down
42 changes: 22 additions & 20 deletions src/Core/Impl/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,30 @@ public static IEnumerable<int> IndexWhere<T>(this IEnumerable<T> source, Func<T,
i++;
}
}

public static IEnumerable<T> TraverseBreadthFirst<T>(this T root, Func<T, IEnumerable<T>> selectChildren)
=> Enumerable.Repeat(root, 1).TraverseBreadthFirst(selectChildren);

public static IEnumerable<T> TraverseBreadthFirst<T>(this IEnumerable<T> roots, Func<T, IEnumerable<T>> selectChildren) {
var items = new Queue<T>(roots);
while (items.Count > 0) {
var item = items.Dequeue();
yield return item;

var children = selectChildren(item);
if (children == null) {
continue;
}

foreach (var child in children) {
items.Enqueue(child);
}
}
}

public static Dictionary<TKey, TValue> ToDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, int, TKey> keySelector, Func<TSource, int, TValue> valueSelector) {
var dictionary = source is IReadOnlyCollection<TSource> collection
? new Dictionary<TKey, TValue>(collection.Count)
var dictionary = source is IReadOnlyCollection<TSource> collection
? new Dictionary<TKey, TValue>(collection.Count)
: new Dictionary<TKey, TValue>();

var index = 0;
Expand Down Expand Up @@ -130,23 +150,5 @@ public static IEnumerable<T> TraverseDepthFirst<T>(this T root, Func<T, IEnumera
reverseChildren.Clear();
}
}

public static IEnumerable<T> TraverseBreadthFirst<T>(this T root, Func<T, IEnumerable<T>> selectChildren) {
var items = new Queue<T>();
items.Enqueue(root);
while (items.Count > 0) {
var item = items.Dequeue();
yield return item;

var children = selectChildren(item);
if (children == null) {
continue;
}

foreach (var child in children) {
items.Enqueue(child);
}
}
}
}
}
2 changes: 2 additions & 0 deletions src/Core/Impl/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ public static bool PathEquals(this string s, string other)

public static bool EqualsOrdinal(this string s, int index, string other, int otherIndex, int length, bool ignoreCase = false)
=> string.Compare(s, index, other, otherIndex, length, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal) == 0;
public static bool ContainsOrdinal(this string s, string value, bool ignoreCase = false)
=> s.IndexOfOrdinal(value, ignoreCase: ignoreCase) != -1;

public static int GetPathHashCode(this string s)
=> IgnoreCaseInPaths ? StringComparer.OrdinalIgnoreCase.GetHashCode(s) : StringComparer.Ordinal.GetHashCode(s);
Expand Down
8 changes: 4 additions & 4 deletions src/Core/Impl/Extensions/TaskExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

namespace Microsoft.Python.Core {
public static class TaskExtensions {
public static void SetCompletionResultTo<T>(this Task<T> task, TaskCompletionSourceEx<T> tcs)
public static void SetCompletionResultTo<T>(this Task<T> task, TaskCompletionSource<T> tcs)
=> task.ContinueWith(SetCompletionResultToContinuation, tcs, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);

private static void SetCompletionResultToContinuation<T>(Task<T> task, object state) {
var tcs = (TaskCompletionSourceEx<T>) state;
var tcs = (TaskCompletionSource<T>)state;
switch (task.Status) {
case TaskStatus.RanToCompletion:
tcs.TrySetResult(task.Result);
Expand All @@ -34,7 +34,7 @@ private static void SetCompletionResultToContinuation<T>(Task<T> task, object st
try {
task.GetAwaiter().GetResult();
} catch (OperationCanceledException ex) {
tcs.TrySetCanceled(ex);
tcs.TrySetCanceled(ex.CancellationToken);
}
break;
case TaskStatus.Faulted:
Expand Down
36 changes: 36 additions & 0 deletions src/Core/Impl/IO/DirectoryInfoProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;

namespace Microsoft.Python.Core.IO {
public sealed class DirectoryInfoProxy : IDirectoryInfo {
Expand All @@ -40,6 +43,39 @@ public IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos() => _directoryInfo
.EnumerateFileSystemInfos()
.Select(CreateFileSystemInfoProxy);

public IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos(string[] includePatterns, string[] excludePatterns) {
var matcher = GetMatcher(includePatterns, excludePatterns);
PatternMatchingResult matchResult = SafeExecuteMatcher(matcher);
return matchResult.Files.Select((filePatternMatch) => {
var fileSystemInfo = _directoryInfo.GetFileSystemInfos(filePatternMatch.Stem).First();
return CreateFileSystemInfoProxy(fileSystemInfo);
});
}

public bool Match(string path, string[] includePatterns = default, string[] excludePatterns = default) {
var matcher = GetMatcher(includePatterns, excludePatterns);
return matcher.Match(FullName, path).HasMatches;
}

private static Matcher GetMatcher(string[] includePatterns, string[] excludePatterns) {
Matcher matcher = new Matcher();
matcher.AddIncludePatterns(includePatterns.IsNullOrEmpty() ? new[] { "**/*" } : includePatterns);
if (!excludePatterns.IsNullOrEmpty()) {
matcher.AddExcludePatterns(excludePatterns);
}
return matcher;
}

private PatternMatchingResult SafeExecuteMatcher(Matcher matcher) {
var directoryInfo = new DirectoryInfoWrapper(_directoryInfo);
for (var retries = 5; retries > 0; retries--) {
try {
return matcher.Execute(directoryInfo);
} catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) { }
}
return new PatternMatchingResult(Enumerable.Empty<FilePatternMatch>());
}

private static IFileSystemInfo CreateFileSystemInfoProxy(FileSystemInfo fileSystemInfo)
=> fileSystemInfo is DirectoryInfo directoryInfo
? (IFileSystemInfo)new DirectoryInfoProxy(directoryInfo)
Expand Down
1 change: 1 addition & 0 deletions src/Core/Impl/IO/FileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public long FileSize(string path) {
public void FileWriteAllBytes(string path, byte[] bytes) => File.WriteAllBytes(path, bytes);
public Stream CreateFile(string path) => File.Create(path);
public Stream FileOpen(string path, FileMode mode) => File.Open(path, mode);
public Stream FileOpen(string path, FileMode mode, FileAccess access, FileShare share) => File.Open(path, mode, access, share);
public bool DirectoryExists(string path) => Directory.Exists(path);
public FileAttributes GetFileAttributes(string path) => File.GetAttributes(path);
public void SetFileAttributes(string fullPath, FileAttributes attributes) => File.SetAttributes(fullPath, attributes);
Expand Down
2 changes: 2 additions & 0 deletions src/Core/Impl/IO/IDirectoryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ namespace Microsoft.Python.Core.IO {
public interface IDirectoryInfo : IFileSystemInfo {
IDirectoryInfo Parent { get; }
IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos();
IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos(string[] includeFiles, string[] excludeFiles);
bool Match(string path, string[] includePatterns = default, string[] excludePatterns = default);
}
}
1 change: 1 addition & 0 deletions src/Core/Impl/IO/IFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public interface IFileSystem {

Stream CreateFile(string path);
Stream FileOpen(string path, FileMode mode);
Stream FileOpen(string path, FileMode mode, FileAccess access, FileShare share);

Version GetFileVersion(string path);
void DeleteFile(string path);
Expand Down
1 change: 1 addition & 0 deletions src/Core/Impl/Microsoft.Python.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources.Designer.cs">
Expand Down
14 changes: 10 additions & 4 deletions src/LanguageServer/Impl/Implementation/Server.Documents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ namespace Microsoft.Python.LanguageServer.Implementation {
public sealed partial class Server {
public void DidOpenTextDocument(DidOpenTextDocumentParams @params) {
_disposableBag.ThrowIfDisposed();
_log?.Log(TraceEventType.Verbose, $"Opening document {@params.textDocument.uri}");
var uri = @params.textDocument.uri;
_log?.Log(TraceEventType.Verbose, $"Opening document {uri}");

_rdt.OpenDocument(@params.textDocument.uri, @params.textDocument.text);
var doc = _rdt.OpenDocument(uri, @params.textDocument.text);
_indexManager.ProcessNewFile(uri.AbsolutePath, doc);
}

public void DidChangeTextDocument(DidChangeTextDocumentParams @params) {
_disposableBag.ThrowIfDisposed();
var doc = _rdt.GetDocument(@params.textDocument.uri);
var uri = @params.textDocument.uri;
var doc = _rdt.GetDocument(uri);
if (doc != null) {
var changes = new List<DocumentChange>();
foreach (var c in @params.contentChanges) {
Expand All @@ -46,6 +49,7 @@ public void DidChangeTextDocument(DidChangeTextDocumentParams @params) {
changes.Add(change);
}
doc.Update(changes);
_indexManager.AddPendingDoc(doc);
} else {
_log?.Log(TraceEventType.Warning, $"Unable to find document for {@params.textDocument.uri}");
}
Expand All @@ -60,7 +64,9 @@ public void DidChangeWatchedFiles(DidChangeWatchedFilesParams @params) {

public void DidCloseTextDocument(DidCloseTextDocumentParams @params) {
_disposableBag.ThrowIfDisposed();
_rdt.CloseDocument(@params.textDocument.uri);
var uri = @params.textDocument.uri;
_rdt.CloseDocument(uri);
_indexManager.ProcessClosedFile(uri.AbsolutePath);
}

private Task<IDocumentAnalysis> GetAnalysisAsync(Uri uri, CancellationToken cancellationToken) {
Expand Down
127 changes: 127 additions & 0 deletions src/LanguageServer/Impl/Implementation/Server.Symbols.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Python.Core;
using Microsoft.Python.LanguageServer.Indexing;
using Microsoft.Python.LanguageServer.Protocol;

namespace Microsoft.Python.LanguageServer.Implementation {
public sealed partial class Server {
private static int _symbolHierarchyMaxSymbols = 1000;

public async Task<SymbolInformation[]> WorkspaceSymbols(WorkspaceSymbolParams @params, CancellationToken cancellationToken) {
var symbols = await _indexManager.WorkspaceSymbolsAsync(@params.query,
_symbolHierarchyMaxSymbols,
cancellationToken);
return symbols.Select(MakeSymbolInfo).ToArray();
}

public async Task<DocumentSymbol[]> HierarchicalDocumentSymbol(DocumentSymbolParams @params, CancellationToken cancellationToken) {
var path = @params.textDocument.uri.AbsolutePath;
var symbols = await _indexManager.HierarchicalDocumentSymbolsAsync(path, cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
return symbols.Select(hSym => MakeDocumentSymbol(hSym)).ToArray();
}

private static SymbolInformation MakeSymbolInfo(FlatSymbol s) {
return new SymbolInformation {
name = s.Name,
kind = (Protocol.SymbolKind)s.Kind,
location = new Location {
range = s.Range,
uri = new Uri(s.DocumentPath),
},
containerName = s.ContainerName,
};
}

private DocumentSymbol MakeDocumentSymbol(HierarchicalSymbol hSym) {
return new DocumentSymbol {
name = hSym.Name,
detail = hSym.Detail,
kind = ToSymbolKind(hSym.Kind),
deprecated = hSym.Deprecated ?? false,
range = hSym.Range,
selectionRange = hSym.SelectionRange,
children = hSym.Children.MaybeEnumerate().Select(MakeDocumentSymbol).ToArray(),
};
}

private Protocol.SymbolKind ToSymbolKind(Indexing.SymbolKind kind) {
switch (kind) {
case Indexing.SymbolKind.None:
return Protocol.SymbolKind.None;
case Indexing.SymbolKind.File:
return Protocol.SymbolKind.File;
case Indexing.SymbolKind.Module:
return Protocol.SymbolKind.Module;
case Indexing.SymbolKind.Namespace:
return Protocol.SymbolKind.Namespace;
case Indexing.SymbolKind.Package:
return Protocol.SymbolKind.Package;
case Indexing.SymbolKind.Class:
return Protocol.SymbolKind.Class;
case Indexing.SymbolKind.Method:
return Protocol.SymbolKind.Method;
case Indexing.SymbolKind.Property:
return Protocol.SymbolKind.Property;
case Indexing.SymbolKind.Field:
return Protocol.SymbolKind.Field;
case Indexing.SymbolKind.Constructor:
return Protocol.SymbolKind.Constructor;
case Indexing.SymbolKind.Enum:
return Protocol.SymbolKind.Enum;
case Indexing.SymbolKind.Interface:
return Protocol.SymbolKind.Interface;
case Indexing.SymbolKind.Function:
return Protocol.SymbolKind.Function;
case Indexing.SymbolKind.Variable:
return Protocol.SymbolKind.Variable;
case Indexing.SymbolKind.Constant:
return Protocol.SymbolKind.Constant;
case Indexing.SymbolKind.String:
return Protocol.SymbolKind.String;
case Indexing.SymbolKind.Number:
return Protocol.SymbolKind.Number;
case Indexing.SymbolKind.Boolean:
return Protocol.SymbolKind.Boolean;
case Indexing.SymbolKind.Array:
return Protocol.SymbolKind.Array;
case Indexing.SymbolKind.Object:
return Protocol.SymbolKind.Object;
case Indexing.SymbolKind.Key:
return Protocol.SymbolKind.Key;
case Indexing.SymbolKind.Null:
return Protocol.SymbolKind.Null;
case Indexing.SymbolKind.EnumMember:
return Protocol.SymbolKind.EnumMember;
case Indexing.SymbolKind.Struct:
return Protocol.SymbolKind.Struct;
case Indexing.SymbolKind.Event:
return Protocol.SymbolKind.Event;
case Indexing.SymbolKind.Operator:
return Protocol.SymbolKind.Operator;
case Indexing.SymbolKind.TypeParameter:
return Protocol.SymbolKind.TypeParameter;
default:
throw new NotImplementedException($"{kind} is not a LSP's SymbolKind");
}
}
}
}
Loading