-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(language-service): return all typecheck files via getExternalFiles (
#40162) We need a means to preserve typecheck files when a project is reloaded, otherwise the Ivy compiler will throw an error when it's unable to find them. This commit implements `getExternalFiles()` called by the langauge server to achieve this goal. For more info see angular/vscode-ng-language-service#1030 PR Close #40162
- Loading branch information
1 parent
0264f76
commit 183fb7e
Showing
4 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/language-service/ivy/test/legacy/ts_plugin_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {LanguageService} from '../../language_service'; | ||
import {getExternalFiles} from '../../ts_plugin'; | ||
|
||
import {APP_COMPONENT, setup} from './mock_host'; | ||
|
||
describe('getExternalFiles()', () => { | ||
it('should return all typecheck files', () => { | ||
const {project, tsLS} = setup(); | ||
let externalFiles = getExternalFiles(project); | ||
// Initially there are no external files because Ivy compiler hasn't done | ||
// a global analysis | ||
expect(externalFiles).toEqual([]); | ||
// Trigger global analysis | ||
const ngLS = new LanguageService(project, tsLS); | ||
ngLS.getSemanticDiagnostics(APP_COMPONENT); | ||
// Now that global analysis is run, we should have all the typecheck files | ||
externalFiles = getExternalFiles(project); | ||
expect(externalFiles.length).toBe(1); | ||
expect(externalFiles[0].endsWith('app.component.ngtypecheck.ts')).toBeTrue(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters