Skip to content

Commit 0b41303

Browse files
committed
Ensure scriptsnapshot is set when creating a source file
1 parent 551a532 commit 0b41303

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/services/services.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,10 @@ module ts {
416416
? TypeScript.Parser.parse(this.filename, text, this.languageVersion, TypeScript.isDTSFile(this.filename))
417417
: TypeScript.IncrementalParser.parse(oldSyntaxTree, textChangeRange, text);
418418

419-
return SourceFileObject.createSourceFileObject(this.languageVersion, this.filename, scriptSnapshot, version, isOpen, newSyntaxTree);
419+
return SourceFileObject.createSourceFileObject(this.filename, scriptSnapshot, this.languageVersion, version, isOpen, newSyntaxTree);
420420
}
421421

422-
public static createSourceFileObject(languageVersion: ScriptTarget, filename: string, scriptSnapshot: TypeScript.IScriptSnapshot, version: number, isOpen: boolean, syntaxTree: TypeScript.SyntaxTree) {
422+
public static createSourceFileObject(filename: string, scriptSnapshot: TypeScript.IScriptSnapshot, languageVersion: ScriptTarget, version: number, isOpen: boolean, syntaxTree?: TypeScript.SyntaxTree) {
423423
var newSourceFile = <SourceFileObject><any>createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), languageVersion, version, isOpen);
424424
newSourceFile.scriptSnapshot = scriptSnapshot;
425425
newSourceFile.syntaxTree = syntaxTree;
@@ -1134,7 +1134,7 @@ module ts {
11341134
}
11351135

11361136
function createSourceFileFromScriptSnapshot(filename: string, scriptSnapshot: TypeScript.IScriptSnapshot, settings: CompilerOptions, version: number, isOpen: boolean) {
1137-
return createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), settings.target, version, isOpen);
1137+
return SourceFileObject.createSourceFileObject(filename, scriptSnapshot, settings.target, version, isOpen);
11381138
}
11391139

11401140
export function createDocumentRegistry(): DocumentRegistry {

0 commit comments

Comments
 (0)