|
5 | 5 | * Licensed under the MIT License. See License.txt in the project root for license information. |
6 | 6 | *--------------------------------------------------------------------------------------------*/ |
7 | 7 |
|
8 | | -import { promises as fs, existsSync } from 'fs'; |
9 | | -import { Connection, createConnection, InitializeParams, ProposedFeatures } from 'vscode-languageserver/node'; |
| 8 | +import { promises as fs } from 'fs'; |
| 9 | +import { Connection, createConnection, ProposedFeatures } from 'vscode-languageserver/node'; |
10 | 10 | import { TelemetryImpl } from './languageserver/telemetry'; |
11 | 11 | import { schemaRequestHandler, workspaceContext } from './languageservice/services/schemaRequestHandler'; |
12 | 12 | import { convertErrorToTelemetryMsg } from './languageservice/utils/objects'; |
| 13 | +import { setupl10nBundle } from './nodeTranslationSetup'; |
13 | 14 | import { YAMLServerInit } from './yamlServerInit'; |
14 | 15 | import { SettingsState } from './yamlSettings'; |
15 | | -import * as path from 'path'; |
16 | | -import * as l10n from '@vscode/l10n'; |
17 | | -import { URI } from 'vscode-uri'; |
18 | 16 |
|
19 | 17 | // Create a connection for the server. |
20 | 18 | let connection: Connection = null; |
@@ -69,23 +67,4 @@ const schemaRequestHandlerWrapper = (connection: Connection, uri: string): Promi |
69 | 67 | const schemaRequestService = schemaRequestHandlerWrapper.bind(this, connection); |
70 | 68 | const telemetry = new TelemetryImpl(connection); |
71 | 69 |
|
72 | | -async function setupl10nBundle(params: InitializeParams): Promise<void> { |
73 | | - const __dirname = path.dirname(__filename); |
74 | | - const l10nPath: string = params.initializationOptions?.l10nPath || path.join(__dirname, '../../../l10n'); |
75 | | - const locale: string = params.locale || 'en'; |
76 | | - if (l10nPath) { |
77 | | - const bundleFile = !existsSync(path.join(l10nPath, `bundle.l10n.${locale}.json`)) |
78 | | - ? `bundle.l10n.json` |
79 | | - : `bundle.l10n.${locale}.json`; |
80 | | - const baseBundleFile = path.join(l10nPath, bundleFile); |
81 | | - process.env.VSCODE_NLS_CONFIG = JSON.stringify({ |
82 | | - locale, |
83 | | - _languagePackSupport: true, |
84 | | - }); |
85 | | - await l10n.config({ |
86 | | - uri: URI.file(baseBundleFile).toString(), |
87 | | - }); |
88 | | - } |
89 | | -} |
90 | | - |
91 | 70 | new YAMLServerInit(connection, yamlSettings, workspaceContext, schemaRequestService, telemetry, setupl10nBundle).start(); |
0 commit comments