ensure that autoformat is triggered by token characters
This commit is contained in:
parent
bbbec22917
commit
889264f457
|
@ -120,7 +120,9 @@ module ts.formatting {
|
|||
|
||||
function findOutermostParent(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node {
|
||||
var precedingToken = findPrecedingToken(position, sourceFile);
|
||||
if (!precedingToken || precedingToken.kind !== expectedTokenKind) {
|
||||
if (!precedingToken ||
|
||||
precedingToken.kind !== expectedTokenKind ||
|
||||
position !== precedingToken.getEnd()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
13
tests/cases/fourslash/formattingInComment.ts
Normal file
13
tests/cases/fourslash/formattingInComment.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
////class A {
|
||||
////foo( ); // /*1*/
|
||||
////}
|
||||
////function foo() { var x; } // /*2*/
|
||||
|
||||
goTo.marker("1");
|
||||
edit.insert(";");
|
||||
verify.currentLineContentIs("foo( ); // ;")
|
||||
|
||||
goTo.marker("2");
|
||||
edit.insert("}");
|
||||
verify.currentLineContentIs("function foo() { var x; } // }");
|
Loading…
Reference in a new issue