mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Pass translations down to Markdown Language Server (#172884)
Fixes #172060
This commit is contained in:
@@ -52,6 +52,7 @@ export async function startClient(factory: LanguageClientConstructor, parser: IM
|
||||
},
|
||||
initializationOptions: {
|
||||
markdownFileExtensions,
|
||||
i10lLocation: vscode.l10n.uri?.toJSON(),
|
||||
},
|
||||
diagnosticPullOptions: {
|
||||
onChange: true,
|
||||
|
||||
@@ -27,8 +27,10 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
}
|
||||
|
||||
function startServer(context: vscode.ExtensionContext, parser: IMdParser): Promise<MdLanguageClient> {
|
||||
const serverMain = vscode.Uri.joinPath(context.extensionUri, 'server/dist/browser/main.js');
|
||||
const serverMain = vscode.Uri.joinPath(context.extensionUri, 'server/dist/browser/workerMain.js');
|
||||
|
||||
const worker = new Worker(serverMain.toString());
|
||||
worker.postMessage({ i10lLocation: vscode.l10n.uri?.toString() ?? '' });
|
||||
|
||||
return startClient((id: string, name: string, clientOptions: LanguageClientOptions) => {
|
||||
return new LanguageClient(id, name, clientOptions, worker);
|
||||
|
||||
@@ -29,7 +29,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
function startServer(context: vscode.ExtensionContext, parser: IMdParser): Promise<MdLanguageClient> {
|
||||
const clientMain = vscode.extensions.getExtension('vscode.markdown-language-features')?.packageJSON?.main || '';
|
||||
|
||||
const serverMain = `./server/${clientMain.indexOf('/dist/') !== -1 ? 'dist' : 'out'}/node/main`;
|
||||
const serverMain = `./server/${clientMain.indexOf('/dist/') !== -1 ? 'dist' : 'out'}/node/workerMain`;
|
||||
const serverModule = context.asAbsolutePath(serverMain);
|
||||
|
||||
// The debug options for the server
|
||||
@@ -41,6 +41,10 @@ function startServer(context: vscode.ExtensionContext, parser: IMdParser): Promi
|
||||
run: { module: serverModule, transport: TransportKind.ipc },
|
||||
debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions }
|
||||
};
|
||||
|
||||
// pass the location of the localization bundle to the server
|
||||
process.env['VSCODE_L10N_BUNDLE_LOCATION'] = vscode.l10n.uri?.toString() ?? '';
|
||||
|
||||
return startClient((id, name, clientOptions) => {
|
||||
return new LanguageClient(id, name, serverOptions, clientOptions);
|
||||
}, parser);
|
||||
|
||||
Reference in New Issue
Block a user