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

add default values for snippet just like on intellij #3419

Open
tbm98 opened this issue Jun 19, 2021 · 6 comments
Open

add default values for snippet just like on intellij #3419

tbm98 opened this issue Jun 19, 2021 · 6 comments
Labels
blocked on vs code / lsp / dap Requires a change in VS Code to progress in editor Relates to code editing or language features is enhancement
Milestone

Comments

@tbm98
Copy link

tbm98 commented Jun 19, 2021

In IntelliJ I can choose the default value for my snippet. but on vscode I'm not sure if it's doable.
Screen Shot 2021-06-18 at 23 20 19

@tbm98
Copy link
Author

tbm98 commented Jun 19, 2021

I know some value provided by vscode. but I want to use the custom value from dart/flutter plugin like dartClassName

@DanTup
Copy link
Member

DanTup commented Jun 21, 2021

I'm not very familiar with this behaviour in IntelliJ - can you confirm exactly what the flow is? I can see $ClassName$ used in the template, but it's not clear to me when you invoke that snippet what dartClassName() would be replaced with? Where does the class name come from?

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Jun 21, 2021
@tbm98
Copy link
Author

tbm98 commented Jun 21, 2021

Screen.Recording.2021-06-21.at.21.37.03.mov

$ClassName$ it's just the name I give it. the magic is dartClassName() it is a function provided by dart/flutter plugin, it returns the current dart class name which contains this snippet.

Screen Shot 2021-06-21 at 21 45 04

@DanTup
Copy link
Member

DanTup commented Jul 19, 2021

Sorry for the delay in responding.

I think to support this with user-create snippets, it would require some additional support from VS Code to allow substituting these variables. Right now when you insert a snippet, VS Code handles everything so there is no opportunity for us to provide the values that would be inserted.

I've filed an issue with VS Code with a possible way this could be implemented, which you can 👍 or subscribe to here:

microsoft/vscode#129003

@DanTup DanTup added blocked on vs code / lsp / dap Requires a change in VS Code to progress in editor Relates to code editing or language features and removed awaiting info Requires more information from the customer to progress labels Jul 19, 2021
@DanTup DanTup added this to the Backlog milestone Jul 19, 2021
@tbm98
Copy link
Author

tbm98 commented Jul 20, 2021

Thank you!

@DanTup
Copy link
Member

DanTup commented Jul 20, 2021

My issue was a dupe, so the one to actually follow/ 👍 is microsoft/vscode#10561 (comment) :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked on vs code / lsp / dap Requires a change in VS Code to progress in editor Relates to code editing or language features is enhancement
Projects
None yet
Development

No branches or pull requests

2 participants