@@ -115,7 +115,7 @@ function getProbeLocations(configValue: string|null, bundled: string): string[]
115
115
const locations = [ ] ;
116
116
// Always use config value if it's specified
117
117
if ( configValue ) {
118
- locations . push ( configValue as string ) ;
118
+ locations . push ( configValue ) ;
119
119
}
120
120
// If not, look in workspaces currently open
121
121
const workspaceFolders = vscode . workspace . workspaceFolders || [ ] ;
@@ -144,13 +144,30 @@ function constructArgs(ctx: vscode.ExtensionContext, debug: boolean): string[] {
144
144
args . push ( '--logVerbosity' , debug ? 'verbose' : ngLog ) ;
145
145
}
146
146
147
+ // Due to a bug in tsserver, ngProbeLocation is not honored when tsserver
148
+ // loads the plugin. tsserver would look for @angular /language-service in its
149
+ // peer node_modules directory, and use that if it finds one. To work around
150
+ // this bug, always load typescript from the bundled location for now, so that
151
+ // the bundled @angular /language-service is always chosen.
152
+ // See the following links:
153
+ // 1. https://github.com/angular/vscode-ng-language-service/issues/437
154
+ // 2. https://github.com/microsoft/TypeScript/issues/34616
155
+ // 3. https://github.com/microsoft/TypeScript/pull/34656
156
+ // TODO: Remove workaround once
157
+ // https://github.com/microsoft/TypeScript/commit/f689982c9f2081bc90d2192eee96b404f75c4705
158
+ // is released and Angular is switched over to the new TypeScript version.
159
+ args . push ( '--ngProbeLocations' , ctx . asAbsolutePath ( 'server' ) ) ;
160
+ args . push ( '--tsProbeLocations' , ctx . extensionPath ) ;
161
+
162
+ /*
147
163
const ngdk: string|null = config.get('angular.ngdk', null);
148
164
const ngProbeLocations = getProbeLocations(ngdk, ctx.asAbsolutePath('server'));
149
165
args.push('--ngProbeLocations', ngProbeLocations.join(','));
150
166
151
167
const tsdk: string|null = config.get('typescript.tsdk', null);
152
168
const tsProbeLocations = getProbeLocations(tsdk, ctx.extensionPath);
153
169
args.push('--tsProbeLocations', tsProbeLocations.join(','));
170
+ */
154
171
155
172
return args ;
156
173
}
0 commit comments