Skip to content

Add Name as tooltip when tab completing process ID - #3664

Merged
Dongbo Wang (daxian-dbw) merged 4 commits into
PowerShell:masterfrom
powercode:process-completion
May 6, 2017
Merged

Add Name as tooltip when tab completing process ID#3664
Dongbo Wang (daxian-dbw) merged 4 commits into
PowerShell:masterfrom
powercode:process-completion

Conversation

@powercode

Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@powercode

Copy link
Copy Markdown
Collaborator Author

The failure seems unrelated to my checkin

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Collaborator Author

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

@powercode Staffan Gustafsson (powercode) Apr 30, 2017

Copy link
Copy Markdown
Collaborator Author

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?

@powercode

Copy link
Copy Markdown
Collaborator Author

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

Copy link
Copy Markdown
Member

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>".

Copy link
Copy Markdown
Collaborator Author

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+ - '

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'^\d+ - ' looks good :)

@rkeithhill

Copy link
Copy Markdown
Collaborator

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.

@daxian-dbw

Copy link
Copy Markdown
Member

Staffan Gustafsson (@powercode) can you please update the test with '^\d+ - '? Otherwise, the changes look good to me.
Keith Hill (@rkeithhill) do you have any concerns on the changes?

Copy link
Copy Markdown
Member

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+ - '

Copy link
Copy Markdown
Collaborator Author

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

@powercode

Copy link
Copy Markdown
Collaborator Author

pushed a rebased version

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 8d744f2 into PowerShell:master May 6, 2017
@powercode
Staffan Gustafsson (powercode) deleted the process-completion branch January 26, 2018 19:04
@TravisEz13 Travis Plunk (TravisEz13) added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Review - Waiting on Author labels May 27, 2020
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants