-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from OmniSharp/serially-parallel
Serially parallel
- Loading branch information
Showing
73 changed files
with
552 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using OmniSharp.Extensions.LanguageServer; | ||
using OmniSharp.Extensions.LanguageServer.Abstractions; | ||
using OmniSharp.Extensions.LanguageServer.Capabilities.Client; | ||
using OmniSharp.Extensions.LanguageServer.Capabilities.Server; | ||
using OmniSharp.Extensions.LanguageServer.Models; | ||
using OmniSharp.Extensions.LanguageServer.Protocol; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Document; | ||
|
||
namespace SampleServer | ||
{ | ||
class TextDocumentHandler : ITextDocumentSyncHandler | ||
{ | ||
private readonly ILanguageServer _router; | ||
|
||
private readonly DocumentSelector _documentSelector = new DocumentSelector( | ||
new DocumentFilter() | ||
{ | ||
Pattern = "**/*.csproj", | ||
Language = "xml" | ||
} | ||
); | ||
|
||
private SynchronizationCapability _capability; | ||
|
||
public TextDocumentHandler(ILanguageServer router) | ||
{ | ||
_router = router; | ||
} | ||
|
||
public TextDocumentSyncOptions Options { get; } = new TextDocumentSyncOptions() | ||
{ | ||
WillSaveWaitUntil = false, | ||
WillSave = true, | ||
Change = TextDocumentSyncKind.Full, | ||
Save = new SaveOptions() | ||
{ | ||
IncludeText = true | ||
}, | ||
OpenClose = true | ||
}; | ||
|
||
public Task Handle(DidChangeTextDocumentParams notification) | ||
{ | ||
_router.LogMessage(new LogMessageParams() | ||
{ | ||
Type = MessageType.Log, | ||
Message = "Hello World!!!!" | ||
}); | ||
return Task.CompletedTask; | ||
} | ||
|
||
TextDocumentChangeRegistrationOptions IRegistration<TextDocumentChangeRegistrationOptions>.GetRegistrationOptions() | ||
{ | ||
return new TextDocumentChangeRegistrationOptions() | ||
{ | ||
DocumentSelector = _documentSelector, | ||
SyncKind = Options.Change | ||
}; | ||
} | ||
|
||
public void SetCapability(SynchronizationCapability capability) | ||
{ | ||
_capability = capability; | ||
} | ||
|
||
public async Task Handle(DidOpenTextDocumentParams notification) | ||
{ | ||
_router.LogMessage(new LogMessageParams() | ||
{ | ||
Type = MessageType.Log, | ||
Message = "Hello World!!!!" | ||
}); | ||
} | ||
|
||
TextDocumentRegistrationOptions IRegistration<TextDocumentRegistrationOptions>.GetRegistrationOptions() | ||
{ | ||
return new TextDocumentRegistrationOptions() | ||
{ | ||
DocumentSelector = _documentSelector, | ||
}; | ||
} | ||
|
||
public Task Handle(DidCloseTextDocumentParams notification) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
public Task Handle(DidSaveTextDocumentParams notification) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
|
||
TextDocumentSaveRegistrationOptions IRegistration<TextDocumentSaveRegistrationOptions>.GetRegistrationOptions() | ||
{ | ||
return new TextDocumentSaveRegistrationOptions() | ||
{ | ||
DocumentSelector = _documentSelector, | ||
IncludeText = Options.Save.IncludeText | ||
}; | ||
} | ||
public TextDocumentAttributes GetTextDocumentAttributes(Uri uri) | ||
{ | ||
return new TextDocumentAttributes(uri, "csharp"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace OmniSharp.Extensions.JsonRpc | ||
{ | ||
public static class Events | ||
{ | ||
public static EventId UnhandledException = new EventId(1337_100); | ||
public static EventId UnhandledRequest = new EventId(1337_101); | ||
public static EventId UnhandledNotification = new EventId(1337_102); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace OmniSharp.Extensions.JsonRpc | ||
{ | ||
public sealed class ParallelAttribute : ProcessAttribute | ||
{ | ||
public ParallelAttribute() : base(RequestProcessType.Parallel) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
|
||
namespace OmniSharp.Extensions.JsonRpc | ||
{ | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] | ||
public class ProcessAttribute : Attribute | ||
{ | ||
public ProcessAttribute(RequestProcessType type) | ||
{ | ||
Type = type; | ||
} | ||
|
||
public RequestProcessType Type { get; } | ||
} | ||
} |
Oops, something went wrong.