Skip to content

Command and argument completions should cycle when Tab is pressed #25

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

Closed
Satak opened this issue Nov 24, 2015 · 24 comments
Closed

Command and argument completions should cycle when Tab is pressed #25

Satak opened this issue Nov 24, 2015 · 24 comments
Labels
Area-IntelliSense Issue-Enhancement A feature request (enhancement).

Comments

@Satak
Copy link

Satak commented Nov 24, 2015

Tab completion doesn't work for anything (enum, validate set, parameters). It should work like in ISE so you could tab complete your enum sets and validate sets as arguments, parameters for functions and commands.

@daviwil
Copy link
Contributor

daviwil commented Nov 24, 2015

It should work for any of these things because we're using the same PowerShell APIs to get the completion lists. Are you getting IntelliSense suggestions for cmdlets that you're typing? Can you give me a specific example that I can try? What version of Windows and PowerShell are you using?

@Satak
Copy link
Author

Satak commented Nov 24, 2015

Make a function with parameter set in parameter
function Get-Item
{
Param(
[ValidateSet('one','two')]
[string]$arg
)
return $arg
}

Get-Item -arg <here if you try to tab it doesn't cycle through the validate set 'one' 'two' it just makes tab space >

@daviwil
Copy link
Contributor

daviwil commented Nov 24, 2015

This currently works in VS Code with the PowerShell extension installed, you just have to hit Ctrl+Space or start typing one of the values to get the completion:

image

Does that work for you if you try it?

If the request is that the completion suggestions should immediately pop up without any keypress other than 'space', we can file that request against the VS Code team.

@Satak
Copy link
Author

Satak commented Nov 24, 2015

Here is a video how much worse the tab completion is compared to ISE:
https://youtu.be/TPNLdsMg3j4

Ctrl + Space works but then it opens that menu and you have to use arrow up and down on the list, you can't tab cycle through it.

@daviwil
Copy link
Contributor

daviwil commented Nov 24, 2015

Thanks, this video is helpful and demonstrates what you're looking for really well. I'll look into how this might be possible.

@daviwil daviwil added the Issue-Enhancement A feature request (enhancement). label Nov 24, 2015
@daviwil daviwil changed the title Tab completion doesn't work Command and argument completions should cycle when Tab is pressed Nov 24, 2015
@Satak
Copy link
Author

Satak commented Nov 24, 2015

There are also lot of problem when dealing with Classes. Static methods are not listed even with Ctrl + Space it shows nothing. Public methods are listed but when you select it, it clears your variable name. See the video: https://youtu.be/GbbemOOiDnQ

@daviwil
Copy link
Contributor

daviwil commented Nov 24, 2015

Yep, there are a couple issues around this already:

#12
PowerShell/PowerShellEditorServices#45

Can you post your example file in a Gist somewhere? It'd be useful for testing.

Thanks!

@pcgeek86
Copy link
Contributor

I was about to report this issue, but searched for "values" first, and came across this thread. I'm not seeing auto-completion for parameter values for the New-AzureRmStorageAccount -Type parameter.

image

In the PowerShell ISE, it would look like this:

image

@rkeithhill
Copy link
Contributor

Is the completion list correct if you remove @StorageAccount (or move it after -Type)? Just wondering if splatting is confusing auto-completion in this case.

@pcgeek86
Copy link
Contributor

@rkeithhill

I doubt it. It works alright in the ISE.

image

Still broken, even without Splatting.

image

Good thought though! Thanks

@rkeithhill
Copy link
Contributor

@pcgeek86 Thanks for that extra info.

@mpriem
Copy link

mpriem commented Jan 31, 2017

Would love to hear the latest on this one! Any chance of this getting addressed?

@pcgeek86
Copy link
Contributor

Closing, as this currently works. Please comment if there's something specific that isn't working, and we'll reopen it.

vscode-autocomplete-githubissue25

@daviwil
Copy link
Contributor

daviwil commented Jun 18, 2017

I think what Sami was asking for was the ISE's behavior of cycling through completions when you hit tab, like this:

012a64b3-8fa4-4d7f-bfa6-892494b9ed25

I think we can certainly provide that behavior, just haven't had time to look into it recently.

@daviwil daviwil added this to the July 2017 milestone Jun 18, 2017
@pcgeek86
Copy link
Contributor

Gotcha. I was looking at the original request, not the follow-on comments.

It looks like the original request was for any type of tab completion, which works for parameters, parameter values, functions, etc.

@pcgeek86 pcgeek86 reopened this Jun 18, 2017
@kapilmb
Copy link

kapilmb commented Jun 18, 2017

I think a very simple fix would be rebind selectNextSuggestion and selectPrevSuggestion actions to tab and shift+tab keys. This will not give a complete parity with the ISE behavior but the user will be able to tab through the suggestions instead of using the up/down arrow keys.

@daviwil
Copy link
Contributor

daviwil commented Jun 19, 2017

I think we could make the ISE-style completion work with a general rebind of Tab and a new request to the language server, should be fairly straightforward. I'll take a look at it next month sometime.

@aarontheadmin
Copy link

In relation to the original post, when you backspace a command, parameter, or argument, and try tab completion, it doesn't complete - just inserts a tab character, making you manually type it in. This happens in the script editor pane, whereas the Integrated Terminal does not have this problem.

@daviwil daviwil modified the milestones: July 2017, Future Oct 26, 2017
@TylerLeonhardt TylerLeonhardt modified the milestone: Future May 24, 2018
@TylerLeonhardt TylerLeonhardt modified the milestone: Future May 24, 2018
@0-0-1-0-1-0-1-0
Copy link

@daviwil Has there been any progress on this? It would be nice to have a setting to choose the type of tab completion you want, ISE style or current style.

I prefer the ISE style as it cycles cmdlets, variables, classes, argument lists etc...

@rjmholt
Copy link
Contributor

rjmholt commented Sep 13, 2018

@SeeminglyScience were you discussing this recently in Slack? Possibly with @Jaykul?

@SeeminglyScience
Copy link
Collaborator

Yeah, with @Jaykul and @0-0-1-0-1-0-1-0 actually.

My thoughts on this is that it shouldn't come from us. In order to implement this we would need to essentially rewrite all of the intellisense logic that VSCode already provides. That would be a rather hefty initial chunk of work, a entire new system to maintain, and would pretty drastically change the experience of using this extension vs other language extensions.

If it this change would come from somewhere, it should come from VSCode itself. That said, the ISE-style doesn't really make sense in an editor, and only really made sense at the time because it was trying to emulate the pre-PSReadLine console experience.

I do understand the frustration, and I went through the same thing when I switched over to VSCode. I'd personally recommend to those who are having issues to give the current system a try long enough for your muscle memory to switch. Once you get used to using CTRL+SPACE to bring up the list of completions, you may find that it's faster and a bit less strenuous on the fingers. PSReadLine has a similar option (even with tooltips in later versions!) also bound to CTRL+SPACE, so your muscle memory should translate in the console as well.

@rjmholt
Copy link
Contributor

rjmholt commented Sep 13, 2018

@0-0-1-0-1-0-1-0 given the fact that completion UX essentially happens at VSCode's layer, it might be worth opening an issue on VSCode itself. Building and maintaining a second completion stack would represent a pretty big resource drain for us

@MartinGC94
Copy link
Contributor

This feature was recently implemented as an option in VS code: "editor.tabCompletion": "on"
More details here: microsoft/vscode#28215 (comment) So I guess this issue can be closed now.

@rjmholt
Copy link
Contributor

rjmholt commented Oct 31, 2018

@MartinGC94 Thanks for that info -- really great news! Closing this issue -- if there are outstanding issues in the experience (i.e. there are missing functionalities) we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IntelliSense Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests