mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
Fix some errors for project wide JS/TS IntelliSense (#183482)
- Don't compute `semanticSupportedSchemes` early, as this may be incorrect if the script is loaded before there are workspace folders - Handle exceptions when watching files by logging them but not crashing the server
This commit is contained in:
@@ -19,13 +19,18 @@ export const memFs = 'memfs';
|
||||
export const vscodeVfs = 'vscode-vfs';
|
||||
export const officeScript = 'office-script';
|
||||
|
||||
export const semanticSupportedSchemes = isWeb() && vscode.workspace.workspaceFolders ?
|
||||
vscode.workspace.workspaceFolders.map(folder => folder.uri.scheme) : [
|
||||
export function getSemanticSupportedSchemes() {
|
||||
if (isWeb() && vscode.workspace.workspaceFolders) {
|
||||
return vscode.workspace.workspaceFolders.map(folder => folder.uri.scheme);
|
||||
}
|
||||
|
||||
return [
|
||||
file,
|
||||
untitled,
|
||||
walkThroughSnippet,
|
||||
vscodeNotebookCell,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* File scheme for which JS/TS language feature should be disabled
|
||||
|
||||
@@ -46,7 +46,7 @@ export default class LanguageProvider extends Disposable {
|
||||
const syntax: vscode.DocumentFilter[] = [];
|
||||
for (const language of this.description.languageIds) {
|
||||
syntax.push({ language });
|
||||
for (const scheme of fileSchemes.semanticSupportedSchemes) {
|
||||
for (const scheme of fileSchemes.getSemanticSupportedSchemes()) {
|
||||
semantic.push({ language, scheme });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,15 +719,13 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
}
|
||||
|
||||
switch (capability) {
|
||||
case ClientCapability.Semantic:
|
||||
{
|
||||
return fileSchemes.semanticSupportedSchemes.includes(resource.scheme);
|
||||
}
|
||||
case ClientCapability.Semantic: {
|
||||
return fileSchemes.getSemanticSupportedSchemes().includes(resource.scheme);
|
||||
}
|
||||
case ClientCapability.Syntax:
|
||||
case ClientCapability.EnhancedSyntax:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
case ClientCapability.EnhancedSyntax: {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user