@volar/kit 2.2.0-alpha.9 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { Diagnostic, LanguagePlugin, LanguageServicePlugin, resolveCommonLanguageId } from '@volar/language-service';
1
+ import { Diagnostic, LanguagePlugin, LanguageServicePlugin } from '@volar/language-service';
2
2
  import * as ts from 'typescript';
3
- export declare function createTypeScriptChecker(languagePlugins: LanguagePlugin[], languageServicePlugins: LanguageServicePlugin[], tsconfig: string, getLanguageId?: typeof resolveCommonLanguageId): {
3
+ export declare function createTypeScriptChecker(languagePlugins: LanguagePlugin[], languageServicePlugins: LanguageServicePlugin[], tsconfig: string): {
4
4
  check: (fileName: string) => Promise<Diagnostic[]>;
5
5
  fixErrors: (fileName: string, diagnostics: Diagnostic[], only: string[] | undefined, writeFile: (fileName: string, newText: string) => Promise<void>) => Promise<void>;
6
6
  printErrors: (fileName: string, diagnostics: Diagnostic[], rootPath?: string) => string;
@@ -10,7 +10,7 @@ export declare function createTypeScriptChecker(languagePlugins: LanguagePlugin[
10
10
  fileUpdated(fileName: string): void;
11
11
  fileDeleted(fileName: string): void;
12
12
  };
13
- export declare function createTypeScriptInferredChecker(languagePlugins: LanguagePlugin[], languageServicePlugins: LanguageServicePlugin[], getScriptFileNames: () => string[], getLanguageId?: typeof resolveCommonLanguageId, compilerOptions?: ts.CompilerOptions): {
13
+ export declare function createTypeScriptInferredChecker(languagePlugins: LanguagePlugin[], languageServicePlugins: LanguageServicePlugin[], getScriptFileNames: () => string[], compilerOptions?: ts.CompilerOptions): {
14
14
  check: (fileName: string) => Promise<Diagnostic[]>;
15
15
  fixErrors: (fileName: string, diagnostics: Diagnostic[], only: string[] | undefined, writeFile: (fileName: string, newText: string) => Promise<void>) => Promise<void>;
16
16
  printErrors: (fileName: string, diagnostics: Diagnostic[], rootPath?: string) => string;
@@ -8,23 +8,23 @@ const vscode_languageserver_textdocument_1 = require("vscode-languageserver-text
8
8
  const createServiceEnvironment_1 = require("./createServiceEnvironment");
9
9
  const utils_1 = require("./utils");
10
10
  const typescript_1 = require("@volar/typescript");
11
- function createTypeScriptChecker(languagePlugins, languageServicePlugins, tsconfig, getLanguageId = language_service_1.resolveCommonLanguageId) {
11
+ function createTypeScriptChecker(languagePlugins, languageServicePlugins, tsconfig) {
12
12
  const tsconfigPath = (0, utils_1.asPosix)(tsconfig);
13
13
  return createTypeScriptCheckerWorker(languagePlugins, languageServicePlugins, env => {
14
14
  return createTypeScriptProjectHost(tsconfigPath, env, () => {
15
15
  const parsed = ts.parseJsonSourceFileConfigFileContent(ts.readJsonConfigFile(tsconfigPath, ts.sys.readFile), ts.sys, path.dirname(tsconfigPath), undefined, tsconfigPath, undefined, languagePlugins.map(plugin => plugin.typescript?.extraFileExtensions ?? []).flat());
16
16
  parsed.fileNames = parsed.fileNames.map(utils_1.asPosix);
17
17
  return parsed;
18
- }, getLanguageId);
18
+ });
19
19
  });
20
20
  }
21
21
  exports.createTypeScriptChecker = createTypeScriptChecker;
22
- function createTypeScriptInferredChecker(languagePlugins, languageServicePlugins, getScriptFileNames, getLanguageId = language_service_1.resolveCommonLanguageId, compilerOptions = utils_1.defaultCompilerOptions) {
22
+ function createTypeScriptInferredChecker(languagePlugins, languageServicePlugins, getScriptFileNames, compilerOptions = utils_1.defaultCompilerOptions) {
23
23
  return createTypeScriptCheckerWorker(languagePlugins, languageServicePlugins, env => {
24
24
  return createTypeScriptProjectHost(undefined, env, () => ({
25
25
  options: compilerOptions,
26
26
  fileNames: getScriptFileNames().map(utils_1.asPosix),
27
- }), getLanguageId);
27
+ }));
28
28
  });
29
29
  }
30
30
  exports.createTypeScriptInferredChecker = createTypeScriptInferredChecker;
@@ -147,7 +147,7 @@ function createTypeScriptCheckerWorker(languagePlugins, languageServicePlugins,
147
147
  return text;
148
148
  }
149
149
  }
150
- function createTypeScriptProjectHost(configFileName, env, createParsedCommandLine, getLanguageId) {
150
+ function createTypeScriptProjectHost(configFileName, env, createParsedCommandLine) {
151
151
  let scriptSnapshotsCache = new Map();
152
152
  let parsedCommandLine = createParsedCommandLine();
153
153
  let projectVersion = 0;
@@ -181,7 +181,6 @@ function createTypeScriptProjectHost(configFileName, env, createParsedCommandLin
181
181
  }
182
182
  return scriptSnapshotsCache.get(fileName);
183
183
  },
184
- getLanguageId,
185
184
  fileNameToScriptId: env.typescript.fileNameToUri,
186
185
  scriptIdToFileName: env.typescript.uriToFileName,
187
186
  };
@@ -23,7 +23,7 @@ function createFormatter(languages, services) {
23
23
  };
24
24
  async function format(content, languageId, options) {
25
25
  const snapshot = ts.ScriptSnapshot.fromString(content);
26
- language.scripts.set(fakeUri, languageId, snapshot);
26
+ language.scripts.set(fakeUri, snapshot, languageId);
27
27
  const document = service.context.documents.get(fakeUri, languageId, snapshot);
28
28
  const edits = await service.format(fakeUri, options, undefined, undefined);
29
29
  if (edits?.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/kit",
3
- "version": "2.2.0-alpha.9",
3
+ "version": "2.2.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,8 +12,8 @@
12
12
  "directory": "packages/kit"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-service": "2.2.0-alpha.9",
16
- "@volar/typescript": "2.2.0-alpha.9",
15
+ "@volar/language-service": "2.2.1",
16
+ "@volar/typescript": "2.2.1",
17
17
  "typesafe-path": "^0.2.2",
18
18
  "vscode-languageserver-textdocument": "^1.0.11",
19
19
  "vscode-uri": "^3.0.8"
@@ -24,5 +24,5 @@
24
24
  "peerDependencies": {
25
25
  "typescript": "*"
26
26
  },
27
- "gitHead": "7373fb794012e219aae3948c730c004827b03021"
27
+ "gitHead": "629f686bda694077b236a0bcd0304437bb2eabf5"
28
28
  }