diff --git a/.appveyor.yml b/.appveyor.yml
index 0a03220ca..3e1a4039b 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,4 +1,4 @@
-image: Visual Studio 2017
+image: Visual Studio 2019
environment:
nuget_org_apikey:
secure: lFaEHVRMsSWTveDH/DuLl4+hv+O0i4qLkbhW3aCgzq0oCrOuV+0TSEkqe6aiHuNX
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 9074b10f4..d274c9c00 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -20,9 +20,9 @@ resources:
variables:
Configuration: Release
Verbosity: Normal
- DotNetVersion: "2.2.101"
+ DotNetVersion: "3.1.101"
CakeVersion: "0.32.1"
- NuGetVersion: "4.9.2"
+ NuGetVersion: "5.4.0"
Coverage: "$(Agent.BuildDirectory)/c"
VstsCoverage: "$(Coverage)"
Artifacts: $(Build.ArtifactStagingDirectory)
@@ -32,7 +32,7 @@ variables:
jobs:
- job: GitVersion
pool:
- vmImage: "VS2017-Win2016"
+ vmImage: "windows-latest"
steps:
- template: gitversion/store.yml@rsg
parameters:
@@ -52,24 +52,25 @@ jobs:
# NuGetVersion: $(NuGetVersion)
# Script: build.cake
- - template: pipeline/cake-job.yml@rsg
- parameters:
- name: 'Linux'
- dependsOn: GitVersion
- vmImage: "Ubuntu-16.04"
- pushNuget: false
- Configuration: $(Configuration)
- Verbosity: $(Verbosity)
- CakeVersion: $(CakeVersion)
- DotNetVersion: $(DotNetVersion)
- NuGetVersion: $(NuGetVersion)
- Script: build.cake
+# Disabled temporarily as the template does not support multiple runtimes
+# - template: pipeline/cake-job.yml@rsg
+# parameters:
+# name: 'Linux'
+# dependsOn: GitVersion
+# vmImage: "ubuntu-latest"
+# pushNuget: false
+# Configuration: $(Configuration)
+# Verbosity: $(Verbosity)
+# CakeVersion: $(CakeVersion)
+# DotNetVersion: $(DotNetVersion)
+# NuGetVersion: $(NuGetVersion)
+# Script: build.cake
- template: pipeline/cake-job.yml@rsg
parameters:
name: 'Windows'
dependsOn: GitVersion
- vmImage: "VS2017-Win2016"
+ vmImage: "windows-latest"
pushNuget: true
Configuration: $(Configuration)
Verbosity: $(Verbosity)
diff --git a/Common.Build.props b/Directory.Build.props
similarity index 90%
rename from Common.Build.props
rename to Directory.Build.props
index efd8012dd..684075e67 100644
--- a/Common.Build.props
+++ b/Directory.Build.props
@@ -3,7 +3,7 @@
OmniSharp
Copyright OmniSharp and contributors © 2018
David Driscoll
- latest
+ 8
true
false
https://github.com/OmniSharp/csharp-language-server-protocol/blob/master/LICENSE
@@ -11,8 +11,6 @@
https://github.com/OmniSharp/csharp-language-server-protocol
lsp;language server;language server protocol;language client;language server client
$(MSBuildThisFileDirectory)\lsp.snk
- 2.0.0
- 7.0.0
true
diff --git a/Common.Build.targets b/Directory.Build.targets
similarity index 82%
rename from Common.Build.targets
rename to Directory.Build.targets
index e840a9a02..76375100c 100644
--- a/Common.Build.targets
+++ b/Directory.Build.targets
@@ -1,12 +1,12 @@
-
+
-
-
-
+
+
+
@@ -22,7 +22,7 @@
-
-
+
+
diff --git a/LSP.sln b/LSP.sln
index 21996c820..42a833a93 100644
--- a/LSP.sln
+++ b/LSP.sln
@@ -23,7 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{AE4D
build.cake = build.cake
build.ps1 = build.ps1
build.sh = build.sh
- Common.Build.props = Common.Build.props
+ Directory.Build.props = Directory.Build.props
nuget.config = nuget.config
EndProjectSection
EndProject
diff --git a/build.ps1 b/build.ps1
index 1f83e96e6..b96667bc5 100644
--- a/build.ps1
+++ b/build.ps1
@@ -42,7 +42,7 @@ Param(
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release",
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
- [string]$Verbosity = "Verbose",
+ [string]$Verbosity = "Normal",
[Alias("DryRun","Noop")]
[switch]$WhatIf,
[switch]$SkipToolPackageRestore,
diff --git a/build.sh b/build.sh
index 2ca498e13..3aa618fe3 100644
--- a/build.sh
+++ b/build.sh
@@ -7,7 +7,7 @@
##########################################################################
# Define directories.
-SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
TOOLS_DIR=$SCRIPT_DIR/tools
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
@@ -26,7 +26,7 @@ fi
SCRIPT="build.cake"
TARGET="Default"
CONFIGURATION="Release"
-VERBOSITY="verbose"
+VERBOSITY="normal"
DRYRUN=
SHOW_VERSION=false
SCRIPT_ARGUMENTS=()
@@ -34,21 +34,37 @@ SCRIPT_ARGUMENTS=()
# Parse arguments.
for i in "$@"; do
case $1 in
- -s|--script) SCRIPT="$2"; shift ;;
- -t|--target) TARGET="$2"; shift ;;
- -c|--configuration) CONFIGURATION="$2"; shift ;;
- -v|--verbosity) VERBOSITY="$2"; shift ;;
- -d|--dryrun) DRYRUN="-dryrun" ;;
- --version) SHOW_VERSION=true ;;
- --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
- *) SCRIPT_ARGUMENTS+=("$1") ;;
+ -s | --script)
+ SCRIPT="$2"
+ shift
+ ;;
+ -t | --target)
+ TARGET="$2"
+ shift
+ ;;
+ -c | --configuration)
+ CONFIGURATION="$2"
+ shift
+ ;;
+ -v | --verbosity)
+ VERBOSITY="$2"
+ shift
+ ;;
+ -d | --dryrun) DRYRUN="-dryrun" ;;
+ --version) SHOW_VERSION=true ;;
+ --)
+ shift
+ SCRIPT_ARGUMENTS+=("$@")
+ break
+ ;;
+ *) SCRIPT_ARGUMENTS+=("$1") ;;
esac
shift
done
# Make sure the tools folder exist.
if [ ! -d "$TOOLS_DIR" ]; then
- mkdir "$TOOLS_DIR"
+ mkdir "$TOOLS_DIR"
fi
# Make sure that packages.config exist.
@@ -73,7 +89,7 @@ fi
# Restore tools from NuGet.
pushd "$TOOLS_DIR" >/dev/null
-if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then
+if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$(cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//')" != "$($MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }')" ]; then
find . -type d ! -name . | xargs rm -rf
fi
@@ -83,7 +99,7 @@ if [ $? -ne 0 ]; then
exit 1
fi
-$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5
+$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >|$PACKAGES_CONFIG_MD5
popd >/dev/null
diff --git a/sample/SampleServer/SampleServer.csproj b/sample/SampleServer/SampleServer.csproj
index 42a242247..641e790a2 100644
--- a/sample/SampleServer/SampleServer.csproj
+++ b/sample/SampleServer/SampleServer.csproj
@@ -3,15 +3,20 @@
Exe
false
- netcoreapp2.1
+ netcoreapp3.1
win7-x64
-
-
+
+
+
+
+
+
+
diff --git a/src/Client/Client.csproj b/src/Client/Client.csproj
index 8cf3af79f..b51e0e4a5 100644
--- a/src/Client/Client.csproj
+++ b/src/Client/Client.csproj
@@ -1,7 +1,7 @@
- netstandard2.0
+ netstandard2.1;netstandard2.0
AnyCPU
OmniSharp.Extensions.LanguageClient
OmniSharp.Extensions.LanguageServer.Client
diff --git a/src/Client/Protocol/LspConnection.cs b/src/Client/Protocol/LspConnection.cs
index 3d1ef3e7b..7e99dedeb 100644
--- a/src/Client/Protocol/LspConnection.cs
+++ b/src/Client/Protocol/LspConnection.cs
@@ -291,7 +291,14 @@ public void Disconnect(bool flushOutgoing = false)
);
}
- _cancellationSource?.Cancel();
+ try
+ {
+ _cancellationSource?.Cancel();
+ }
+ catch (AggregateException e) when (e.InnerException is ObjectDisposedException)
+ {
+ // Swallow object disposed exception
+ }
_sendLoop = null;
_receiveLoop = null;
_dispatchLoop = null;
@@ -312,8 +319,7 @@ public void SendEmptyNotification(string method)
if (!IsOpen)
throw new LspException("Not connected to the language server.");
- _outgoing.TryAdd(new ClientMessage
- {
+ _outgoing.TryAdd(new ClientMessage {
// No Id means it's a notification.
Method = method
});
@@ -339,8 +345,7 @@ public void SendNotification(string method, object notification)
if (!IsOpen)
throw new LspException("Not connected to the language server.");
- _outgoing.TryAdd(new ClientMessage
- {
+ _outgoing.TryAdd(new ClientMessage {
// No Id means it's a notification.
Method = method,
Params = JToken.FromObject(notification, Serializer.JsonSerializer)
@@ -376,8 +381,7 @@ public void SendNotification(string method, object notification)
string requestId = Interlocked.Increment(ref _nextRequestId).ToString();
var responseCompletion = new TaskCompletionSource(state: requestId);
- cancellationToken.Register(() =>
- {
+ cancellationToken.Register(() => {
responseCompletion.TrySetException(
new OperationCanceledException("The request was canceled via the supplied cancellation token.", cancellationToken)
);
@@ -385,8 +389,7 @@ public void SendNotification(string method, object notification)
// Send notification telling server to cancel the request, if possible.
if (!_outgoing.IsAddingCompleted)
{
- _outgoing.TryAdd(new ClientMessage
- {
+ _outgoing.TryAdd(new ClientMessage {
Method = JsonRpcNames.CancelRequest,
Params = new JObject(
new JProperty("id", requestId)
@@ -397,8 +400,7 @@ public void SendNotification(string method, object notification)
_responseCompletions.TryAdd(requestId, responseCompletion);
- _outgoing.TryAdd(new ClientMessage
- {
+ _outgoing.TryAdd(new ClientMessage {
Id = requestId,
Method = method,
Params = request != null ? JToken.FromObject(request, Serializer.JsonSerializer) : null
@@ -439,8 +441,7 @@ public void SendNotification(string method, object notification)
string requestId = Interlocked.Increment(ref _nextRequestId).ToString();
var responseCompletion = new TaskCompletionSource(state: requestId);
- cancellationToken.Register(() =>
- {
+ cancellationToken.Register(() => {
responseCompletion.TrySetException(
new OperationCanceledException("The request was canceled via the supplied cancellation token.", cancellationToken)
);
@@ -448,8 +449,7 @@ public void SendNotification(string method, object notification)
// Send notification telling server to cancel the request, if possible.
if (!_outgoing.IsAddingCompleted)
{
- _outgoing.TryAdd(new ClientMessage
- {
+ _outgoing.TryAdd(new ClientMessage {
Method = JsonRpcNames.CancelRequest,
Params = new JObject(
new JProperty("id", requestId)
@@ -460,8 +460,7 @@ public void SendNotification(string method, object notification)
_responseCompletions.TryAdd(requestId, responseCompletion);
- _outgoing.TryAdd(new ClientMessage
- {
+ _outgoing.TryAdd(new ClientMessage {
Id = requestId,
Method = method,
Params = request != null ? JToken.FromObject(request, Serializer.JsonSerializer) : null
@@ -871,8 +870,7 @@ private void DispatchRequest(ServerMessage requestMessage)
}
#pragma warning disable CS4014 // Continuation does the work we need; no need to await it as this would tie up the dispatch loop.
- handlerTask.ContinueWith(_ =>
- {
+ handlerTask.ContinueWith(_ => {
if (handlerTask.IsCanceled)
Log.LogDebug("{RequestMethod} request {RequestId} canceled.", requestMessage.Method, requestId);
else if (handlerTask.IsFaulted)
@@ -893,8 +891,7 @@ private void DispatchRequest(ServerMessage requestMessage)
{
Log.LogDebug("{RequestMethod} request {RequestId} complete (Result = {@Result}).", requestMessage.Method, requestId, handlerTask.Result);
- _outgoing.TryAdd(new ClientMessage
- {
+ _outgoing.TryAdd(new ClientMessage {
Id = requestMessage.Id,
Method = requestMessage.Method,
Result = handlerTask.Result != null ? JToken.FromObject(handlerTask.Result, Serializer.JsonSerializer) : null
@@ -962,8 +959,7 @@ void DispatchNotification(ServerMessage notificationMessage)
handlerTask = _dispatcher.TryHandleEmptyNotification(notificationMessage.Method);
#pragma warning disable CS4014 // Continuation does the work we need; no need to await it as this would tie up the dispatch loop.
- handlerTask.ContinueWith(completedHandler =>
- {
+ handlerTask.ContinueWith(completedHandler => {
if (handlerTask.IsCanceled)
Log.LogDebug("{NotificationMethod} notification canceled.", notificationMessage.Method);
else if (handlerTask.IsFaulted)
@@ -1006,31 +1002,31 @@ static LspException CreateLspException(ServerMessage message)
switch (message.Error.Code)
{
case LspErrorCodes.InvalidRequest:
- {
- return new LspInvalidRequestException(requestId);
- }
+ {
+ return new LspInvalidRequestException(requestId);
+ }
case LspErrorCodes.InvalidParameters:
- {
- return new LspInvalidParametersException(requestId);
- }
+ {
+ return new LspInvalidParametersException(requestId);
+ }
case LspErrorCodes.InternalError:
- {
- return new LspInternalErrorException(requestId);
- }
+ {
+ return new LspInternalErrorException(requestId);
+ }
case LspErrorCodes.MethodNotSupported:
- {
- return new LspMethodNotSupportedException(requestId, message.Method);
- }
+ {
+ return new LspMethodNotSupportedException(requestId, message.Method);
+ }
case LspErrorCodes.RequestCancelled:
- {
- return new LspRequestCancelledException(requestId);
- }
+ {
+ return new LspRequestCancelledException(requestId);
+ }
default:
- {
- string exceptionMessage = $"Error processing request '{message.Id}' ({message.Error.Code}): {message.Error.Message}";
+ {
+ string exceptionMessage = $"Error processing request '{message.Id}' ({message.Error.Code}): {message.Error.Message}";
- return new LspRequestException(exceptionMessage, requestId, message.Error.Code);
- }
+ return new LspRequestException(exceptionMessage, requestId, message.Error.Code);
+ }
}
}
}
diff --git a/src/Dap.Protocol/Dap.Protocol.csproj b/src/Dap.Protocol/Dap.Protocol.csproj
index 77f219518..69c439aac 100644
--- a/src/Dap.Protocol/Dap.Protocol.csproj
+++ b/src/Dap.Protocol/Dap.Protocol.csproj
@@ -1,20 +1,20 @@
- netstandard2.0
- AnyCPU
- OmniSharp.Extensions.DebugAdapter
- OmniSharp.Extensions.DebugAdapter.Protocol
- Debug Adapter Protocol models, classes, interfaces and helper methods
+ netstandard2.1;netstandard2.0
+ AnyCPU
+ OmniSharp.Extensions.DebugAdapter
+ OmniSharp.Extensions.DebugAdapter.Protocol
+ Debug Adapter Protocol models, classes, interfaces and helper methods
- <_Parameter1>OmniSharp.Extensions.LanguageServer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f
+ <_Parameter1>OmniSharp.Extensions.LanguageServer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f
- <_Parameter1>OmniSharp.Extensions.LanguageClient, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f
+ <_Parameter1>OmniSharp.Extensions.LanguageClient, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f
diff --git a/src/Dap.Server/Dap.Server.csproj b/src/Dap.Server/Dap.Server.csproj
index fe4c39586..a14b11d7b 100644
--- a/src/Dap.Server/Dap.Server.csproj
+++ b/src/Dap.Server/Dap.Server.csproj
@@ -1,11 +1,11 @@
- netstandard2.0
- AnyCPU
- OmniSharp.Extensions.DebugAdapter.Server
- OmniSharp.Extensions.DebugAdapter.Server
- You can use this package to create a debug adapter, that will be consumed by many clients
+ netstandard2.1;netstandard2.0
+ AnyCPU
+ OmniSharp.Extensions.DebugAdapter.Server
+ OmniSharp.Extensions.DebugAdapter.Server
+ You can use this package to create a debug adapter, that will be consumed by many clients
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 1c75d26bf..e29e62116 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,5 +1,5 @@
-
+
$(GitVersion_NuGetVersion)
0.0.9.9
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index 286f354b1..cfebec206 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -1,3 +1,3 @@
-
+
diff --git a/src/JsonRpc/JsonRpc.csproj b/src/JsonRpc/JsonRpc.csproj
index b175f8b7a..9a81ff798 100644
--- a/src/JsonRpc/JsonRpc.csproj
+++ b/src/JsonRpc/JsonRpc.csproj
@@ -1,6 +1,6 @@
- netstandard2.0
+ netstandard2.1;netstandard2.0
AnyCPU
OmniSharp.Extensions.JsonRpc
OmniSharp.Extensions.JsonRpc
diff --git a/src/Protocol/Protocol.csproj b/src/Protocol/Protocol.csproj
index 85b78f506..f7840fada 100644
--- a/src/Protocol/Protocol.csproj
+++ b/src/Protocol/Protocol.csproj
@@ -1,6 +1,6 @@
- netstandard2.0
+ netstandard2.1;netstandard2.0
AnyCPU
OmniSharp.Extensions.LanguageProtocol
OmniSharp.Extensions.LanguageServer.Protocol
diff --git a/src/Server/ILanguageServer.cs b/src/Server/ILanguageServer.cs
index 7b83e6155..faed9f407 100644
--- a/src/Server/ILanguageServer.cs
+++ b/src/Server/ILanguageServer.cs
@@ -15,8 +15,10 @@ public interface ILanguageServer : OmniSharp.Extensions.LanguageServer.Protocol.
InitializeResult ServerSettings { get; }
IServiceProvider Services { get; }
+ IObservable Start { get; }
IObservable Shutdown { get; }
IObservable Exit { get; }
+ Task WasStarted { get; }
Task WasShutDown { get; }
Task WaitForExit { get; }
}
diff --git a/src/Server/InitializeDelegate.cs b/src/Server/InitializeDelegate.cs
index 6c071ec21..ab0c4df9b 100644
--- a/src/Server/InitializeDelegate.cs
+++ b/src/Server/InitializeDelegate.cs
@@ -4,4 +4,5 @@
namespace OmniSharp.Extensions.LanguageServer.Server
{
public delegate Task InitializeDelegate(ILanguageServer server, InitializeParams request);
+ public delegate Task StartedDelegate(InitializeResult result);
}
diff --git a/src/Server/LanguageServer.cs b/src/Server/LanguageServer.cs
index 8e151edaa..f55479ec8 100644
--- a/src/Server/LanguageServer.cs
+++ b/src/Server/LanguageServer.cs
@@ -25,7 +25,9 @@
using OmniSharp.Extensions.LanguageServer.Server.Matchers;
using OmniSharp.Extensions.LanguageServer.Server.Pipelines;
using ISerializer = OmniSharp.Extensions.LanguageServer.Protocol.Serialization.ISerializer;
+using System.Reactive;
using System.Reactive.Disposables;
+using System.Reactive.Linq;
using Microsoft.Extensions.Options;
using OmniSharp.Extensions.LanguageServer.Server.Logging;
@@ -44,6 +46,7 @@ public class LanguageServer : ILanguageServer, IInitializeHandler, IInitializedH
private readonly IHandlerCollection _collection;
private readonly IEnumerable _initializeDelegates;
private readonly IEnumerable _initializedDelegates;
+ private readonly IEnumerable _startedDelegates;
private readonly IResponseRouter _responseRouter;
private readonly ISubject _initializeComplete = new AsyncSubject();
private readonly CompositeDisposable _disposable = new CompositeDisposable();
@@ -108,6 +111,7 @@ public static ILanguageServer PreInit(LanguageServerOptions options)
options.TextDocumentIdentifierTypes,
options.InitializeDelegates,
options.InitializedDelegates,
+ options.StartedDelegates,
options.LoggingBuilderAction
);
}
@@ -128,6 +132,7 @@ internal LanguageServer(
IEnumerable textDocumentIdentifierTypes,
IEnumerable initializeDelegates,
IEnumerable initializedDelegates,
+ IEnumerable startedDelegates,
Action loggingBuilderAction)
{
var outputHandler = new OutputHandler(output, serializer);
@@ -143,6 +148,7 @@ internal LanguageServer(
_collection = collection;
_initializeDelegates = initializeDelegates;
_initializedDelegates = initializedDelegates;
+ _startedDelegates = startedDelegates;
services.AddSingleton(outputHandler);
services.AddSingleton(_collection);
@@ -301,8 +307,7 @@ private IDisposable RegisterHandlers(LspHandlerDescriptorDisposable handlerDispo
{
var registrations = handlerDisposable.Descriptors
.Where(d => d.AllowsDynamicRegistration)
- .Select(d => new Registration()
- {
+ .Select(d => new Registration() {
Id = d.Id.ToString(),
Method = d.Method,
RegisterOptions = d.RegistrationOptions
@@ -314,10 +319,8 @@ private IDisposable RegisterHandlers(LspHandlerDescriptorDisposable handlerDispo
return new ImmutableDisposable(
handlerDisposable,
- Disposable.Create(() =>
- {
- Client.UnregisterCapability(new UnregistrationParams()
- {
+ Disposable.Create(() => {
+ Client.UnregisterCapability(new UnregistrationParams() {
Unregisterations = registrations.ToArray()
}).ToObservable().Subscribe();
}));
@@ -329,7 +332,17 @@ private async Task Initialize(CancellationToken token)
_connection.Open();
try
{
- await _initializeComplete.ToTask(token);
+ await _initializeComplete
+ .Select(result => _startedDelegates.Select(@delegate =>
+ Observable.FromAsync(() => @delegate(result))
+ )
+ .ToObservable()
+ .Merge()
+ .Select(z => result)
+ )
+ .Merge()
+ .LastAsync()
+ .ToTask(token);
}
catch (TaskCanceledException e)
{
@@ -395,8 +408,7 @@ async Task IRequestHandler
var ccp = new ClientCapabilityProvider(_collection);
- var serverCapabilities = new ServerCapabilities()
- {
+ var serverCapabilities = new ServerCapabilities() {
CodeActionProvider = ccp.GetStaticOptions(textDocumentCapabilities.CodeAction).Get(CodeActionOptions.Of),
CodeLensProvider = ccp.GetStaticOptions(textDocumentCapabilities.CodeLens).Get(CodeLensOptions.Of),
CompletionProvider = ccp.GetStaticOptions(textDocumentCapabilities.Completion).Get(CompletionOptions.Of),
@@ -423,10 +435,8 @@ async Task IRequestHandler
if (_collection.ContainsHandler(typeof(IDidChangeWorkspaceFoldersHandler)))
{
- serverCapabilities.Workspace = new WorkspaceServerCapabilities()
- {
- WorkspaceFolders = new WorkspaceFolderOptions()
- {
+ serverCapabilities.Workspace = new WorkspaceServerCapabilities() {
+ WorkspaceFolders = new WorkspaceFolderOptions() {
Supported = true,
ChangeNotifications = Guid.NewGuid().ToString()
}
@@ -456,8 +466,7 @@ async Task IRequestHandler
}
else
{
- serverCapabilities.TextDocumentSync = new TextDocumentSyncOptions()
- {
+ serverCapabilities.TextDocumentSync = new TextDocumentSyncOptions() {
Change = textDocumentSyncKind,
OpenClose = _collection.ContainsHandler(typeof(IDidOpenTextDocumentHandler)) || _collection.ContainsHandler(typeof(IDidCloseTextDocumentHandler)),
Save = _collection.ContainsHandler(typeof(IDidSaveTextDocumentHandler)) ?
@@ -496,7 +505,7 @@ async Task IRequestHandler
return result;
}
- public async Task Handle(InitializedParams @params, CancellationToken token)
+ public async Task Handle(InitializedParams @params, CancellationToken token)
{
if (_clientVersion == ClientVersion.Lsp3)
{
@@ -506,7 +515,7 @@ public async Task Handle(InitializedParams @params, CancellationToken toke
_initializeComplete.OnNext(ServerSettings);
_initializeComplete.OnCompleted();
}
- return Unit.Value;
+ return MediatR.Unit.Value;
}
private async Task DynamicallyRegisterHandlers(Registration[] registrations)
@@ -522,6 +531,7 @@ private async Task DynamicallyRegisterHandlers(Registration[] registrations)
public IObservable Shutdown => _shutdownHandler.Shutdown;
public IObservable Exit => _exitHandler.Exit;
+ public IObservable Start => _initializeComplete.AsObservable();
public void SendNotification(string method)
{
@@ -555,6 +565,7 @@ public TaskCompletionSource GetRequest(long id)
public Task WasShutDown => _shutdownHandler.WasShutDown;
public Task WaitForExit => _exitHandler.WaitForExit;
+ public Task WasStarted => _initializeComplete.ToTask();
public void Dispose()
{
diff --git a/src/Server/LanguageServerOptions.cs b/src/Server/LanguageServerOptions.cs
index 8ddaab941..23792d9f6 100644
--- a/src/Server/LanguageServerOptions.cs
+++ b/src/Server/LanguageServerOptions.cs
@@ -37,6 +37,7 @@ public LanguageServerOptions()
internal readonly List InitializeDelegates = new List();
internal readonly List InitializedDelegates = new List();
+ internal readonly List StartedDelegates = new List();
public IDisposable AddHandler(string method, IJsonRpcHandler handler)
{
diff --git a/src/Server/LanguageServerOptionsExtensions.cs b/src/Server/LanguageServerOptionsExtensions.cs
index c8280c59f..da24cfa59 100644
--- a/src/Server/LanguageServerOptionsExtensions.cs
+++ b/src/Server/LanguageServerOptionsExtensions.cs
@@ -91,6 +91,12 @@ public static LanguageServerOptions OnInitialized(this LanguageServerOptions opt
return options;
}
+ public static LanguageServerOptions OnStarted(this LanguageServerOptions options, StartedDelegate @delegate)
+ {
+ options.StartedDelegates.Add(@delegate);
+ return options;
+ }
+
public static LanguageServerOptions ConfigureLogging(this LanguageServerOptions options, Action builderAction)
{
options.LoggingBuilderAction = builderAction;
diff --git a/src/Server/Server.csproj b/src/Server/Server.csproj
index 6d1fb94ca..373b4d4f9 100644
--- a/src/Server/Server.csproj
+++ b/src/Server/Server.csproj
@@ -1,6 +1,6 @@
- netstandard2.0
+ netstandard2.1;netstandard2.0
AnyCPU
OmniSharp.Extensions.LanguageServer
OmniSharp.Extensions.LanguageServer.Server
@@ -13,6 +13,6 @@
-
+
diff --git a/test/Client.Tests/Client.Tests.csproj b/test/Client.Tests/Client.Tests.csproj
index 132480187..50dd308e3 100644
--- a/test/Client.Tests/Client.Tests.csproj
+++ b/test/Client.Tests/Client.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp3.1
OmniSharp.Extensions.LanguageClient.Tests
OmniSharp.Extensions.LanguageServerProtocol.Client.Tests
diff --git a/test/Client.Tests/ClientTests.cs b/test/Client.Tests/ClientTests.cs
index ea1a0ed76..6b2e90741 100644
--- a/test/Client.Tests/ClientTests.cs
+++ b/test/Client.Tests/ClientTests.cs
@@ -15,6 +15,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace OmniSharp.Extensions.LanguageServerProtocol.Client.Tests
{
@@ -58,7 +59,7 @@ public ClientTests(ITestOutputHelper testOutput)
///
/// Ensure that the language client can successfully request Hover information.
///
- [Fact(DisplayName = "Language client can successfully request hover info", Skip = "Periodic failures")]
+ [Fact(DisplayName = "Language client can successfully request hover info")]
public async Task Hover_Success()
{
await Connect();
@@ -67,8 +68,7 @@ public async Task Hover_Success()
const int column = 5;
var expectedHoverContent = new MarkedStringsOrMarkupContent("123", "456", "789");
- ServerDispatcher.HandleRequest(DocumentNames.Hover, (request, cancellationToken) =>
- {
+ ServerDispatcher.HandleRequest(DocumentNames.Hover, (request, cancellationToken) => {
Assert.NotNull(request.TextDocument);
Assert.Equal(AbsoluteDocumentPath,
@@ -78,11 +78,9 @@ public async Task Hover_Success()
Assert.Equal(line, request.Position.Line);
Assert.Equal(column, request.Position.Character);
- return Task.FromResult(new Hover
- {
+ return Task.FromResult(new Hover {
Contents = expectedHoverContent,
- Range = new Range
- {
+ Range = new Range {
Start = request.Position,
End = request.Position
}
@@ -114,7 +112,7 @@ public async Task Hover_Success()
///
/// Ensure that the language client can successfully request Completions.
///
- [Fact(DisplayName = "Language client can successfully request completions", Skip = "Periodic failures")]
+ [Fact(DisplayName = "Language client can successfully request completions")]
public async Task Completions_Success()
{
await Connect();
@@ -150,8 +148,7 @@ public async Task Completions_Success()
}
};
- ServerDispatcher.HandleRequest(DocumentNames.Completion, (request, cancellationToken) =>
- {
+ ServerDispatcher.HandleRequest(DocumentNames.Completion, (request, cancellationToken) => {
Assert.NotNull(request.TextDocument);
Assert.Equal(expectedDocumentUri, request.TextDocument.Uri);
@@ -171,8 +168,7 @@ public async Task Completions_Success()
Assert.NotNull(actualCompletions.Items);
var actualCompletionItems = actualCompletions.Items.ToArray();
- Assert.Collection(actualCompletionItems, actualCompletionItem =>
- {
+ Assert.Collection(actualCompletionItems, actualCompletionItem => {
var expectedCompletionItem = expectedCompletionItems[0];
Assert.Equal(expectedCompletionItem.Kind, actualCompletionItem.Kind);
@@ -194,7 +190,7 @@ public async Task Completions_Success()
///
/// Ensure that the language client can successfully request SignatureHelp.
///
- [Fact(DisplayName = "Language client can successfully request signature help", Skip = "Periodic failures")]
+ [Fact(DisplayName = "Language client can successfully request signature help", Skip = "disabled because of equality check")]
public async Task SignatureHelp_Success()
{
await Connect();
@@ -261,7 +257,7 @@ public async Task SignatureHelp_Success()
///
/// Ensure that the language client can successfully request Definition.
///
- [Fact(DisplayName = "Language client can successfully request definition", Skip = "Periodic failures")]
+ [Fact(DisplayName = "Language client can successfully request definition")]
public async Task Definition_Success()
{
await Connect();
@@ -319,7 +315,7 @@ public async Task Definition_Success()
///
/// Ensure that the language client can successfully request DocumentHighlight.
///
- [Fact(DisplayName = "Language client can successfully request document highlights", Skip = "Periodic failures")]
+ [Fact(DisplayName = "Language client can successfully request document highlights")]
public async Task DocumentHighlights_Success()
{
await Connect();
@@ -426,7 +422,7 @@ public async Task DocumentSymbols_DocumentSymbol_Success()
///
/// Ensure that the language client can successfully request FoldingRanges.
///
- [Fact(DisplayName = "Language client can successfully request document folding ranges", Skip = "Periodic failures")]
+ [Fact(DisplayName = "Language client can successfully request document folding ranges")]
public async Task FoldingRanges_Success()
{
await Connect();
@@ -467,7 +463,7 @@ public async Task FoldingRanges_Success()
///
/// Ensure that the language client can successfully receive Diagnostics from the server.
///
- [Fact(DisplayName = "Language client can successfully receive diagnostics", Skip = "Periodic failures")]
+ [Fact(DisplayName = "Language client can successfully receive diagnostics")]
public async Task Diagnostics_Success()
{
await Connect();
@@ -502,16 +498,14 @@ public async Task Diagnostics_Success()
Uri actualDocumentUri = null;
List actualDiagnostics = null;
- LanguageClient.TextDocument.OnPublishDiagnostics((documentUri, diagnostics) =>
- {
+ LanguageClient.TextDocument.OnPublishDiagnostics((documentUri, diagnostics) => {
actualDocumentUri = documentUri;
actualDiagnostics = diagnostics;
receivedDiagnosticsNotification.SetResult(null);
});
- ServerConnection.SendNotification(DocumentNames.PublishDiagnostics, new PublishDiagnosticsParams
- {
+ ServerConnection.SendNotification(DocumentNames.PublishDiagnostics, new PublishDiagnosticsParams {
Uri = DocumentUri.FromFileSystemPath(documentPath),
Diagnostics = expectedDiagnostics
});
@@ -566,18 +560,14 @@ async Task Connect(bool handleServerInitialize = true)
///
void HandleServerInitialize()
{
- ServerDispatcher.HandleRequest("initialize", (request, cancellationToken) =>
- {
- return Task.FromResult(new InitializeResult
- {
- Capabilities = new ServerCapabilities
- {
+ ServerDispatcher.HandleRequest("initialize", (request, cancellationToken) => {
+ return Task.FromResult(new InitializeResult {
+ Capabilities = new ServerCapabilities {
HoverProvider = true
}
});
});
- ServerDispatcher.HandleEmptyNotification("initialized", () =>
- {
+ ServerDispatcher.HandleEmptyNotification("initialized", () => {
Log.LogInformation("Server initialized.");
});
}
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index 3f6d55f7a..63d3d077a 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -1,5 +1,5 @@
-
+
false
true
@@ -13,7 +13,7 @@
true
json,lcov,cobertura,opencover
$(MSBuildProjectName.Replace('.', '-'))
- $([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('Common.Build.props', '$(MSBuildProjectDirectory)'))))/coverage/$(CoverletName)/
+ $([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildProjectDirectory)'))))/coverage/$(CoverletName)/
$(CoverageDirectory)/$(CoverletName)
diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets
index e67be132e..02257bc6b 100644
--- a/test/Directory.Build.targets
+++ b/test/Directory.Build.targets
@@ -14,5 +14,5 @@
-
+
diff --git a/test/JsonRpc.Tests/JsonRpc.Tests.csproj b/test/JsonRpc.Tests/JsonRpc.Tests.csproj
index a28df7f7a..8e2cba858 100644
--- a/test/JsonRpc.Tests/JsonRpc.Tests.csproj
+++ b/test/JsonRpc.Tests/JsonRpc.Tests.csproj
@@ -1,6 +1,6 @@
- netcoreapp2.1
+ netcoreapp3.1
true
AnyCPU
diff --git a/test/Lsp.Tests/LanguageServerTests.cs b/test/Lsp.Tests/LanguageServerTests.cs
index b3d24ca48..37cc25705 100644
--- a/test/Lsp.Tests/LanguageServerTests.cs
+++ b/test/Lsp.Tests/LanguageServerTests.cs
@@ -14,6 +14,7 @@
using OmniSharp.Extensions.LanguageServer.Server;
using Xunit;
using Xunit.Abstractions;
+using Microsoft.Extensions.DependencyInjection;
namespace Lsp.Tests
{
@@ -23,7 +24,7 @@ public LanguageServerTests(ITestOutputHelper testOutputHelper) : base(testOutput
{
}
- [Fact(Skip = "Disabled to see if build passes on ci")]
+ [Fact(Skip = "Doesn't work in CI :(")]
public async Task Works_With_IWorkspaceSymbolsHandler()
{
var process = new NamedPipeServerProcess(Guid.NewGuid().ToString("N"), LoggerFactory);
@@ -35,12 +36,9 @@ public async Task Works_With_IWorkspaceSymbolsHandler()
cts.CancelAfter(1000 * 60 * 5);
var serverStart = LanguageServer.From(x => x
- //.WithHandler(handler)
.WithInput(process.ClientOutputStream)
- .WithOutput(process.ClientInputStream),
- //.WithLoggerFactory(LoggerFactory)
- //.AddDefaultLoggingProvider()
- //.WithMinimumLogLevel(LogLevel.Trace),
+ .WithOutput(process.ClientInputStream)
+ .ConfigureLogging(z => z.Services.AddSingleton(LoggerFactory)),
cts.Token
);
@@ -51,7 +49,7 @@ await Task.WhenAll(
cts.Token),
serverStart
);
- var server = await serverStart;
+ using var server = await serverStart;
server.AddHandlers(handler);
}
@@ -63,9 +61,7 @@ public async Task GH141_CrashesWithEmptyInitializeParams()
var server = LanguageServer.PreInit(x => x
.WithInput(process.ClientOutputStream)
.WithOutput(process.ClientInputStream)
- //.WithLoggerFactory(LoggerFactory)
- //.AddDefaultLoggingProvider()
- //.WithMinimumLogLevel(LogLevel.Trace)
+ .ConfigureLogging(z => z.Services.AddSingleton(LoggerFactory))
.AddHandlers(TextDocumentSyncHandlerExtensions.With(DocumentSelector.ForPattern("**/*.cs"), "csharp"))
) as IRequestHandler;
@@ -74,5 +70,38 @@ public async Task GH141_CrashesWithEmptyInitializeParams()
Func a = async () => await handler.Handle(new InitializeParams() { }, CancellationToken.None);
a.Should().NotThrow();
}
+
+ [Fact(Skip = "Doesn't work in CI :(")]
+ public async Task TriggersStartedTask()
+ {
+ var startedDelegate = Substitute.For();
+ startedDelegate(Arg.Any()).Returns(Task.CompletedTask);
+ var process = new NamedPipeServerProcess(Guid.NewGuid().ToString("N"), LoggerFactory);
+ await process.Start();
+ var client = new LanguageClient(LoggerFactory, process);
+ var cts = new CancellationTokenSource();
+ cts.CancelAfter(TimeSpan.FromSeconds(15));
+ var serverStart = LanguageServer.From(x => x
+ .OnStarted(startedDelegate)
+ .OnStarted(startedDelegate)
+ .OnStarted(startedDelegate)
+ .OnStarted(startedDelegate)
+ .WithInput(process.ClientOutputStream)
+ .WithOutput(process.ClientInputStream)
+ .ConfigureLogging(z => z.Services.AddSingleton(LoggerFactory))
+ .AddHandlers(TextDocumentSyncHandlerExtensions.With(DocumentSelector.ForPattern("**/*.cs"), "csharp"))
+ , cts.Token);
+
+ await Task.WhenAll(
+ client.Initialize(
+ Directory.GetCurrentDirectory(),
+ new object(),
+ cts.Token),
+ serverStart
+ );
+ using var server = await serverStart;
+
+ _ = startedDelegate.Received(4)(Arg.Any());
+ }
}
}
diff --git a/test/Lsp.Tests/Lsp.Tests.csproj b/test/Lsp.Tests/Lsp.Tests.csproj
index 4616f235b..cc3482d2c 100644
--- a/test/Lsp.Tests/Lsp.Tests.csproj
+++ b/test/Lsp.Tests/Lsp.Tests.csproj
@@ -1,6 +1,6 @@
- netcoreapp2.1
+ netcoreapp3.1
true
AnyCPU
@@ -14,6 +14,6 @@
-
+
-
\ No newline at end of file
+
diff --git a/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs b/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs
index 695ce127a..8b0be06a9 100644
--- a/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs
+++ b/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs
@@ -27,6 +27,7 @@
using ISerializer = OmniSharp.Extensions.LanguageServer.Protocol.Serialization.ISerializer;
using Serializer = OmniSharp.Extensions.LanguageServer.Protocol.Serialization.Serializer;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests
{
diff --git a/test/Lsp.Tests/Models/ApplyWorkspaceEditParamsTests.cs b/test/Lsp.Tests/Models/ApplyWorkspaceEditParamsTests.cs
index a44a14d71..ec29502d7 100644
--- a/test/Lsp.Tests/Models/ApplyWorkspaceEditParamsTests.cs
+++ b/test/Lsp.Tests/Models/ApplyWorkspaceEditParamsTests.cs
@@ -7,6 +7,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
@@ -15,10 +16,8 @@ public class ApplyWorkspaceEditParamsTests
[Theory, JsonFixture]
public void SimpleTest(string expected)
{
- var model = new ApplyWorkspaceEditParams()
- {
- Edit = new WorkspaceEdit()
- {
+ var model = new ApplyWorkspaceEditParams() {
+ Edit = new WorkspaceEdit() {
Changes = new Dictionary>() {
{
new Uri("file:///abc/123/d.cs"), new [] {
@@ -46,10 +45,8 @@ public void SimpleTest(string expected)
[Theory, JsonFixture]
public void NonStandardCharactersTest(string expected)
{
- var model = new ApplyWorkspaceEditParams()
- {
- Edit = new WorkspaceEdit()
- {
+ var model = new ApplyWorkspaceEditParams() {
+ Edit = new WorkspaceEdit() {
Changes = new Dictionary>() {
{
// Mörkö
@@ -78,15 +75,11 @@ public void NonStandardCharactersTest(string expected)
[Theory, JsonFixture]
public void DocumentChangesTest(string expected)
{
- var model = new ApplyWorkspaceEditParams()
- {
- Edit = new WorkspaceEdit()
- {
+ var model = new ApplyWorkspaceEditParams() {
+ Edit = new WorkspaceEdit() {
DocumentChanges = new Container(
- new TextDocumentEdit()
- {
- TextDocument = new VersionedTextDocumentIdentifier()
- {
+ new TextDocumentEdit() {
+ TextDocument = new VersionedTextDocumentIdentifier() {
Version = 1,
Uri = new Uri("file:///abc/123/d.cs"),
},
@@ -101,10 +94,8 @@ public void DocumentChangesTest(string expected)
}
}
},
- new TextDocumentEdit()
- {
- TextDocument = new VersionedTextDocumentIdentifier()
- {
+ new TextDocumentEdit() {
+ TextDocument = new VersionedTextDocumentIdentifier() {
Version = 1,
Uri = new Uri("file:///abc/123/b.cs"),
},
@@ -151,13 +142,13 @@ public void DocumentChangesTest(string expected)
var deresult = new Serializer(ClientVersion.Lsp3).DeserializeObject(expected);
deresult.Should().BeEquivalentTo(model, x => x
.ComparingByMembers()
- //.ComparingByMembers()
- //.ComparingByMembers()
- //.ComparingByMembers()
- //.ComparingByMembers()
- //.ComparingByMembers()
- //.ComparingByMembers()
- //.ComparingByMembers()
+ //.ComparingByMembers()
+ //.ComparingByMembers()
+ //.ComparingByMembers()
+ //.ComparingByMembers()
+ //.ComparingByMembers()
+ //.ComparingByMembers()
+ //.ComparingByMembers()
);
}
}
diff --git a/test/Lsp.Tests/Models/CodeActionContextTests.cs b/test/Lsp.Tests/Models/CodeActionContextTests.cs
index c5fe3ed3b..a9e241bc3 100644
--- a/test/Lsp.Tests/Models/CodeActionContextTests.cs
+++ b/test/Lsp.Tests/Models/CodeActionContextTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/CodeActionParamsTests.cs b/test/Lsp.Tests/Models/CodeActionParamsTests.cs
index 1a4c05e28..a363bd493 100644
--- a/test/Lsp.Tests/Models/CodeActionParamsTests.cs
+++ b/test/Lsp.Tests/Models/CodeActionParamsTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/CodeLensTests.cs b/test/Lsp.Tests/Models/CodeLensTests.cs
index 56f57f092..6beb82c65 100644
--- a/test/Lsp.Tests/Models/CodeLensTests.cs
+++ b/test/Lsp.Tests/Models/CodeLensTests.cs
@@ -8,6 +8,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/DiagnosticTests.cs b/test/Lsp.Tests/Models/DiagnosticTests.cs
index 53339fcc3..852ded7ab 100644
--- a/test/Lsp.Tests/Models/DiagnosticTests.cs
+++ b/test/Lsp.Tests/Models/DiagnosticTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/DidChangeTextDocumentParamsTests.cs b/test/Lsp.Tests/Models/DidChangeTextDocumentParamsTests.cs
index e0c8ca097..691a76114 100644
--- a/test/Lsp.Tests/Models/DidChangeTextDocumentParamsTests.cs
+++ b/test/Lsp.Tests/Models/DidChangeTextDocumentParamsTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/DocumentHighlightTests.cs b/test/Lsp.Tests/Models/DocumentHighlightTests.cs
index 32f351ef9..353886bfb 100644
--- a/test/Lsp.Tests/Models/DocumentHighlightTests.cs
+++ b/test/Lsp.Tests/Models/DocumentHighlightTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/DocumentLinkTests.cs b/test/Lsp.Tests/Models/DocumentLinkTests.cs
index 13de583fb..87964a305 100644
--- a/test/Lsp.Tests/Models/DocumentLinkTests.cs
+++ b/test/Lsp.Tests/Models/DocumentLinkTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/DocumentSymbolInformationTests.cs b/test/Lsp.Tests/Models/DocumentSymbolInformationTests.cs
index b9e404618..c8b06b89c 100644
--- a/test/Lsp.Tests/Models/DocumentSymbolInformationTests.cs
+++ b/test/Lsp.Tests/Models/DocumentSymbolInformationTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/HoverTests.cs b/test/Lsp.Tests/Models/HoverTests.cs
index a9ac3f1c8..9d14fc90a 100644
--- a/test/Lsp.Tests/Models/HoverTests.cs
+++ b/test/Lsp.Tests/Models/HoverTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/LocationOrLocationLinksTests.cs b/test/Lsp.Tests/Models/LocationOrLocationLinksTests.cs
index c26e46333..2a0a71d6e 100644
--- a/test/Lsp.Tests/Models/LocationOrLocationLinksTests.cs
+++ b/test/Lsp.Tests/Models/LocationOrLocationLinksTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
@@ -74,7 +75,7 @@ public void LocationLinkTest(string expected)
result.Should().Be(expected);
var deresult = new Serializer(ClientVersion.Lsp3).DeserializeObject(expected);
- deresult.Should().BeEquivalentTo(model, x => x
+ deresult.Should().BeEquivalentTo(model, x => x
.ComparingByMembers()
);
}
diff --git a/test/Lsp.Tests/Models/LocationTests.cs b/test/Lsp.Tests/Models/LocationTests.cs
index dba350247..2d8ee0c3b 100644
--- a/test/Lsp.Tests/Models/LocationTests.cs
+++ b/test/Lsp.Tests/Models/LocationTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/PublishDiagnosticsParamsTests.cs b/test/Lsp.Tests/Models/PublishDiagnosticsParamsTests.cs
index 9bbbe30e9..a4f5b8405 100644
--- a/test/Lsp.Tests/Models/PublishDiagnosticsParamsTests.cs
+++ b/test/Lsp.Tests/Models/PublishDiagnosticsParamsTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/RangeTests.cs b/test/Lsp.Tests/Models/RangeTests.cs
index 5b553f542..0fdce3b3e 100644
--- a/test/Lsp.Tests/Models/RangeTests.cs
+++ b/test/Lsp.Tests/Models/RangeTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/TextDocumentContentChangeEventTests.cs b/test/Lsp.Tests/Models/TextDocumentContentChangeEventTests.cs
index 7816aabe2..afa290c81 100644
--- a/test/Lsp.Tests/Models/TextDocumentContentChangeEventTests.cs
+++ b/test/Lsp.Tests/Models/TextDocumentContentChangeEventTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/TextDocumentEditTests.cs b/test/Lsp.Tests/Models/TextDocumentEditTests.cs
index 561a18264..b93494c72 100644
--- a/test/Lsp.Tests/Models/TextDocumentEditTests.cs
+++ b/test/Lsp.Tests/Models/TextDocumentEditTests.cs
@@ -7,6 +7,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/TextDocumentIdentifierTests.cs b/test/Lsp.Tests/Models/TextDocumentIdentifierTests.cs
index 074a0d57f..6a9c44431 100644
--- a/test/Lsp.Tests/Models/TextDocumentIdentifierTests.cs
+++ b/test/Lsp.Tests/Models/TextDocumentIdentifierTests.cs
@@ -53,10 +53,10 @@ public void Should_Deserialize_For_Example_Value()
{
var serializer = new Serializer(ClientVersion.Lsp3);
var result = serializer.DeserializeObject(@"{
- ""uri"":""file:///Users/tyler/Code/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.E2E/bin/Debug/netcoreapp2.1/0b0jnxg2.kgh.ps1""
+ ""uri"":""file:///Users/tyler/Code/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.E2E/bin/Debug/netcoreapp3.1/0b0jnxg2.kgh.ps1""
}");
- result.Uri.Should().Be(new Uri("file:///Users/tyler/Code/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.E2E/bin/Debug/netcoreapp2.1/0b0jnxg2.kgh.ps1", UriKind.Absolute));
+ result.Uri.Should().Be(new Uri("file:///Users/tyler/Code/PowerShell/vscode/PowerShellEditorServices/test/PowerShellEditorServices.Test.E2E/bin/Debug/netcoreapp3.1/0b0jnxg2.kgh.ps1", UriKind.Absolute));
}
}
}
diff --git a/test/Lsp.Tests/Models/TextEditTests.cs b/test/Lsp.Tests/Models/TextEditTests.cs
index 6e0f7713c..9ada7bf3a 100644
--- a/test/Lsp.Tests/Models/TextEditTests.cs
+++ b/test/Lsp.Tests/Models/TextEditTests.cs
@@ -6,6 +6,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/WorkspaceEditTests.cs b/test/Lsp.Tests/Models/WorkspaceEditTests.cs
index 64fccc5f4..86583f95b 100644
--- a/test/Lsp.Tests/Models/WorkspaceEditTests.cs
+++ b/test/Lsp.Tests/Models/WorkspaceEditTests.cs
@@ -7,6 +7,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/test/Lsp.Tests/Models/WorkspaceSymbolInformationTests.cs b/test/Lsp.Tests/Models/WorkspaceSymbolInformationTests.cs
index 895a05d30..5525ca99e 100644
--- a/test/Lsp.Tests/Models/WorkspaceSymbolInformationTests.cs
+++ b/test/Lsp.Tests/Models/WorkspaceSymbolInformationTests.cs
@@ -5,6 +5,7 @@
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using Xunit;
+using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
namespace Lsp.Tests.Models
{
diff --git a/vscode-testextension/src/extension.ts b/vscode-testextension/src/extension.ts
index 7856d1395..fb78c024e 100644
--- a/vscode-testextension/src/extension.ts
+++ b/vscode-testextension/src/extension.ts
@@ -20,7 +20,7 @@ import { Trace } from "vscode-jsonrpc";
export function activate(context: ExtensionContext) {
// The server is implemented in node
- let serverExe = 'dotnet';
+ let serverExe = "dotnet";
// let serverExe = 'D:\\Development\\Omnisharp\\csharp-language-server-protocol\\sample\\SampleServer\\bin\\Debug\\netcoreapp2.0\\win7-x64\\SampleServer.exe';
// let serverExe = "D:/Development/Omnisharp/omnisharp-roslyn/artifacts/publish/OmniSharp.Stdio.Driver/win7-x64/OmniSharp.exe";
@@ -31,9 +31,19 @@ export function activate(context: ExtensionContext) {
// Otherwise the run options are used
let serverOptions: ServerOptions = {
// run: { command: serverExe, args: ['-lsp', '-d'] },
- run: { command: serverExe, args: ["C:/src/gh/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp2.1/win7-x64/SampleServer.dll"] },
+ run: {
+ command: serverExe,
+ args: [
+ "C:/src/gh/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp3.1/win7-x64/SampleServer.dll"
+ ]
+ },
// debug: { command: serverExe, args: ['-lsp', '-d'] }
- debug: { command: serverExe, args: ["C:/src/gh/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp2.1/win7-x64/SampleServer.dll"] }
+ debug: {
+ command: serverExe,
+ args: [
+ "C:/src/gh/csharp-language-server-protocol/sample/SampleServer/bin/Debug/netcoreapp3.1/win7-x64/SampleServer.dll"
+ ]
+ }
};
// Options to control the language client