Make sure we do not enable JS/TS language features on live share clients
For #104180
This commit is contained in:
parent
c709fd3aa2
commit
f694b07825
|
@ -11,6 +11,7 @@ import { TsServerProcessFactory } from './tsServer/server';
|
||||||
import { ITypeScriptVersionProvider } from './tsServer/versionProvider';
|
import { ITypeScriptVersionProvider } from './tsServer/versionProvider';
|
||||||
import TypeScriptServiceClientHost from './typeScriptServiceClientHost';
|
import TypeScriptServiceClientHost from './typeScriptServiceClientHost';
|
||||||
import { flatten } from './utils/arrays';
|
import { flatten } from './utils/arrays';
|
||||||
|
import * as fileSchemes from './utils/fileSchemes';
|
||||||
import { standardLanguageDescriptions } from './utils/languageDescription';
|
import { standardLanguageDescriptions } from './utils/languageDescription';
|
||||||
import { lazy, Lazy } from './utils/lazy';
|
import { lazy, Lazy } from './utils/lazy';
|
||||||
import ManagedFileContextManager from './utils/managedFileContext';
|
import ManagedFileContextManager from './utils/managedFileContext';
|
||||||
|
@ -85,5 +86,6 @@ function isSupportedDocument(
|
||||||
supportedLanguage: readonly string[],
|
supportedLanguage: readonly string[],
|
||||||
document: vscode.TextDocument
|
document: vscode.TextDocument
|
||||||
): boolean {
|
): 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 {
|
public normalizedPath(resource: vscode.Uri): string | undefined {
|
||||||
|
if (fileSchemes.disabledSchemes.has(resource.scheme)) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
switch (resource.scheme) {
|
switch (resource.scheme) {
|
||||||
case fileSchemes.file:
|
case fileSchemes.file:
|
||||||
{
|
{
|
||||||
|
@ -648,10 +652,6 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||||
// Both \ and / must be escaped in regular expressions
|
// Both \ and / must be escaped in regular expressions
|
||||||
return result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/');
|
return result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/');
|
||||||
}
|
}
|
||||||
case fileSchemes.git:
|
|
||||||
{
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return this.inMemoryResourcePrefix + resource.toString(true);
|
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 {
|
public toOpenedFilePath(document: vscode.TextDocument): string | undefined {
|
||||||
if (!this.bufferSyncSupport.ensureHasBuffer(document.uri)) {
|
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 undefined;
|
||||||
}
|
}
|
||||||
return this.toPath(document.uri) || undefined;
|
return this.toPath(document.uri) || undefined;
|
||||||
|
|
|
@ -6,9 +6,19 @@
|
||||||
export const file = 'file';
|
export const file = 'file';
|
||||||
export const untitled = 'untitled';
|
export const untitled = 'untitled';
|
||||||
export const git = 'git';
|
export const git = 'git';
|
||||||
|
/** Live share scheme */
|
||||||
|
export const vsls = 'vsls';
|
||||||
export const walkThroughSnippet = 'walkThroughSnippet';
|
export const walkThroughSnippet = 'walkThroughSnippet';
|
||||||
|
|
||||||
export const semanticSupportedSchemes = [
|
export const semanticSupportedSchemes = [
|
||||||
file,
|
file,
|
||||||
untitled,
|
untitled,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File scheme for which JS/TS language feature should be disabled
|
||||||
|
*/
|
||||||
|
export const disabledSchemes = new Set([
|
||||||
|
git,
|
||||||
|
vsls
|
||||||
|
]);
|
||||||
|
|
Loading…
Reference in a new issue