@@ -1774,6 +1774,28 @@ namespace ts.projectSystem {
1774
1774
checkProjectActualFiles ( projectService . externalProjects [ 0 ] , [ file1 . path , file2 . path , file3 . path ] ) ;
1775
1775
} ) ;
1776
1776
1777
+ it ( "regression test for crash in acquireOrUpdateDocument" , ( ) => {
1778
+ const tsFile = {
1779
+ fileName : "/a/b/file1.ts" ,
1780
+ path : "/a/b/file1.ts" ,
1781
+ content : ""
1782
+ } ;
1783
+ const jsFile = {
1784
+ path : "/a/b/file1.js" ,
1785
+ content : "var x = 10;" ,
1786
+ fileName : "/a/b/file1.js" ,
1787
+ scriptKind : "JS" as "JS"
1788
+ } ;
1789
+
1790
+ const host = createServerHost ( [ ] ) ;
1791
+ const projectService = createProjectService ( host ) ;
1792
+ projectService . applyChangesInOpenFiles ( [ tsFile ] , [ ] , [ ] ) ;
1793
+ const projs = projectService . synchronizeProjectList ( [ ] ) ;
1794
+ projectService . findProject ( projs [ 0 ] . info . projectName ) . getLanguageService ( ) . getNavigationBarItems ( tsFile . fileName ) ;
1795
+ projectService . synchronizeProjectList ( [ projs [ 0 ] . info ] ) ;
1796
+ projectService . applyChangesInOpenFiles ( [ jsFile ] , [ ] , [ ] ) ;
1797
+ } ) ;
1798
+
1777
1799
it ( "config file is deleted" , ( ) => {
1778
1800
const file1 = {
1779
1801
path : "/a/b/f1.ts" ,
@@ -1874,7 +1896,7 @@ namespace ts.projectSystem {
1874
1896
1875
1897
// Open HTML file
1876
1898
projectService . applyChangesInOpenFiles (
1877
- /*openFiles*/ [ { fileName : file2 . path , hasMixedContent : true , scriptKind : ScriptKind . JS , content : `var hello = "hello";` } ] ,
1899
+ /*openFiles*/ [ { fileName : file2 . path , hasMixedContent : true , scriptKind : ScriptKind . JS , content : `var hello = "hello";` } ] ,
1878
1900
/*changedFiles*/ undefined ,
1879
1901
/*closedFiles*/ undefined ) ;
1880
1902
@@ -1891,7 +1913,7 @@ namespace ts.projectSystem {
1891
1913
projectService . applyChangesInOpenFiles (
1892
1914
/*openFiles*/ undefined ,
1893
1915
/*changedFiles*/ undefined ,
1894
- /*closedFiles*/ [ file2 . path ] ) ;
1916
+ /*closedFiles*/ [ file2 . path ] ) ;
1895
1917
1896
1918
// HTML file is still included in project
1897
1919
checkNumberOfProjects ( projectService , { configuredProjects : 1 } ) ;
@@ -3322,7 +3344,7 @@ namespace ts.projectSystem {
3322
3344
const error1Result = < protocol . Diagnostic [ ] > session . executeCommand ( dTsFile1GetErrRequest ) . response ;
3323
3345
assert . isTrue ( error1Result . length === 0 ) ;
3324
3346
3325
- const dTsFile2GetErrRequest = makeSessionRequest < protocol . SemanticDiagnosticsSyncRequestArgs > (
3347
+ const dTsFile2GetErrRequest = makeSessionRequest < protocol . SemanticDiagnosticsSyncRequestArgs > (
3326
3348
CommandNames . SemanticDiagnosticsSync ,
3327
3349
{ file : dTsFile2 . path }
3328
3350
) ;
0 commit comments