-
Notifications
You must be signed in to change notification settings - Fork 237
Signaturehelp cancellation and some caching #1251
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
bf46f94
19fca4c
c430554
45d9e08
bdcfcdc
ff09fe0
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 |
---|---|---|
|
@@ -20,7 +20,6 @@ namespace Microsoft.PowerShell.EditorServices.Handlers | |
{ | ||
internal class SignatureHelpHandler : ISignatureHelpHandler | ||
{ | ||
private static readonly SignatureInformation[] s_emptySignatureResult = Array.Empty<SignatureInformation>(); | ||
private readonly ILogger _logger; | ||
private readonly SymbolsService _symbolsService; | ||
private readonly WorkspaceService _workspaceService; | ||
|
@@ -52,6 +51,12 @@ public SignatureHelpRegistrationOptions GetRegistrationOptions() | |
|
||
public async Task<SignatureHelp> Handle(SignatureHelpParams request, CancellationToken cancellationToken) | ||
{ | ||
if (cancellationToken.IsCancellationRequested) | ||
{ | ||
_logger.LogDebug("SignatureHelp request canceled for file: {0}", request.TextDocument.Uri); | ||
return new SignatureHelp(); | ||
} | ||
|
||
ScriptFile scriptFile = _workspaceService.GetFile(request.TextDocument.Uri); | ||
|
||
ParameterSetSignatures parameterSets = | ||
|
@@ -61,28 +66,28 @@ await _symbolsService.FindParameterSetsInFileAsync( | |
(int) request.Position.Character + 1, | ||
_powerShellContextService).ConfigureAwait(false); | ||
|
||
SignatureInformation[] signatures = s_emptySignatureResult; | ||
if (parameterSets == null) | ||
{ | ||
return new SignatureHelp(); | ||
} | ||
|
||
if (parameterSets != null) | ||
SignatureInformation[] signatures = new SignatureInformation[parameterSets.Signatures.Length]; | ||
for (int i = 0; i < signatures.Length; i++) | ||
{ | ||
signatures = new SignatureInformation[parameterSets.Signatures.Length]; | ||
for (int i = 0; i < signatures.Length; i++) | ||
var parameters = new ParameterInformation[parameterSets.Signatures[i].Parameters.Count()]; | ||
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. Do we know why If it's 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. Not really sure what the best estimate could be here... so I'll just leave it empty. 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. Added! |
||
int j = 0; | ||
foreach (ParameterInfo param in parameterSets.Signatures[i].Parameters) | ||
{ | ||
var parameters = new ParameterInformation[parameterSets.Signatures[i].Parameters.Count()]; | ||
int j = 0; | ||
foreach (ParameterInfo param in parameterSets.Signatures[i].Parameters) | ||
{ | ||
parameters[j] = CreateParameterInfo(param); | ||
j++; | ||
} | ||
|
||
signatures[i] = new SignatureInformation | ||
{ | ||
Label = parameterSets.CommandName + " " + parameterSets.Signatures[i].SignatureText, | ||
Documentation = null, | ||
Parameters = parameters, | ||
}; | ||
parameters[j] = CreateParameterInfo(param); | ||
j++; | ||
} | ||
|
||
signatures[i] = new SignatureInformation | ||
{ | ||
Label = parameterSets.CommandName + " " + parameterSets.Signatures[i].SignatureText, | ||
Documentation = null, | ||
Parameters = parameters, | ||
}; | ||
} | ||
|
||
return new SignatureHelp | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the comment on line 62, shouldn't
PowerShellGet
be in this list?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nevermind, this is the noun list, duh. Not the package name list.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said, I see more nouns from
PowerShellGet
2.2.3 than appear in the list above.gcm -m PowerShellGet | % Noun | % Sort -uniq
Is that a problem? For instance, there is aFind-Command
function in PowerShellGet.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I just renamed the variable. We should have a better check for verb-noun when PSGet uses the same noun as an inbox module
Module
as an example.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a s_cmdletExclusionList now which will handle that ^