@volar/kit 1.9.2 → 1.10.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.
@@ -2,6 +2,7 @@ import { Config, Diagnostic, TypeScriptLanguageHost } from '@volar/language-serv
2
2
  export declare function createLinter(config: Config, host: TypeScriptLanguageHost): {
3
3
  check: (fileName: string) => Promise<Diagnostic[]>;
4
4
  fixErrors: (fileName: string, diagnostics: Diagnostic[], only: string[] | undefined, writeFile: (fileName: string, newText: string) => Promise<void>) => Promise<void>;
5
- logErrors: (fileName: string, diagnostics: Diagnostic[]) => void;
5
+ printErrors: (fileName: string, diagnostics: Diagnostic[], rootPath?: string) => string;
6
+ logErrors: (fileName: string, diagnostics: Diagnostic[], rootPath?: string) => void;
6
7
  settings: any;
7
8
  };
@@ -20,6 +20,7 @@ function createLinter(config, host) {
20
20
  return {
21
21
  check,
22
22
  fixErrors,
23
+ printErrors,
23
24
  logErrors,
24
25
  get settings() {
25
26
  return settings;
@@ -72,16 +73,20 @@ function createLinter(config, host) {
72
73
  }
73
74
  }
74
75
  }
75
- function logErrors(fileName, diagnostics) {
76
- if (!diagnostics.length)
77
- return;
78
- let text = formatErrors(fileName, diagnostics);
76
+ function printErrors(fileName, diagnostics, rootPath = process.cwd()) {
77
+ let text = formatErrors(fileName, diagnostics, rootPath);
79
78
  for (const diagnostic of diagnostics) {
80
79
  text = text.replace(`TS${diagnostic.code}`, (diagnostic.source ?? '') + (diagnostic.code ? `(${diagnostic.code})` : ''));
81
80
  }
82
- console.log(text);
81
+ return text;
82
+ }
83
+ /**
84
+ * @deprecated please use `printErrors()` instead of
85
+ */
86
+ function logErrors(fileName, diagnostics, rootPath = process.cwd()) {
87
+ console.log(printErrors(fileName, diagnostics, rootPath));
83
88
  }
84
- function formatErrors(fileName, diagnostics, rootPath = process.cwd()) {
89
+ function formatErrors(fileName, diagnostics, rootPath) {
85
90
  fileName = (0, utils_1.asPosix)(fileName);
86
91
  const uri = (0, utils_1.fileNameToUri)(fileName);
87
92
  const document = service.context.getTextDocument(uri);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/kit",
3
- "version": "1.9.2",
3
+ "version": "1.10.1",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,7 +13,7 @@
13
13
  "directory": "packages/kit"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-service": "1.9.2",
16
+ "@volar/language-service": "1.10.1",
17
17
  "typesafe-path": "^0.2.2",
18
18
  "vscode-languageserver-textdocument": "^1.0.8",
19
19
  "vscode-uri": "^3.0.7"
@@ -21,5 +21,5 @@
21
21
  "peerDependencies": {
22
22
  "typescript": "*"
23
23
  },
24
- "gitHead": "c838ba22be287308e3fcf27f65af672749816df4"
24
+ "gitHead": "65775648936d786847511f3d8bdd8a3d1dca2e4e"
25
25
  }