mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Remove sending of extension URI
This commit is contained in:
@@ -95,12 +95,7 @@ export async function startClient(context: ExtensionContext, newLanguageClient:
|
|||||||
const languageParticipants = getLanguageParticipants();
|
const languageParticipants = getLanguageParticipants();
|
||||||
context.subscriptions.push(languageParticipants);
|
context.subscriptions.push(languageParticipants);
|
||||||
|
|
||||||
const extensionUri = {
|
let client: Disposable | undefined = await startClientWithParticipants(languageParticipants, newLanguageClient, outputChannel, runtime);
|
||||||
scheme: context.extensionUri.scheme,
|
|
||||||
path: context.extensionUri.path,
|
|
||||||
};
|
|
||||||
|
|
||||||
let client: Disposable | undefined = await startClientWithParticipants(languageParticipants, newLanguageClient, outputChannel, runtime, extensionUri);
|
|
||||||
|
|
||||||
const promptForLinkedEditingKey = 'html.promptForLinkedEditing';
|
const promptForLinkedEditingKey = 'html.promptForLinkedEditing';
|
||||||
if (extensions.getExtension('formulahendry.auto-rename-tag') !== undefined && (context.globalState.get(promptForLinkedEditingKey) !== false)) {
|
if (extensions.getExtension('formulahendry.auto-rename-tag') !== undefined && (context.globalState.get(promptForLinkedEditingKey) !== false)) {
|
||||||
@@ -133,7 +128,7 @@ export async function startClient(context: ExtensionContext, newLanguageClient:
|
|||||||
const oldClient = client;
|
const oldClient = client;
|
||||||
client = undefined;
|
client = undefined;
|
||||||
await oldClient.dispose();
|
await oldClient.dispose();
|
||||||
client = await startClientWithParticipants(languageParticipants, newLanguageClient, outputChannel, runtime, extensionUri);
|
client = await startClientWithParticipants(languageParticipants, newLanguageClient, outputChannel, runtime);
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
@@ -147,7 +142,7 @@ export async function startClient(context: ExtensionContext, newLanguageClient:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function startClientWithParticipants(languageParticipants: LanguageParticipants, newLanguageClient: LanguageClientConstructor, outputChannel: OutputChannel, runtime: Runtime, extensionUri: { scheme: string; path: string }): Promise<AsyncDisposable> {
|
async function startClientWithParticipants(languageParticipants: LanguageParticipants, newLanguageClient: LanguageClientConstructor, outputChannel: OutputChannel, runtime: Runtime): Promise<AsyncDisposable> {
|
||||||
|
|
||||||
const toDispose: Disposable[] = [];
|
const toDispose: Disposable[] = [];
|
||||||
|
|
||||||
@@ -163,7 +158,6 @@ async function startClientWithParticipants(languageParticipants: LanguagePartici
|
|||||||
configurationSection: ['html', 'css', 'javascript', 'js/ts'], // the settings to synchronize
|
configurationSection: ['html', 'css', 'javascript', 'js/ts'], // the settings to synchronize
|
||||||
},
|
},
|
||||||
initializationOptions: {
|
initializationOptions: {
|
||||||
extensionUri: extensionUri,
|
|
||||||
embeddedLanguages,
|
embeddedLanguages,
|
||||||
handledSchemas: ['file'],
|
handledSchemas: ['file'],
|
||||||
provideFormatter: false, // tell the server to not provide formatting capability and ignore the `html.format.enable` setting.
|
provideFormatter: false, // tell the server to not provide formatting capability and ignore the `html.format.enable` setting.
|
||||||
|
|||||||
@@ -153,9 +153,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
|
|||||||
get folders() { return workspaceFolders; }
|
get folders() { return workspaceFolders; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const extensionUri = initializationOptions?.extensionUri;
|
languageModes = getLanguageModes(initializationOptions?.embeddedLanguages || { css: true, javascript: true }, workspace, params.capabilities, fileSystemProvider);
|
||||||
|
|
||||||
languageModes = getLanguageModes(initializationOptions?.embeddedLanguages || { css: true, javascript: true }, workspace, params.capabilities, fileSystemProvider, extensionUri);
|
|
||||||
|
|
||||||
const dataPaths: string[] = initializationOptions?.dataPaths || [];
|
const dataPaths: string[] = initializationOptions?.dataPaths || [];
|
||||||
fetchHTMLDataProviders(dataPaths, customDataRequestService).then(dataProviders => {
|
fetchHTMLDataProviders(dataPaths, customDataRequestService).then(dataProviders => {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
SymbolInformation, SymbolKind, CompletionItem, Location, SignatureHelp, SignatureInformation, ParameterInformation,
|
SymbolInformation, SymbolKind, CompletionItem, Location, SignatureHelp, SignatureInformation, ParameterInformation,
|
||||||
Definition, TextEdit, TextDocument, Diagnostic, DiagnosticSeverity, Range, CompletionItemKind, Hover,
|
Definition, TextEdit, TextDocument, Diagnostic, DiagnosticSeverity, Range, CompletionItemKind, Hover,
|
||||||
DocumentHighlight, DocumentHighlightKind, CompletionList, Position, FormattingOptions, FoldingRange, FoldingRangeKind, SelectionRange,
|
DocumentHighlight, DocumentHighlightKind, CompletionList, Position, FormattingOptions, FoldingRange, FoldingRangeKind, SelectionRange,
|
||||||
LanguageMode, Settings, SemanticTokenData, Workspace, DocumentContext, CompletionItemData, isCompletionItemData, Uri, FILE_PROTOCOL
|
LanguageMode, Settings, SemanticTokenData, Workspace, DocumentContext, CompletionItemData, isCompletionItemData, FILE_PROTOCOL
|
||||||
} from './languageModes';
|
} from './languageModes';
|
||||||
import { getWordAtText, isWhitespaceOnly, repeat } from '../utils/strings';
|
import { getWordAtText, isWhitespaceOnly, repeat } from '../utils/strings';
|
||||||
import { HTMLDocumentRegions } from './embeddedSupport';
|
import { HTMLDocumentRegions } from './embeddedSupport';
|
||||||
@@ -104,7 +104,7 @@ const ignoredErrors = [
|
|||||||
2792, /* Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option */
|
2792, /* Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_node_or_to_add_aliases_to_the_paths_option */
|
||||||
];
|
];
|
||||||
|
|
||||||
export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocumentRegions>, languageId: 'javascript' | 'typescript', workspace: Workspace, extensionUri?: Uri): LanguageMode {
|
export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocumentRegions>, languageId: 'javascript' | 'typescript', workspace: Workspace): LanguageMode {
|
||||||
const jsDocuments = getLanguageModelCache<TextDocument>(10, 60, document => documentRegions.get(document).getEmbeddedDocument(languageId));
|
const jsDocuments = getLanguageModelCache<TextDocument>(10, 60, document => documentRegions.get(document).getEmbeddedDocument(languageId));
|
||||||
|
|
||||||
const host = getLanguageServiceHost(languageId === 'javascript' ? ts.ScriptKind.JS : ts.ScriptKind.TS);
|
const host = getLanguageServiceHost(languageId === 'javascript' ? ts.ScriptKind.JS : ts.ScriptKind.TS);
|
||||||
@@ -315,9 +315,6 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
|||||||
range: convertRange(jsDocument, d.textSpan)
|
range: convertRange(jsDocument, d.textSpan)
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (!extensionUri) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const libUri = `${FILE_PROTOCOL}://${languageId}/${d.fileName}`;
|
const libUri = `${FILE_PROTOCOL}://${languageId}/${d.fileName}`;
|
||||||
const content = await host.loadLibrary(d.fileName);
|
const content = await host.loadLibrary(d.fileName);
|
||||||
if (!content) {
|
if (!content) {
|
||||||
|
|||||||
@@ -109,14 +109,9 @@ export interface LanguageModeRange extends Range {
|
|||||||
attributeValue?: boolean;
|
attributeValue?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Uri {
|
|
||||||
scheme: string;
|
|
||||||
path: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const FILE_PROTOCOL = 'html-server';
|
export const FILE_PROTOCOL = 'html-server';
|
||||||
|
|
||||||
export function getLanguageModes(supportedLanguages: { [languageId: string]: boolean }, workspace: Workspace, clientCapabilities: ClientCapabilities, requestService: FileSystemProvider, extensionUri?: Uri): LanguageModes {
|
export function getLanguageModes(supportedLanguages: { [languageId: string]: boolean }, workspace: Workspace, clientCapabilities: ClientCapabilities, requestService: FileSystemProvider): LanguageModes {
|
||||||
const htmlLanguageService = getHTMLLanguageService({ clientCapabilities, fileSystemProvider: requestService });
|
const htmlLanguageService = getHTMLLanguageService({ clientCapabilities, fileSystemProvider: requestService });
|
||||||
const cssLanguageService = getCSSLanguageService({ clientCapabilities, fileSystemProvider: requestService });
|
const cssLanguageService = getCSSLanguageService({ clientCapabilities, fileSystemProvider: requestService });
|
||||||
|
|
||||||
@@ -131,8 +126,8 @@ export function getLanguageModes(supportedLanguages: { [languageId: string]: boo
|
|||||||
modes['css'] = getCSSMode(cssLanguageService, documentRegions, workspace);
|
modes['css'] = getCSSMode(cssLanguageService, documentRegions, workspace);
|
||||||
}
|
}
|
||||||
if (supportedLanguages['javascript']) {
|
if (supportedLanguages['javascript']) {
|
||||||
modes['javascript'] = getJavaScriptMode(documentRegions, 'javascript', workspace, extensionUri);
|
modes['javascript'] = getJavaScriptMode(documentRegions, 'javascript', workspace);
|
||||||
modes['typescript'] = getJavaScriptMode(documentRegions, 'typescript', workspace, extensionUri);
|
modes['typescript'] = getJavaScriptMode(documentRegions, 'typescript', workspace);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
async updateDataProviders(dataProviders: IHTMLDataProvider[]): Promise<void> {
|
async updateDataProviders(dataProviders: IHTMLDataProvider[]): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user