mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
n10n lookup in node language servers (#171437)
* config node language servers with l10n location * fix loading * add workaround comment
This commit is contained in:
committed by
GitHub
parent
664c4ebf6c
commit
d4b18e0bc1
@@ -13,7 +13,7 @@ const path = require('path');
|
||||
module.exports = withDefaults({
|
||||
context: path.join(__dirname),
|
||||
entry: {
|
||||
extension: './src/node/cssServerMain.ts',
|
||||
extension: './src/node/cssServerNodeMain.ts',
|
||||
},
|
||||
output: {
|
||||
filename: 'cssServerMain.js',
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { URI } from 'vscode-uri';
|
||||
import { promises as fs } from 'fs';
|
||||
|
||||
async function setupMain() {
|
||||
const l10nLog: string[] = [];
|
||||
|
||||
const i10lLocation = process.env['VSCODE_L10N_BUNDLE_LOCATION'];
|
||||
if (i10lLocation) {
|
||||
try {
|
||||
// WORKAROUND for https://github.com/microsoft/vscode-l10n/issues/84. DO NOT COPY.
|
||||
const uri = URI.parse(i10lLocation);
|
||||
if (uri.scheme === 'file') {
|
||||
const contents = await (await fs.readFile(uri.fsPath)).toString();
|
||||
const bundle = JSON.parse(contents).contents.bundle;
|
||||
l10n.config({ contents: bundle });
|
||||
} else {
|
||||
await l10n.config({ uri: i10lLocation });
|
||||
}
|
||||
l10nLog.push(`l10n: Configured to ${i10lLocation.toString()}`);
|
||||
} catch (e) {
|
||||
l10nLog.push(`l10n: Problems loading ${i10lLocation.toString()} : ${e}`);
|
||||
}
|
||||
}
|
||||
await import('./cssServerMain');
|
||||
l10nLog.forEach(console.log);
|
||||
}
|
||||
setupMain();
|
||||
Reference in New Issue
Block a user