提交 f694b078 编写于 作者: M Matt Bierner

Make sure we do not enable JS/TS language features on live share clients

For #104180
上级 c709fd3a
......@@ -11,6 +11,7 @@ import { TsServerProcessFactory } from './tsServer/server';
import { ITypeScriptVersionProvider } from './tsServer/versionProvider';
import TypeScriptServiceClientHost from './typeScriptServiceClientHost';
import { flatten } from './utils/arrays';
import * as fileSchemes from './utils/fileSchemes';
import { standardLanguageDescriptions } from './utils/languageDescription';
import { lazy, Lazy } from './utils/lazy';
import ManagedFileContextManager from './utils/managedFileContext';
......@@ -85,5 +86,6 @@ function isSupportedDocument(
supportedLanguage: readonly string[],
document: vscode.TextDocument
): boolean {
return supportedLanguage.indexOf(document.languageId) >= 0;
return supportedLanguage.indexOf(document.languageId) >= 0
&& !fileSchemes.disabledSchemes.has(document.uri.scheme);
}
......@@ -636,6 +636,10 @@ export default class TypeScriptServiceClient extends Disposable implements IType
}
public normalizedPath(resource: vscode.Uri): string | undefined {
if (fileSchemes.disabledSchemes.has(resource.scheme)) {
return undefined;
}
switch (resource.scheme) {
case fileSchemes.file:
{
......@@ -648,10 +652,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
// Both \ and / must be escaped in regular expressions
return result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/');
}
case fileSchemes.git:
{
return undefined;
}
default:
{
return this.inMemoryResourcePrefix + resource.toString(true);
......@@ -665,7 +665,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType
public toOpenedFilePath(document: vscode.TextDocument): string | undefined {
if (!this.bufferSyncSupport.ensureHasBuffer(document.uri)) {
console.error(`Unexpected resource ${document.uri}`);
if (!fileSchemes.disabledSchemes.has(document.uri.scheme)) {
console.error(`Unexpected resource ${document.uri}`);
}
return undefined;
}
return this.toPath(document.uri) || undefined;
......
......@@ -6,9 +6,19 @@
export const file = 'file';
export const untitled = 'untitled';
export const git = 'git';
/** Live share scheme */
export const vsls = 'vsls';
export const walkThroughSnippet = 'walkThroughSnippet';
export const semanticSupportedSchemes = [
file,
untitled,
];
/**
* File scheme for which JS/TS language feature should be disabled
*/
export const disabledSchemes = new Set([
git,
vsls
]);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册