Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LSP to 0.11.x #1387

Merged
merged 8 commits into from
Feb 3, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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 NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="OmniSharp" value="https://www.myget.org/F/omnisharp/api/v3/index.json" />
</packageSources>
</configuration>
6 changes: 5 additions & 1 deletion build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@
<PackageReference Update="Nuget.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Versioning" Version="$(NuGetPackageVersion)" />

<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.11.3" />

<PackageReference Update="SQLitePCLRaw.bundle_green" Version="1.1.2" />
<PackageReference Update="System.Collections.Immutable" Version="1.4.0" />
<PackageReference Update="System.ComponentModel.Composition" Version="4.5.0" />
<PackageReference Update="System.Composition" Version="1.0.31" />
<PackageReference Update="System.Reflection.Metadata" Version="1.4.2" />
<PackageReference Update="System.Threading.Tasks.Dataflow" Version="4.5.24" />
<PackageReference Update="System.ValueTuple" Version="4.3.0" />
<PackageReference Update="System.ValueTuple" Version="4.4.0" />

<PackageReference Update="System.Reactive" Version="4.1.2" />

<PackageReference Update="xunit.runner.visualstudio" Version="$(XunitPackageVersion)" />
<PackageReference Update="xunit" Version="$(XunitPackageVersion)" />
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.Host/CommandLineApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void DebugAttach()
{
if (Debug)
{
Console.WriteLine($"Attach debugger to process {Process.GetCurrentProcess().Id} to continue...");
//Console.WriteLine($"Attach debugger to process {Process.GetCurrentProcess().Id} to continue...");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops.. This should not be here.

BTW, @david-driscoll, we need a way to get this working with LSP? Currently VSCode starts yelling at me when non-json-RPC formatted content arrives on STDOUT.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be fine with it commented for now... worst case we can always have someone uncomment it for debugging purposes, if they haven't figure out which pid they need.

while (!Debugger.IsAttached)
{
Thread.Sleep(100);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
using System;
using System.Linq;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using OmniSharp.Eventing;
using OmniSharp.Extensions.LanguageServer;
using OmniSharp.Extensions.LanguageServer.Models;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.Diagnostics;
using OmniSharp.Models.Events;
using OmniSharp.Stdio.Protocol;
using OmniSharp.Stdio.Services;
using ILanguageServer = OmniSharp.Extensions.LanguageServer.Server.ILanguageServer;

namespace OmniSharp.LanguageServerProtocol.Eventing
{
public class LanguageServerEventEmitter : IEventEmitter
{
private readonly LanguageServer _server;
private ILanguageServer _server;

public LanguageServerEventEmitter(LanguageServer server)
public void SetLanguageServer(ILanguageServer server)
{
_server = server;
}
Expand All @@ -34,7 +29,7 @@ public void Emit(string kind, object args)

foreach (var group in groups)
{
_server.PublishDiagnostics(new PublishDiagnosticsParams()
_server.Document.PublishDiagnostics(new PublishDiagnosticsParams()
{
Uri = group.Key,
Diagnostics = group
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Capabilities.Client;
using OmniSharp.Extensions.LanguageServer.Models;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Mef;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.AutoComplete;
using OmniSharp.Models.TypeLookup;

namespace OmniSharp.LanguageServerProtocol.Handlers
{
Expand Down Expand Up @@ -75,7 +71,7 @@ public CompletionHandler(Mef.IRequestHandler<AutoCompleteRequest, IEnumerable<Au
_documentSelector = documentSelector;
}

public async Task<CompletionList> Handle(TextDocumentPositionParams request, CancellationToken token)
public async Task<CompletionList> Handle(CompletionParams request, CancellationToken token)
{
var omnisharpRequest = new AutoCompleteRequest()
{
Expand Down Expand Up @@ -131,7 +127,8 @@ public CompletionRegistrationOptions GetRegistrationOptions()
{
return new CompletionRegistrationOptions()
{
DocumentSelector = _documentSelector
DocumentSelector = _documentSelector,
TriggerCharacters = new[] { "." },
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Capabilities.Client;
using OmniSharp.Extensions.LanguageServer.Models;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Mef;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.GotoDefinition;
using static OmniSharp.LanguageServerProtocol.Helpers;

Expand Down Expand Up @@ -43,7 +38,7 @@ public TextDocumentRegistrationOptions GetRegistrationOptions()
};
}

public async Task<LocationOrLocations> Handle(TextDocumentPositionParams request, CancellationToken token)
public async Task<LocationOrLocations> Handle(DefinitionParams request, CancellationToken token)
{
var omnisharpRequest = new GotoDefinitionRequest()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Capabilities.Client;
using OmniSharp.Extensions.LanguageServer.Models;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Models;
using OmniSharp.Models.MembersFlat;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.MembersTree;
using OmniSharp.Models.TypeLookup;

namespace OmniSharp.LanguageServerProtocol.Handlers
{
Expand Down Expand Up @@ -48,15 +44,15 @@ public DocumentSymbolHandler(Mef.IRequestHandler<MembersTreeRequest, FileMemberT
_documentSelector = documentSelector;
}

public async Task<SymbolInformationContainer> Handle(DocumentSymbolParams request, CancellationToken token)
public async Task<DocumentSymbolInformationContainer> Handle(DocumentSymbolParams request, CancellationToken token)
{
var omnisharpRequest = new MembersTreeRequest()
{
FileName = Helpers.FromUri(request.TextDocument.Uri),
};

var omnisharpResponse = await _membersAsTreeHandler.Handle(omnisharpRequest);
var symbolInformationContainer = new List<SymbolInformation>();
var symbolInformationContainer = new List<DocumentSymbolInformation>();

foreach (var node in omnisharpResponse.TopLevelTypeDefinitions)
{
Expand All @@ -79,9 +75,9 @@ public void SetCapability(DocumentSymbolCapability capability)
_capability = capability;
}

private static void ToDocumentSymbol(FileMemberElement node, List<SymbolInformation> symbolInformationContainer, string containerName = null)
private static void ToDocumentSymbol(FileMemberElement node, List<DocumentSymbolInformation> symbolInformationContainer, string containerName = null)
{
var symbolInformation = new SymbolInformation
var symbolInformation = new DocumentSymbolInformation
{
Name = node.Location.Text,
Kind = Kinds[node.Kind],
Expand Down
13 changes: 5 additions & 8 deletions src/OmniSharp.LanguageServerProtocol/Handlers/HoverHandler.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Capabilities.Client;
using OmniSharp.Extensions.LanguageServer.Models;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Mef;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.TypeLookup;

namespace OmniSharp.LanguageServerProtocol.Handlers
Expand Down Expand Up @@ -41,7 +38,7 @@ public TextDocumentRegistrationOptions GetRegistrationOptions()
};
}

public async Task<Hover> Handle(TextDocumentPositionParams request, CancellationToken token)
public async Task<Hover> Handle(HoverParams request, CancellationToken token)
{
var omnisharpRequest = new TypeLookupRequest()
{
Expand All @@ -57,7 +54,7 @@ public async Task<Hover> Handle(TextDocumentPositionParams request, Cancellation
{
// TODO: Range? We don't currently have that!
// Range =
Contents = new MarkedStringContainer(omnisharpResponse.Type, omnisharpResponse.Documentation)
Contents = new MarkedStringsOrMarkupContent(new MarkedStringContainer(omnisharpResponse.Type, omnisharpResponse.Documentation))
};
}

Expand Down
11 changes: 5 additions & 6 deletions src/OmniSharp.LanguageServerProtocol/Handlers/RenameHandler.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Capabilities.Client;
using OmniSharp.Extensions.LanguageServer.Models;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.Rename;

namespace OmniSharp.LanguageServerProtocol.Handlers
Expand Down Expand Up @@ -74,9 +73,9 @@ public async Task<WorkspaceEdit> Handle(RenameParams request, CancellationToken
};
}

public TextDocumentRegistrationOptions GetRegistrationOptions()
public RenameRegistrationOptions GetRegistrationOptions()
{
return new TextDocumentRegistrationOptions
return new RenameRegistrationOptions
{
DocumentSelector = _documentSelector
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Capabilities.Client;
using OmniSharp.Extensions.LanguageServer.Models;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Models.AutoComplete;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Models.SignatureHelp;

namespace OmniSharp.LanguageServerProtocol.Handlers
Expand All @@ -33,7 +31,7 @@ public static IEnumerable<IJsonRpcHandler> Enumerate(RequestHandlers handlers)
yield return new SignatureHelpHandler(handler, selector);
}

public async Task<SignatureHelp> Handle(TextDocumentPositionParams request, CancellationToken token)
public async Task<SignatureHelp> Handle(SignatureHelpParams request, CancellationToken token)
{
var omnisharpRequest = new SignatureHelpRequest
{
Expand Down
Loading