Skip to content

Commit

Permalink
bumped Microsoft.VisualStudio.LanguageServer.Protocol 17.2.8 -> 18.8.…
Browse files Browse the repository at this point in the history
…9-preview

bumped Microsoft.VisualStudio.LanguageServer 17.2.8 -> 18.8.9-preview
  • Loading branch information
HJLebbink committed Nov 15, 2023
1 parent 2b897a0 commit 095211d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 63 deletions.
49 changes: 0 additions & 49 deletions VS/CSHARP/asm-dude2-ls-lib/AsmFoldingRange.cs

This file was deleted.

38 changes: 27 additions & 11 deletions VS/CSHARP/asm-dude2-ls-lib/LanguageServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class LanguageServer : INotifyPropertyChanged
private readonly Dictionary<Uri, string[]> textDocumentLines;
private readonly Dictionary<Uri, KeywordID[][]> parsedDocuments;

private readonly Dictionary<Uri, IEnumerable<AsmFoldingRange>> foldingRanges;
private readonly Dictionary<Uri, IEnumerable<FoldingRange>> foldingRanges;
private readonly Dictionary<Uri, LabelGraph> labelGraphs;

private readonly int referencesChunkSize = 10;
Expand Down Expand Up @@ -102,7 +102,7 @@ private LanguageServer(Stream sender, Stream reader)
this.parsedDocuments = new Dictionary<Uri, KeywordID[][]>();

this.labelGraphs = new Dictionary<Uri, LabelGraph>();
this.foldingRanges = new Dictionary<Uri, IEnumerable<AsmFoldingRange>>();
this.foldingRanges = new Dictionary<Uri, IEnumerable<FoldingRange>>();
this.diagnostics = new List<Diagnostic>();
this.Symbols = Array.Empty<VSSymbolInformation>();

Expand Down Expand Up @@ -401,7 +401,7 @@ static string GetCollapsedText(int startPos, string line)
int startKeywordLength = StartKeyword.Length;
int endKeywordLength = EndKeyword.Length;

List<AsmFoldingRange> foldingRanges = new();
List<FoldingRange> foldingRanges = new();
Stack<int> startLineNumbers = new();
Stack<int> startCharacters = new();

Expand Down Expand Up @@ -437,7 +437,7 @@ static string GetCollapsedText(int startPos, string line)
{
int startLine = startLineNumbers.Pop();
int startCharacter = startCharacters.Pop();
foldingRanges.Add(new AsmFoldingRange
foldingRanges.Add(new FoldingRange
{
StartLine = startLine,
StartCharacter = startCharacter,
Expand Down Expand Up @@ -951,23 +951,23 @@ public SignatureHelp GetTextDocumentSignatureHelp(SignatureHelpParams parameter)
}
}

public void SetFoldingRanges(IEnumerable<AsmFoldingRange> foldingRanges, Uri uri)
public void SetFoldingRanges(IEnumerable<FoldingRange> foldingRanges, Uri uri)
{
this.foldingRanges.Remove(uri);
this.foldingRanges.Add(uri, foldingRanges);
}

public AsmFoldingRange[] GetFoldingRanges(FoldingRangeParams parameter)
public FoldingRange[] GetFoldingRanges(FoldingRangeParams parameter)
{
if (!this.options.CodeFolding_On)
{
return Array.Empty<AsmFoldingRange>();
return Array.Empty<FoldingRange>();
}
if (this.foldingRanges.TryGetValue(parameter.TextDocument.Uri, out IEnumerable<AsmFoldingRange> value))
if (this.foldingRanges.TryGetValue(parameter.TextDocument.Uri, out IEnumerable<FoldingRange> value))
{
return value.ToArray();
}
return Array.Empty<AsmFoldingRange>();
return Array.Empty<FoldingRange>();
}

private HashSet<CompletionItem> Mnemonic_Operand_Completions(bool useCapitals, HashSet<AsmSignatureEnum> allowedOperands, int lineNumber)
Expand Down Expand Up @@ -1557,7 +1557,7 @@ public Hover GetHover(TextDocumentPositionParams parameter)
Language = MarkupKind.PlainText.ToString(),
Value = full_Descr + "\n",
}),
new SumType<string, MarkedString>(new MarkedString
new(new MarkedString
{
Language = MarkupKind.Markdown.ToString(),
Value = ((performanceInfoAvailable) ? "**Performance:**\n```text\n" + performanceStr + "\n```" : "No performance info"),
Expand Down Expand Up @@ -1613,7 +1613,7 @@ public Hover GetHover(TextDocumentPositionParams parameter)
}
descr = AsmTools.AsmSourceTools.Linewrap(descr, MaxNumberOfCharsInToolTips);
hoverContent = new SumType<string, MarkedString>[]{
new SumType<string, MarkedString>(new MarkedString
new(new MarkedString
{
Language = MarkupKind.PlainText.ToString(),
Value = $"Keyword {keyword}: {descr}",
Expand Down Expand Up @@ -1795,8 +1795,24 @@ public Hover GetHover(TextDocumentPositionParams parameter)
}
*/


if (hoverContent != null)
{
//return new Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalHover
//{
// Range = new Range()
// {
// Start = new Position(parameter.Position.Line, startPos),
// End = new Position(parameter.Position.Line, endPos),
// },
// Contents = new MarkupContent
// {
// Kind = MarkupKind.Markdown,
// Value = "TODO **bold**"
// },
// //RawContent = new ClassifiedTextElement(descriptionBuilder.Select(tp => new ClassifiedTextRun(tp.Tag.ToClassificationTypeName(), tp.Text)))
//};

return new Hover()
{
Contents = hoverContent,
Expand Down
7 changes: 5 additions & 2 deletions VS/CSHARP/asm-dude2-ls-lib/asm-dude2-ls-lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0-rc.1.23419.4" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" Version="17.2.8" />
<PackageReference Include="StreamJsonRpc" Version="2.16.36" />
<PackageReference Include="Microsoft.VisualStudio.Language.StandardClassification" Version="17.7.188" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="17.8.9-preview" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Internal" Version="17.8.9-preview" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" Version="17.8.9-preview" />
<PackageReference Include="StreamJsonRpc" Version="2.16.36" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion VS/CSHARP/asm-dude2-vsix/asm-dude2-vsix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@

<ItemGroup>
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.1" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="17.2.8" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="17.8.9-preview" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Internal" Version="17.8.9-preview" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.7.37357" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.7.30">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit 095211d

Please sign in to comment.