-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add Name as tooltip when tab completing process ID #3664
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
Conversation
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.
b10bb4a
to
c9edd3a
Compare
The failure seems unrelated to my checkin |
0d05b36
to
118b0ab
Compare
@@ -3205,8 +3205,10 @@ private static void NativeCompletionProcessCommands(string wordToComplete, strin | |||
if (pattern.IsMatch(completionText)) | |||
{ | |||
var listItemText = completionText; |
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 always thought the user experience wasn't quite right with this completion.
I wonder if it would be better to use listItemText
instead of tooltip
to show the process name and the process id.
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 guess you are right, since it is harder to see the tooltip
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.
There is some weird case here where I have a null/empty process name on macOS. Is that expected or a bug somewhere in the process code?
118b0ab
to
8c02c06
Compare
New version with listtext and tooltip "{id} - {name}" |
$cmd = 'Get-Process -Id ' | ||
$res = TabExpansion2 -inputScript $cmd -cursorColumn $cmd.Length | ||
$res.CompletionMatches[0].CompletionText -match '^\d+$' | Should be true | ||
$res.CompletionMatches[0].ToolTip -match '^\w' | Should be true |
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.
\w stands for "word character", usually [A-Za-z0-9_]
So ToolTip -match '^\w'
doesn't guarantee it's in our expected form "<digits - string>".
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.
We don't know that we get the name string. Some tests on mac fail with null (or maybe empty) string. But maybe we could have '^\d+ - '
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.
'^\d+ - '
looks good :)
Keep in mind that the PowerShell extension for VSCode uses the TooltipText for the detail text in IntelliSense. ListItemCompletion is used for sorting and the Label. |
@powercode can you please update the test with |
0220380
to
997e567
Compare
It 'Should complete "Get-Process -Id " with Id and name in tooltip' { | ||
$cmd = 'Get-Process -Id ' | ||
$res = TabExpansion2 -inputScript $cmd -cursorColumn $cmd.Length | ||
$res.CompletionMatches[0].CompletionText -match '^\d+ - ' | Should be true |
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.
You changed the wrong one. It's the ToolTip
test below that you should change the pattern to ^\d+ - '
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.
Shouldn't do this in the middle of the night :) Fixing
997e567
to
3f64b47
Compare
pushed a rebased version |
No description provided.