Skip to content

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

Merged

Conversation

TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Mar 17, 2020

Fixes PowerShell/vscode-powershell#2556
possibly fixes PowerShell/vscode-powershell#2518
possibly fixes PowerShell/vscode-powershell#2522

Probably should wait til a stable release of Omnisharp but they've fixed cancellation and this does feel faster in @adamdriscoll's ps1 talked about here: PowerShell/vscode-powershell#2556 (comment)

when testing in that ps1 for a bit I received this number of requests that wanted to be cancelled:

Count Name
----- ----
    3  completionItem/resolve
    7  textDocument/codeAction
    1  textDocument/codeLens
    3  textDocument/completion
    1  textDocument/documentSymbol
   14  textDocument/foldingRange

This PR could cancel 14 + 7 + 3 = 24 out of 29 requests (best case)

@TylerLeonhardt TylerLeonhardt requested a review from rjmholt March 17, 2020 20:07
@TylerLeonhardt TylerLeonhardt requested a review from rjmholt March 24, 2020 21:40
@TylerLeonhardt
Copy link
Member Author

Codacy Here is an overview of what got changed by this pull request:

Issues
======
+ Solved 5
- Added 4
           

Complexity increasing per file
==============================
- src/PowerShellEditorServices/Services/TextDocument/Handlers/CodeActionHandler.cs  1
- src/PowerShellEditorServices/Services/TextDocument/Handlers/FoldingRangeHandler.cs  1
         

Clones removed
==============
+ src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs  -1
+ src/PowerShellEditorServices/Services/TextDocument/Handlers/HoverHandler.cs  -1
+ src/PowerShellEditorServices/Services/TextDocument/Handlers/DefinitionHandler.cs  -1
+ src/PowerShellEditorServices/Services/Workspace/Handlers/WorkspaceSymbolsHandler.cs  -1
+ src/PowerShellEditorServices/Services/TextDocument/Handlers/CompletionHandler.cs  -1
+ src/PowerShellEditorServices/Services/TextDocument/Handlers/FoldingRangeHandler.cs  -1
         

See the complete overview on Codacy

@@ -30,16 +30,22 @@ public FoldingRangeHandler(ILoggerFactory factory, ConfigurationService configur
_configurationService = configurationService;
_workspaceService = workspaceService;
}
public TextDocumentRegistrationOptions GetRegistrationOptions()

public FoldingRangeRegistrationOptions GetRegistrationOptions()
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -37,9 +38,17 @@ internal class DocumentFormattingHandlers : IDocumentFormattingHandler, IDocumen
_workspaceService = workspaceService;
}

public TextDocumentRegistrationOptions GetRegistrationOptions()
public DocumentFormattingRegistrationOptions GetRegistrationOptions()
Copy link
Member Author

Choose a reason for hiding this comment

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

};
}

DocumentRangeFormattingRegistrationOptions IRegistration<DocumentRangeFormattingRegistrationOptions>.GetRegistrationOptions()
Copy link
Member Author

Choose a reason for hiding this comment

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

_logger.LogInformation("highlight handler loaded");
}

public TextDocumentRegistrationOptions GetRegistrationOptions()
public DocumentHighlightRegistrationOptions GetRegistrationOptions()
Copy link
Member Author

Choose a reason for hiding this comment

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

@TylerLeonhardt
Copy link
Member Author

apparently prereleases are also signed so we can go with this.

@TylerLeonhardt TylerLeonhardt marked this pull request as ready for review March 26, 2020 18:59
@TylerLeonhardt TylerLeonhardt merged commit 41bf246 into PowerShell:master Mar 26, 2020
@TylerLeonhardt TylerLeonhardt deleted the add-some-cancellation branch March 26, 2020 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants