-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Script side implementation for Brace Completion. #7587
Conversation
This needs updated Visual Studio components to work.
@@ -1844,6 +1844,31 @@ namespace FourSlash { | |||
}); | |||
} | |||
|
|||
public verifyBraceCompletionAtPostion(negative: boolean, openingBrace: string) { | |||
|
|||
let charCode = 0x28; // '(' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ts.CharacterCodes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just make perform the assignment in the switch to make it more uniform
case '"': charCode = ts.CharacterCodes.doubleQuote; break; | ||
case "`": charCode = ts.CharacterCodes.backtick; break; | ||
case "<": charCode = ts.CharacterCodes.lessThan; break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a Map<CharacterCodes>
and writing
const openBraceMap: Map<CharacterCodes> = {
"{": CharacterCodes.openBrace,
// etc.
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should error when the test-writer accidentally gave the wrong input.
@@ -1844,6 +1844,37 @@ namespace FourSlash { | |||
}); | |||
} | |||
|
|||
public verifyBraceCompletionAtPostion(negative: boolean, openingBrace: string) { | |||
|
|||
const openBraceMap: ts.Map<ts.CharacterCodes> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For every call you're going to be creating this, so make this a static property
There is some very bizarre handling here, but I am giving this a 👍 because users can always turn this setting off. Can you open an infrastructure bug on what we've found here? |
This needs updated Visual Studio components to work.
Fixes #1484