Skip to content
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

Revisit PSCustomObject Accelerator Intellisense Formatting #70786

Closed
mpearon opened this issue Mar 20, 2019 · 16 comments
Closed

Revisit PSCustomObject Accelerator Intellisense Formatting #70786

mpearon opened this issue Mar 20, 2019 · 16 comments
Assignees
Labels
*as-designed Described behavior is as designed snippets
Milestone

Comments

@mpearon
Copy link

mpearon commented Mar 20, 2019

REFERENCE: PowerShell/vscode-powershell#1595 #62744

Details Output

VSCode version: 1.32.3 | a3db5be | x64

VSCode extensions:

WakaTime.vscode-wakatime
aaron-bond.better-comments
alexcvzz.vscode-sqlite
Compulim.vscode-clock
DotJoshJohnson.xml
eamodio.gitlens
fabiospampinato.vscode-github-notifications-bell
formulahendry.vscode-mysql
GrapeCity.gc-excelviewer
hoovercj.vscode-power-mode
idleberg.applescript
johnstoncode.svn-scm
Kelvin.vscode-sshfs
le0zh.vscode-regexp-preivew
mkloubert.vscode-remote-workspace
ms-mssql.mssql
ms-vscode.PowerShell
ms-vscode.PowerShell-Preview
ms-vsliveshare.vsliveshare
ms-vsliveshare.vsliveshare-audio
nonoroazoro.syncing
rafaelmaiolla.remote-vscode
shyykoserhiy.git-autoconfig
softwaredotcom.swdc-vscode
yzhang.markdown-all-in-one

PSES version:

PowerShell version:

Name                           Value
----                           -----
PSVersion                      6.1.3
PSEdition                      Core
GitCommitId                    6.1.3
OS                             Darwin 18.2.0 Darwin Kernel Version 18.2.0: Th...
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

When using the [PSCustomObject] Accelerator, the initial [ is not removed.

Expected Behavior

I think that the if an initial [ is detected, it should be removed.

Actual Behavior

The [ is duplicated when using Tab and when selecting the autocomplete option.
I've seen that if I type PSCustomObject, then hit tab or select the option, the bracket is not added - but I naturally begin typing the actual expression. Maybe I'm being a bit too picky.

Attached Files

@isidorn isidorn added the *caused-by-extension Issue identified to be caused by an extension label Mar 20, 2019
@vscodebot
Copy link

vscodebot bot commented Mar 20, 2019

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@TylerLeonhardt
Copy link
Member

Hi 👋 this probably shouldn't have been closed. Can some one help with this?

@TylerLeonhardt
Copy link
Member

@sbatten or @Tyriar this might not be your area... But could one of you help point us to the right folks?

@Tyriar Tyriar added snippets and removed *caused-by-extension Issue identified to be caused by an extension labels Mar 30, 2019
@Tyriar
Copy link
Member

Tyriar commented Mar 30, 2019

I think it's a snippet issue?

@Tyriar Tyriar reopened this Mar 30, 2019
@jrieken jrieken added the bug Issue identified by VS Code Team member as probable bug label Apr 1, 2019
@jrieken jrieken added this to the April 2019 milestone Apr 1, 2019
@jrieken jrieken added *as-designed Described behavior is as designed and removed bug Issue identified by VS Code Team member as probable bug labels Apr 2, 2019
@vscodebot
Copy link

vscodebot bot commented Apr 2, 2019

The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Apr 2, 2019
@jrieken
Copy link
Member

jrieken commented Apr 2, 2019

This is actually not an issue with snippets because the snippet-prefix defines what portion gets detected and hence replaced. As shown in PowerShell/vscode-powershell#1595 (comment) that is PSCustomObject and not [PSCustomObject

@TylerLeonhardt
Copy link
Member

@jrieken there are 2 problems here still...

It's set to PSCustomObject because that's the name of the snippet. If I set it to [PSCustomObject then [PSCustomObject is what shows in the dialog:

image

Instead of showing the actual name of the snippet.

Also, if I type [, vscode naturally adds the ] to the other end, but then when I use my snippet, the ] still is there:

image

This is a tougher problem... I know, but I want to call it out as an experience that customers will likely hit.

@mpearon
Copy link
Author

mpearon commented Apr 20, 2019

Where did this responsibility land?

@TylerLeonhardt
Copy link
Member

Ping @jrieken.

@TylerLeonhardt
Copy link
Member

Another gentle ping, @jrieken

@sba923
Copy link

sba923 commented May 13, 2019

I'd really like this behavior to be improved... who owns this?

@TylerLeonhardt
Copy link
Member

This, I believe, falls on the vscode team because the biggest problem is that auto-closing pairs and snippets are conflicting with each other for a subpar experience.

@jrieken is the guy to talk to about this, but he hadn't gotten back to us.

@jrieken
Copy link
Member

jrieken commented May 13, 2019

@TylerLeonhardt I actually stopped reading after this

@jrieken there are 2 problems here still...

The rule is 1 problem, 1 issue

@TylerLeonhardt
Copy link
Member

Sounds good @jrieken that is a respectable policy. Would you prefer I open two new issues?

For context:

Issue one using Python as the example language snippet:

{
    "listcompPy": {
        "prefix":"x for x in",
        "body":[
            "[x for x in range(1,20) if x%2==0 ]"
        ]
    }
}

typing [x results in extra brackets:

[[x for x in range(1,20) if x%2==0 ]]

Issue two using your suggestion of adding [ to the prefix:

{
    "listcompPy": {
        "prefix":"[x for x in",
        "body":[
            "[x for x in range(1,20) if x%2==0 ]"
        ]
    }
}

typing [x results in a single extra bracket at the end:

[x for x in range(1,20) if x%2==0 ]]

@jrieken
Copy link
Member

jrieken commented May 16, 2019

Would you prefer I open two new issues?

Well, one exits #26012 and other is the acknowledgement of the limitations of static snippets. Details:

Issue two using your suggestion of adding [ to the prefix:

I wasn't suggesting that your snippet-prefix is [x but I was explaining that the prefix is what's being overwritten. That's all snippets can do, for dynamic stuff a completion provider should be used.

Suggestion: knowing that vscode auto closes brackets by default you could adjust your snippet to not insert brackets as well...

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented May 18, 2019

Suggestion: knowing that vscode auto closes brackets by default you could adjust your snippet to not insert brackets as well...

This is a reasonable suggestion if the brackets come at the start and end of the snippet, but that's not always the case.

For example the snippet that this issue was originally opened for is:

[PSCustomObject]@{
      
}

for dynamic stuff a completion provider should be used.

I'll investigate this as a workaround but that said, #26012 would certainly fix this issue. Snippets and auto-closing pairs playing nicer together is ideal.

@mpearon + @sba923: #26012 is the language agnostic issue that we should put examples into and use for further tracking.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed snippets
Projects
None yet
Development

No branches or pull requests

6 participants