Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Change snippet in class member completions#46593

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
gabritto wants to merge1 commit intomainfromgabritto/snippetorder

Conversation

gabritto
Copy link
Member

Partiallyfixes#46568.

Whenever completions offer a method snippet, the parameter names and types, and the return type are snippet placeholders, as described in#46370. And, if the method has a body, there is a tabstop in the empty body.

We are assuming that, in most cases, the person using the method snippet won't want to change the method signature, and will instead just want to fill in the body with the implementation of the method.
For that reason, the tabstop in the body is thefirst one, so when the method snippet is inserted, the cursor is in the body, like so:

classBarimplementsFoo{bar(a:string,b:number,c:string,d:number,e:string):void{|// cursor starts here}}

This PR adds a second tabstop, namely$0, right next to the first tabstop, in the body of the method.$0 is special, in that it is the last tabstop. This means that the following flow is possible:

classBarimplementsFoo{bar(a:string,b:number,c:string,d:number,e:string):void{|// cursor starts here}}

after pressing tab a few times, navigating through the method signature:

classBarimplementsFoo{bar(a:string,b:number,c:string|,d:number,e:string):void{}}

after pressing tab one last time, after going through (and possibly editing) the parameters and return type:

classBarimplementsFoo{bar(a:string,b:number,c:|string,d:number,e:string):void{|// cursor ends here}}

@typescript-bottypescript-bot added Author: Team For Milestone BugPRs that fix a bug with a specific milestone labelsOct 29, 2021
@andrewbranch
Copy link
Member

Looks good—have you tested in VS Code to make sure it works like we expect?

Related:#46588

@gabrittogabritto changed the titleChange snippetChange snippet in class member completionsOct 29, 2021
@gabritto
Copy link
MemberAuthor

Looks good—have you tested in VS Code to make sure it works like we expect?

Related:#46588

Yes, I tested it locally. To test this in VSCode, I had to change the code incompletions that checks forpreferences.includeCompletionsWithClassMemberSnippets to no longer check that.

@andrewbranch
Copy link
Member

Use Insiders 😉

gabritto reacted with eyes emoji

@gabritto
Copy link
MemberAuthor

I guess we can wait until after the 4.5 RC and discuss this and other alternatives in the editor meeting?

@gabritto
Copy link
MemberAuthor

gabritto commentedOct 29, 2021
edited
Loading

It seems we won't need this anymore:#46588

@gabrittogabritto deleted the gabritto/snippetorder branchMarch 2, 2024 01:45
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@andrewbranchandrewbranchandrewbranch approved these changes

Assignees

@gabrittogabritto

Labels
Author: TeamFor Milestone BugPRs that fix a bug with a specific milestone
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Method snippet follow-up
3 participants
@gabritto@andrewbranch@typescript-bot

[8]ページ先頭

©2009-2025 Movatter.jp