Skip to content

Commit

Permalink
Merge branch 'master' into AsyncAnalyzerWorkQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich authored Sep 25, 2023
2 parents 3c3bc93 + ada0bb4 commit 747568c
Show file tree
Hide file tree
Showing 38 changed files with 843 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

name: 'Build'
env:
DotNetVersion: "8.0.100-preview.4.23260.5"
DotNetVersion: "8.0.100-rc.1.23463.5"
DotNetVersion2: "7.0.302"
DotNetVersion3: "6.0.203"
NuGetVersion: "6.5.0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-net6.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

name: 'Tests net6.0'
env:
DotNetVersion: "8.0.100-preview.4.23260.5"
DotNetVersion: "8.0.100-rc.1.23463.5"
DotNetVersion2: "7.0.302"
DotNetVersion3: "6.0.203"
NuGetVersion: "6.5.0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

name: 'Tests'
env:
DotNetVersion: "8.0.100-preview.4.23260.5"
DotNetVersion: "8.0.100-rc.1.23463.5"
DotNetVersion2: "7.0.302"
DotNetVersion3: "6.0.203"
NuGetVersion: "6.5.0"
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/init.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
# Configuration: Release
Verbosity: Normal
DotNetVersion: "8.0.100-preview.4.23260.5"
DotNetVersion: "8.0.100-rc.1.23463.5"
DotNetVersion2: "7.0.302"
DotNetVersion3: "6.0.203"
CakeVersion: "1.1.0"
Expand Down
19 changes: 7 additions & 12 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>

<OmniSharpExtensionsPackageVersion>0.19.9</OmniSharpExtensionsPackageVersion>
<MicrosoftExtensionPackageVersion>7.0.0</MicrosoftExtensionPackageVersion>
<MicrosoftTestPackageVersion>17.6.0</MicrosoftTestPackageVersion>
<MSBuildPackageVersion>17.3.2</MSBuildPackageVersion>
<NuGetPackageVersion>6.8.0-preview.1.41</NuGetPackageVersion>
<RoslynPackageVersion>4.8.0-1.23374.10</RoslynPackageVersion>
<NuGetPackageVersion>6.8.0-preview.1.69</NuGetPackageVersion>
<RoslynPackageVersion>4.8.0-1.23419.1</RoslynPackageVersion>
<XunitPackageVersion>2.4.1</XunitPackageVersion>
</PropertyGroup>

Expand Down Expand Up @@ -65,12 +66,6 @@
<PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.14.114" />
<PackageVersion Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.12" />

<!-- The two references below can be deleted once OmniSharp.Extensions.LanguageServer
references Nerdbank.Streams version >= 2.9. The Included versions are needed for compatibility
with Razor. -->
<PackageVersion Include="Microsoft.VisualStudio.Threading" Version="17.5.22" />
<PackageVersion Include="Microsoft.VisualStudio.Validation" Version="17.0.65" />

<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />

<PackageVersion Include="NuGet.Common" Version="$(NuGetPackageVersion)" />
Expand All @@ -84,9 +79,9 @@
<PackageVersion Include="NuGet.Protocol" Version="$(NuGetPackageVersion)" />
<PackageVersion Include="NuGet.Versioning" Version="$(NuGetPackageVersion)" />

<PackageVersion Include="OmniSharp.Extensions.LanguageServer" Version="0.19.7" />
<PackageVersion Include="OmniSharp.Extensions.LanguageProtocol.Testing" Version="0.19.7" />
<PackageVersion Include="OmniSharp.Extensions.JsonRpc" Version="0.19.7" />
<PackageVersion Include="OmniSharp.Extensions.LanguageServer" Version="$(OmniSharpExtensionsPackageVersion)" />
<PackageVersion Include="OmniSharp.Extensions.LanguageProtocol.Testing" Version="$(OmniSharpExtensionsPackageVersion)" />
<PackageVersion Include="OmniSharp.Extensions.JsonRpc" Version="$(OmniSharpExtensionsPackageVersion)" />

<PackageVersion Include="SQLitePCLRaw.bundle_green" Version="2.1.0" />
<PackageVersion Include="System.Collections.Immutable" Version="7.0.0" />
Expand All @@ -98,7 +93,7 @@
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="7.0.0" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />

<PackageVersion Include="System.Reactive" Version="5.0.0" />
<PackageVersion Include="System.Reactive" Version="6.0.0" />

<PackageVersion Include="System.Reflection.DispatchProxy" Version="4.5.1" />
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ resources:

variables:
Verbosity: Diagnostic
DotNetVersion: "8.0.100-preview.4.23260.5"
DotNetVersion: "8.0.100-rc.1.23463.5"
CakeVersion: "3.0.0"
NuGetVersion: "6.5.0"
GitVersionVersion: "5.0.1"
Expand Down
4 changes: 2 additions & 2 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"DotNetVersions": [
"6.0.203",
"7.0.302",
"8.0.100-preview.4.23260.5"
"8.0.100-rc.1.23463.5"
],
"RequiredMonoVersion": "6.6.0",
"DownloadURL": "https://roslynomnisharp.blob.core.windows.net/ext",
Expand Down Expand Up @@ -54,4 +54,4 @@
"RestoreOnlyTestAssets": [
"ProjectWithMissingType"
]
}
}
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100-preview.4.23260.5",
"rollForward": "patch"
"version": "8.0.100-rc.1.23463.5",
"rollForward": "latestMinor"
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
using System.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Microsoft.CodeAnalysis;
using NuGet.Protocol;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.V2.CodeActions;
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
using OmniSharp.Extensions.LanguageServer.Protocol.Workspace;
using Diagnostic = OmniSharp.Extensions.LanguageServer.Protocol.Models.Diagnostic;
using OmniSharp.Models.V2.CodeActions;
using CodeActionKind = OmniSharp.Extensions.LanguageServer.Protocol.Models.CodeActionKind;
using Diagnostic = OmniSharp.Extensions.LanguageServer.Protocol.Models.Diagnostic;
using OmniSharpCodeActionKind = OmniSharp.Models.V2.CodeActions.CodeActionKind;
using System;
using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
using NuGet.Protocol;

namespace OmniSharp.LanguageServerProtocol.Handlers
{
Expand All @@ -39,14 +39,14 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(

private readonly Mef.IRequestHandler<GetCodeActionsRequest, GetCodeActionsResponse> _getActionsHandler;
private readonly Mef.IRequestHandler<RunCodeActionRequest, RunCodeActionResponse> _runActionHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;
private readonly ILanguageServer _server;
private readonly DocumentVersions _documentVersions;

public OmniSharpCodeActionHandler(
Mef.IRequestHandler<GetCodeActionsRequest, GetCodeActionsResponse> getActionsHandler,
Mef.IRequestHandler<RunCodeActionRequest, RunCodeActionResponse> runActionHandler,
DocumentSelector documentSelector,
TextDocumentSelector documentSelector,
ILanguageServer server,
DocumentVersions documentVersions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)

private readonly Mef.IRequestHandler<MembersTreeRequest, FileMemberTree> _membersAsTreeHandler;
private readonly Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> _findUsagesHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;

public OmniSharpCodeLensHandler(
Mef.IRequestHandler<MembersTreeRequest, FileMemberTree> membersAsTreeHandler,
Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> findUsagesHandler,
DocumentSelector documentSelector)
TextDocumentSelector documentSelector)
{
_membersAsTreeHandler = membersAsTreeHandler;
_findUsagesHandler = findUsagesHandler;
Expand Down Expand Up @@ -68,8 +68,8 @@ public override async Task<CodeLens> Handle(CodeLens request, CancellationToken
var omnisharpRequest = new FindUsagesRequest
{
FileName = Helpers.FromUri(request.Data.ToObject<Uri>()),
Column = (int) request.Range.Start.Character,
Line = (int) request.Range.Start.Line,
Column = (int)request.Range.Start.Character,
Line = (int)request.Range.Start.Line,
OnlyThisFile = false,
ExcludeDefinition = true
};
Expand All @@ -83,11 +83,13 @@ public override async Task<CodeLens> Handle(CodeLens request, CancellationToken
ContractResolver = new CamelCasePropertyNamesContractResolver()
};

request = request with { Command = new Command
request = request with
{
Title = length == 1 ? "1 reference" : $"{length} references",
Name = "omnisharp/client/findReferences",
Arguments = new JArray(
Command = new Command
{
Title = length == 1 ? "1 reference" : $"{length} references",
Name = "omnisharp/client/findReferences",
Arguments = new JArray(
new[]
{
JObject.FromObject(
Expand All @@ -98,7 +100,8 @@ public override async Task<CodeLens> Handle(CodeLens request, CancellationToken
},
jsonCamelCaseContract)
}),
} };
}
};

return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Models.v1.Completion;

using CompletionTriggerKind = OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionTriggerKind;
using OmnisharpCompletionTriggerKind = OmniSharp.Models.v1.Completion.CompletionTriggerKind;
using CompletionItemKind = OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItemKind;
using OmnisharpCompletionItemKind = OmniSharp.Models.v1.Completion.CompletionItemKind;
using static OmniSharp.LanguageServerProtocol.Helpers;
using CompletionItem = OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItem;
using OmnisharpCompletionItem = OmniSharp.Models.v1.Completion.CompletionItem;
using CompletionItemKind = OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItemKind;
using CompletionItemTag = OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionItemTag;
using OmnisharpCompletionItemTag = OmniSharp.Models.v1.Completion.CompletionItemTag;
using CompletionTriggerKind = OmniSharp.Extensions.LanguageServer.Protocol.Models.CompletionTriggerKind;
using InsertTextFormat = OmniSharp.Extensions.LanguageServer.Protocol.Models.InsertTextFormat;
using OmnisharpCompletionItem = OmniSharp.Models.v1.Completion.CompletionItem;
using OmnisharpCompletionItemKind = OmniSharp.Models.v1.Completion.CompletionItemKind;
using OmnisharpCompletionItemTag = OmniSharp.Models.v1.Completion.CompletionItemTag;
using OmnisharpCompletionTriggerKind = OmniSharp.Models.v1.Completion.CompletionTriggerKind;
using OmnisharpInsertTextFormat = OmniSharp.Models.v1.Completion.InsertTextFormat;

#nullable enable
Expand All @@ -43,12 +43,12 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)

private readonly Mef.IRequestHandler<CompletionRequest, CompletionResponse> _completionHandler;
private readonly Mef.IRequestHandler<CompletionResolveRequest, CompletionResolveResponse> _completionResolveHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;

public OmniSharpCompletionHandler(
Mef.IRequestHandler<CompletionRequest, CompletionResponse> completionHandler,
Mef.IRequestHandler<CompletionResolveRequest, CompletionResolveResponse> completionResolveHandler,
DocumentSelector documentSelector)
TextDocumentSelector documentSelector)
{
_completionHandler = completionHandler;
_completionResolveHandler = completionResolveHandler;
Expand All @@ -62,7 +62,7 @@ public override async Task<CompletionList> Handle(CompletionParams request, Canc
FileName = Helpers.FromUri(request.TextDocument.Uri),
Column = Convert.ToInt32(request.Position.Character),
Line = Convert.ToInt32(request.Position.Line),
CompletionTrigger = ConvertEnum<CompletionTriggerKind, OmnisharpCompletionTriggerKind>(request.Context?.TriggerKind ?? CompletionTriggerKind.Invoked),
CompletionTrigger = Helpers.ConvertEnum<CompletionTriggerKind, OmnisharpCompletionTriggerKind>(request.Context?.TriggerKind ?? CompletionTriggerKind.Invoked),
TriggerCharacter = request.Context?.TriggerCharacter is { Length: > 0 } str ? str[0] : null
};

Expand Down Expand Up @@ -94,40 +94,6 @@ protected override CompletionRegistrationOptions CreateRegistrationOptions(Compl
};
}

private static T2 ConvertEnum<T1, T2>(T1 t1)
where T1 : struct, Enum
where T2 : struct, Enum
{
VerifyEnumsInSync(typeof(T1), typeof(T2));
// The JIT will optimize this box away
return (T2)(object)t1;
}

[Conditional("DEBUG")]
private static void VerifyEnumsInSync(Type enum1, Type enum2)
{
Debug.Assert(enum1.IsEnum);
Debug.Assert(enum2.IsEnum);

var lspValues = Enum.GetValues(enum1);
var modelValues = Enum.GetValues(enum2);
Debug.Assert(lspValues.Length == modelValues.Length);
for (int i = 0; i < lspValues.Length; i++)
{
var lspValue = lspValues.GetValue(i);
var modelValue = modelValues.GetValue(i);

if (lspValue is null || modelValue is null)
{
Debug.Assert(lspValue is null && modelValue is null);
}
else
{
Debug.Assert((int)lspValue == (int)modelValue);
}
}
}

private CompletionItem ToLSPCompletionItem(OmnisharpCompletionItem omnisharpCompletionItem)
=> new CompletionItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
}

private readonly Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse> _definitionHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;

public OmniSharpDefinitionHandler(Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse> definitionHandler, DocumentSelector documentSelector)
public OmniSharpDefinitionHandler(Mef.IRequestHandler<GotoDefinitionRequest, GotoDefinitionResponse> definitionHandler, TextDocumentSelector documentSelector)
{
_definitionHandler = definitionHandler;
_documentSelector = documentSelector;
Expand Down Expand Up @@ -57,7 +57,7 @@ protected override DefinitionRegistrationOptions CreateRegistrationOptions(Defin
{
return new DefinitionRegistrationOptions()
{
DocumentSelector = _documentSelector
DocumentSelector = _documentSelector,
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
}

private readonly Mef.IRequestHandler<FormatRangeRequest, FormatRangeResponse> _formatRangeHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;

public OmniSharpDocumentFormatRangeHandler(Mef.IRequestHandler<FormatRangeRequest, FormatRangeResponse> formatRangeHandler, DocumentSelector documentSelector)
public OmniSharpDocumentFormatRangeHandler(Mef.IRequestHandler<FormatRangeRequest, FormatRangeResponse> formatRangeHandler, TextDocumentSelector documentSelector)
{
_formatRangeHandler = formatRangeHandler;
_documentSelector = documentSelector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
}

private readonly Mef.IRequestHandler<CodeFormatRequest, CodeFormatResponse> _codeFormatHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;

public OmniSharpDocumentFormattingHandler(Mef.IRequestHandler<CodeFormatRequest, CodeFormatResponse> codeFormatHandler, DocumentSelector documentSelector)
public OmniSharpDocumentFormattingHandler(Mef.IRequestHandler<CodeFormatRequest, CodeFormatResponse> codeFormatHandler, TextDocumentSelector documentSelector)
{
_codeFormatHandler = codeFormatHandler;
_documentSelector = documentSelector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
}

private readonly Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> _findUsagesHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;

public OmniSharpDocumentHighlightHandler(Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> findUsagesHandler, DocumentSelector documentSelector)
public OmniSharpDocumentHighlightHandler(Mef.IRequestHandler<FindUsagesRequest, QuickFixResponse> findUsagesHandler, TextDocumentSelector documentSelector)
{
_findUsagesHandler = findUsagesHandler;
_documentSelector = documentSelector;
Expand Down Expand Up @@ -62,7 +62,7 @@ protected override DocumentHighlightRegistrationOptions CreateRegistrationOption
{
return new DocumentHighlightRegistrationOptions()
{
DocumentSelector = _documentSelector
DocumentSelector = _documentSelector,
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
}

private readonly Mef.IRequestHandler<FormatAfterKeystrokeRequest, FormatRangeResponse> _formatAfterKeystrokeHandler;
private readonly DocumentSelector _documentSelector;
private readonly TextDocumentSelector _documentSelector;

public OmniSharpDocumentOnTypeFormattingHandler(Mef.IRequestHandler<FormatAfterKeystrokeRequest, FormatRangeResponse> formatAfterKeystrokeHandler, DocumentSelector documentSelector)
public OmniSharpDocumentOnTypeFormattingHandler(Mef.IRequestHandler<FormatAfterKeystrokeRequest, FormatRangeResponse> formatAfterKeystrokeHandler, TextDocumentSelector documentSelector)
{
_formatAfterKeystrokeHandler = formatAfterKeystrokeHandler;
_documentSelector = documentSelector;
Expand Down
Loading

0 comments on commit 747568c

Please sign in to comment.