Skip to content

Script side implementation for Brace Completion.#7587

Merged
paulvanbrenk merged 6 commits into
masterfrom
braceCompletion
Apr 15, 2016
Merged

Script side implementation for Brace Completion.#7587
paulvanbrenk merged 6 commits into
masterfrom
braceCompletion

Conversation

@paulvanbrenk
Copy link
Copy Markdown
Contributor

This needs updated Visual Studio components to work.

Fixes #1484

This needs updated Visual Studio components to work.
Comment thread src/harness/fourslash.ts Outdated

public verifyBraceCompletionAtPostion(negative: boolean, openingBrace: string) {

let charCode = 0x28; // '('
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ts.CharacterCodes.

Copy link
Copy Markdown
Member

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

Comment thread src/harness/fourslash.ts
case '"': charCode = ts.CharacterCodes.doubleQuote; break;
case "`": charCode = ts.CharacterCodes.backtick; break;
case "<": charCode = ts.CharacterCodes.lessThan; break;
}
Copy link
Copy Markdown
Member

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.
}

Copy link
Copy Markdown
Member

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.

Comment thread src/harness/fourslash.ts

public verifyBraceCompletionAtPostion(negative: boolean, openingBrace: string) {

const openBraceMap: ts.Map<ts.CharacterCodes> = {
Copy link
Copy Markdown
Member

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

@DanielRosenwasser
Copy link
Copy Markdown
Member

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?

@paulvanbrenk paulvanbrenk merged commit 96deb55 into master Apr 15, 2016
@paulvanbrenk paulvanbrenk deleted the braceCompletion branch April 15, 2016 18:38
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants