-
Notifications
You must be signed in to change notification settings - Fork 237
Add cancellation for textDocument/completion
, textDocument/codeAction
, textDocument/folding
#1238
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
Changes from 4 commits
29bf123
e9acba9
78addec
d711f99
d90ea75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,28 +27,25 @@ internal class DocumentHighlightHandler : IDocumentHighlightHandler | |
|
||
private readonly SymbolsService _symbolsService; | ||
|
||
private readonly TextDocumentRegistrationOptions _registrationOptions; | ||
|
||
private DocumentHighlightCapability _capability; | ||
|
||
public DocumentHighlightHandler( | ||
ILoggerFactory loggerFactory, | ||
WorkspaceService workspaceService, | ||
SymbolsService symbolService) | ||
{ | ||
_logger = loggerFactory.CreateLogger<OmniSharp.Extensions.LanguageServer.Protocol.Server.DocumentHighlightHandler>(); | ||
_logger = loggerFactory.CreateLogger<DocumentHighlightHandler>(); | ||
_workspaceService = workspaceService; | ||
_symbolsService = symbolService; | ||
_registrationOptions = new TextDocumentRegistrationOptions() | ||
{ | ||
DocumentSelector = LspUtils.PowerShellDocumentSelector | ||
}; | ||
_logger.LogInformation("highlight handler loaded"); | ||
} | ||
|
||
public TextDocumentRegistrationOptions GetRegistrationOptions() | ||
public DocumentHighlightRegistrationOptions GetRegistrationOptions() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
return _registrationOptions; | ||
return new DocumentHighlightRegistrationOptions | ||
{ | ||
DocumentSelector = LspUtils.PowerShellDocumentSelector | ||
}; | ||
} | ||
|
||
public Task<DocumentHighlightContainer> Handle( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,16 +30,22 @@ public FoldingRangeHandler(ILoggerFactory factory, ConfigurationService configur | |
_configurationService = configurationService; | ||
_workspaceService = workspaceService; | ||
} | ||
public TextDocumentRegistrationOptions GetRegistrationOptions() | ||
|
||
public FoldingRangeRegistrationOptions GetRegistrationOptions() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
return new TextDocumentRegistrationOptions() | ||
return new FoldingRangeRegistrationOptions | ||
{ | ||
DocumentSelector = LspUtils.PowerShellDocumentSelector, | ||
DocumentSelector = LspUtils.PowerShellDocumentSelector | ||
}; | ||
} | ||
|
||
public Task<Container<FoldingRange>> Handle(FoldingRangeRequestParam request, CancellationToken cancellationToken) | ||
{ | ||
if (cancellationToken.IsCancellationRequested) | ||
{ | ||
return Task.FromResult(new Container<FoldingRange>()); | ||
} | ||
|
||
// TODO Should be using dynamic registrations | ||
if (!_configurationService.CurrentSettings.CodeFolding.Enable) { return null; } | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
using Microsoft.Extensions.Logging; | ||
using Microsoft.PowerShell.EditorServices.Services; | ||
using Microsoft.PowerShell.EditorServices.Utility; | ||
using OmniSharp.Extensions.LanguageServer.Protocol; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Models; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Server; | ||
|
@@ -37,9 +38,17 @@ public DocumentFormattingHandlers( | |
_workspaceService = workspaceService; | ||
} | ||
|
||
public TextDocumentRegistrationOptions GetRegistrationOptions() | ||
public DocumentFormattingRegistrationOptions GetRegistrationOptions() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
return new TextDocumentRegistrationOptions | ||
return new DocumentFormattingRegistrationOptions | ||
{ | ||
DocumentSelector = LspUtils.PowerShellDocumentSelector | ||
}; | ||
} | ||
|
||
DocumentRangeFormattingRegistrationOptions IRegistration<DocumentRangeFormattingRegistrationOptions>.GetRegistrationOptions() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
return new DocumentRangeFormattingRegistrationOptions | ||
{ | ||
DocumentSelector = LspUtils.PowerShellDocumentSelector | ||
}; | ||
|
Uh oh!
There was an error while loading. Please reload this page.