@@ -1760,6 +1760,28 @@ namespace ts.projectSystem {
17601760 checkProjectActualFiles ( projectService . externalProjects [ 0 ] , [ file1 . path , file2 . path , file3 . path ] ) ;
17611761 } ) ;
17621762
1763+ it ( "regression test for crash in acquireOrUpdateDocument" , ( ) => {
1764+ const tsFile = {
1765+ fileName : "/a/b/file1.ts" ,
1766+ path : "/a/b/file1.ts" ,
1767+ content : ""
1768+ } ;
1769+ const jsFile = {
1770+ path : "/a/b/file1.js" ,
1771+ content : "var x = 10;" ,
1772+ fileName : "/a/b/file1.js" ,
1773+ scriptKind : "JS" as "JS"
1774+ } ;
1775+
1776+ const host = createServerHost ( [ ] ) ;
1777+ const projectService = createProjectService ( host ) ;
1778+ projectService . applyChangesInOpenFiles ( [ tsFile ] , [ ] , [ ] ) ;
1779+ const projs = projectService . synchronizeProjectList ( [ ] ) ;
1780+ projectService . findProject ( projs [ 0 ] . info . projectName ) . getLanguageService ( ) . getNavigationBarItems ( tsFile . fileName ) ;
1781+ projectService . synchronizeProjectList ( [ projs [ 0 ] . info ] ) ;
1782+ projectService . applyChangesInOpenFiles ( [ jsFile ] , [ ] , [ ] ) ;
1783+ } ) ;
1784+
17631785 it ( "config file is deleted" , ( ) => {
17641786 const file1 = {
17651787 path : "/a/b/f1.ts" ,
@@ -1860,7 +1882,7 @@ namespace ts.projectSystem {
18601882
18611883 // Open HTML file
18621884 projectService . applyChangesInOpenFiles (
1863- /*openFiles*/ [ { fileName : file2 . path , hasMixedContent : true , scriptKind : ScriptKind . JS , content : `var hello = "hello";` } ] ,
1885+ /*openFiles*/ [ { fileName : file2 . path , hasMixedContent : true , scriptKind : ScriptKind . JS , content : `var hello = "hello";` } ] ,
18641886 /*changedFiles*/ undefined ,
18651887 /*closedFiles*/ undefined ) ;
18661888
@@ -1877,7 +1899,7 @@ namespace ts.projectSystem {
18771899 projectService . applyChangesInOpenFiles (
18781900 /*openFiles*/ undefined ,
18791901 /*changedFiles*/ undefined ,
1880- /*closedFiles*/ [ file2 . path ] ) ;
1902+ /*closedFiles*/ [ file2 . path ] ) ;
18811903
18821904 // HTML file is still included in project
18831905 checkNumberOfProjects ( projectService , { configuredProjects : 1 } ) ;
@@ -3308,7 +3330,7 @@ namespace ts.projectSystem {
33083330 const error1Result = < protocol . Diagnostic [ ] > session . executeCommand ( dTsFile1GetErrRequest ) . response ;
33093331 assert . isTrue ( error1Result . length === 0 ) ;
33103332
3311- const dTsFile2GetErrRequest = makeSessionRequest < protocol . SemanticDiagnosticsSyncRequestArgs > (
3333+ const dTsFile2GetErrRequest = makeSessionRequest < protocol . SemanticDiagnosticsSyncRequestArgs > (
33123334 CommandNames . SemanticDiagnosticsSync ,
33133335 { file : dTsFile2 . path }
33143336 ) ;
0 commit comments