mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Skip missing nodes in formatting (#48953)
This commit is contained in:
@@ -691,6 +691,10 @@ namespace ts.formatting {
|
||||
isListItem: boolean,
|
||||
isFirstListItem?: boolean): number {
|
||||
|
||||
if (nodeIsMissing(child)) {
|
||||
return inheritedIndentation;
|
||||
}
|
||||
|
||||
const childStartPos = child.getStart(sourceFile);
|
||||
|
||||
const childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
||||
|
||||
7
tests/cases/fourslash/formatV8Directive.ts
Normal file
7
tests/cases/fourslash/formatV8Directive.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
// @Filename: foo.js
|
||||
//// function foo() {}
|
||||
//// /*1*/%PrepareFunctionForOptimization(foo)/*2*/;
|
||||
|
||||
// Don't really care what it does beyond not crashing
|
||||
format.selection("1", "2");
|
||||
Reference in New Issue
Block a user