@@ -1415,44 +1415,42 @@ module FourSlash {
14151415 }
14161416
14171417 private checkPostEditInvariants ( ) {
1418- return ;
1419-
1420- /// TODO: reimplement this section
1421- //if (this.editValidation === IncrementalEditValidation.None) {
1422- // return;
1423- //}
1424-
1425- //// Get syntactic errors (to force a refresh)
1426- //var incrSyntaxErrs = JSON.stringify(this.languageService.getSyntacticDiagnostics(this.activeFile.fileName));
1427-
1428- //// Check syntactic structure
1429- //var snapshot = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName);
1430- //var content = snapshot.getText(0, snapshot.getLength());
1431- //var refSyntaxTree = TypeScript.Parser.parse(this.activeFile.fileName, TypeScript.SimpleText.fromString(content), ts.ScriptTarget.ES5, TypeScript.isDTSFile(this.activeFile.fileName));
1432- //var fullSyntaxErrs = JSON.stringify(refSyntaxTree.diagnostics());
1433-
1434- //if (incrSyntaxErrs !== fullSyntaxErrs) {
1435- // this.raiseError('Mismatched incremental/full syntactic errors for file ' + this.activeFile.fileName + '.\n=== Incremental errors ===\n' + incrSyntaxErrs + '\n=== Full Errors ===\n' + fullSyntaxErrs);
1436- //}
1437-
1438- // if (this.editValidation !== IncrementalEditValidation.SyntacticOnly) {
1439- // var compiler = new TypeScript.TypeScriptCompiler();
1440- // for (var i = 0; i < this.testData.files.length; i++) {
1441- // snapshot = this.languageServiceShimHost.getScriptSnapshot(this.testData.files[i].fileName);
1442- // compiler.addFile(this.testData.files[i].fileName, TypeScript.ScriptSnapshot.fromString(snapshot.getText(0, snapshot.getLength())), ts.ByteOrderMark.None, 0, true);
1443- // }
1444-
1445- // compiler.addFile('lib.d.ts', TypeScript.ScriptSnapshot.fromString(Harness.Compiler.libTextMinimal), ts.ByteOrderMark.None, 0, true);
1446-
1447- // for (var i = 0; i < this.testData.files.length; i++) {
1448- // var refSemanticErrs = JSON.stringify(compiler.getSemanticDiagnostics(this.testData.files[i].fileName));
1449- // var incrSemanticErrs = JSON.stringify(this.languageService.getSemanticDiagnostics(this.testData.files[i].fileName));
1450-
1451- // if (incrSemanticErrs !== refSemanticErrs) {
1452- // this.raiseError('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs);
1453- // }
1454- // }
1455- // }
1418+ if ( this . editValidation === IncrementalEditValidation . None ) {
1419+ return ;
1420+ }
1421+
1422+ // Get syntactic errors (to force a refresh)
1423+ var incrSyntaxErrs = JSON . stringify ( Utils . convertDiagnostics ( this . languageService . getSyntacticDiagnostics ( this . activeFile . fileName ) ) ) ;
1424+
1425+ // Check syntactic structure
1426+ var snapshot = this . languageServiceShimHost . getScriptSnapshot ( this . activeFile . fileName ) ;
1427+ var content = snapshot . getText ( 0 , snapshot . getLength ( ) ) ;
1428+ var refSyntaxTree = ts . createLanguageServiceSourceFile (
1429+ this . activeFile . fileName , createScriptSnapShot ( content ) , ts . ScriptTarget . Latest , /*version:*/ "0" , /*isOpen:*/ false , /*setNodeParents:*/ false ) ;
1430+ var fullSyntaxErrs = JSON . stringify ( Utils . convertDiagnostics ( refSyntaxTree . getSyntacticDiagnostics ( ) ) ) ;
1431+
1432+ if ( incrSyntaxErrs !== fullSyntaxErrs ) {
1433+ this . raiseError ( 'Mismatched incremental/full syntactic errors for file ' + this . activeFile . fileName + '.\n=== Incremental errors ===\n' + incrSyntaxErrs + '\n=== Full Errors ===\n' + fullSyntaxErrs ) ;
1434+ }
1435+
1436+ //if (this.editValidation !== IncrementalEditValidation.SyntacticOnly) {
1437+ // var compiler = new TypeScript.TypeScriptCompiler();
1438+ // for (var i = 0; i < this.testData.files.length; i++) {
1439+ // snapshot = this.languageServiceShimHost.getScriptSnapshot(this.testData.files[i].fileName);
1440+ // compiler.addFile(this.testData.files[i].fileName, TypeScript.ScriptSnapshot.fromString(snapshot.getText(0, snapshot.getLength())), ts.ByteOrderMark.None, 0, true);
1441+ // }
1442+
1443+ // compiler.addFile('lib.d.ts', TypeScript.ScriptSnapshot.fromString(Harness.Compiler.libTextMinimal), ts.ByteOrderMark.None, 0, true);
1444+
1445+ // for (var i = 0; i < this.testData.files.length; i++) {
1446+ // var refSemanticErrs = JSON.stringify(compiler.getSemanticDiagnostics(this.testData.files[i].fileName));
1447+ // var incrSemanticErrs = JSON.stringify(this.languageService.getSemanticDiagnostics(this.testData.files[i].fileName));
1448+
1449+ // if (incrSemanticErrs !== refSemanticErrs) {
1450+ // this.raiseError('Mismatched incremental/full semantic errors for file ' + this.testData.files[i].fileName + '\n=== Incremental errors ===\n' + incrSemanticErrs + '\n=== Full Errors ===\n' + refSemanticErrs);
1451+ // }
1452+ // }
1453+ //}
14561454 }
14571455
14581456 private fixCaretPosition ( ) {
0 commit comments