Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ namespace ts {
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);

// Check if in a context where we don't want to perform any insertion
if (isInString(sourceFile, position) || isInComment(sourceFile, position)) {
if (isInString(sourceFile, position)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should only be the case for { not for all braces. IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't work for <>. But why should it exclude () and []?

Copy link
Contributor

Choose a reason for hiding this comment

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

What does C# do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

c# does no completions for any type of braces inside comments..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

c# is smart, otherwise too outside comments, it only completes when brackets are placed in an expected location

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, Don't have a strong opinion either way..

return false;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/cases/fourslash/commentBraceCompletionPosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
//// }

goTo.marker('1');
verify.not.isValidBraceCompletionAtPosition('(');
verify.isValidBraceCompletionAtPosition('(');

goTo.marker('2');
verify.not.isValidBraceCompletionAtPosition('(');
verify.isValidBraceCompletionAtPosition('(');

goTo.marker('3');
verify.not.isValidBraceCompletionAtPosition('(');
verify.isValidBraceCompletionAtPosition('(');