volar-service-markdown 0.0.22 → 0.0.24

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.
Files changed (3) hide show
  1. package/index.d.ts +9 -1
  2. package/index.js +8 -12
  3. package/package.json +2 -3
package/index.d.ts CHANGED
@@ -3,5 +3,13 @@ import type { IMdLanguageService } from 'vscode-markdown-languageservice';
3
3
  export interface Provide {
4
4
  'markdown/languageService': () => IMdLanguageService;
5
5
  }
6
- export declare function create(): ServicePlugin;
6
+ export interface CreateOptions {
7
+ /**
8
+ * The section to use for configuring validation options.
9
+ *
10
+ * @example 'markdown.validate'
11
+ */
12
+ configurationSection: string;
13
+ }
14
+ export declare function create(options: CreateOptions): ServicePlugin;
7
15
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -15,11 +15,12 @@ function assert(condition, message) {
15
15
  throw new Error(message);
16
16
  }
17
17
  }
18
- function create() {
18
+ function create(options) {
19
19
  return {
20
+ name: 'markdown',
20
21
  create(context) {
21
22
  let lastProjectVersion;
22
- const { fs, onDidChangeWatchedFiles } = context.env;
23
+ const { fs, getConfiguration, onDidChangeWatchedFiles } = context.env;
23
24
  assert(fs, 'context.env.fs must be defined');
24
25
  assert(onDidChangeWatchedFiles, 'context.env.fs.onDidChangeWatchedFiles must be defined');
25
26
  const logger = {
@@ -178,17 +179,12 @@ function create() {
178
179
  };
179
180
  }
180
181
  },
181
- provideDiagnostics(document, token) {
182
+ async provideDiagnostics(document, token) {
182
183
  if (prepare(document)) {
183
- return ls.computeDiagnostics(document, {
184
- ignoreLinks: [],
185
- validateDuplicateLinkDefinitions: vscode_markdown_languageservice_1.DiagnosticLevel.warning,
186
- validateFileLinks: vscode_markdown_languageservice_1.DiagnosticLevel.warning,
187
- validateFragmentLinks: vscode_markdown_languageservice_1.DiagnosticLevel.warning,
188
- validateMarkdownFileLinkFragments: vscode_markdown_languageservice_1.DiagnosticLevel.warning,
189
- validateReferences: vscode_markdown_languageservice_1.DiagnosticLevel.warning,
190
- validateUnusedLinkDefinitions: vscode_markdown_languageservice_1.DiagnosticLevel.warning
191
- }, token);
184
+ const configuration = await getConfiguration?.(options.configurationSection, document.uri);
185
+ if (configuration) {
186
+ return ls.computeDiagnostics(document, configuration, token);
187
+ }
192
188
  }
193
189
  },
194
190
  provideDocumentHighlights(document, position, token) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-markdown",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "Integrate vscode-markdown-languageservice into Volar",
5
5
  "homepage": "https://github.com/volarjs/services/tree/master/packages/markdown",
6
6
  "bugs": "https://github.com/volarjs/services/issues",
@@ -8,7 +8,6 @@
8
8
  "keywords": [
9
9
  "volar-service"
10
10
  ],
11
- "main": "out/index.js",
12
11
  "license": "MIT",
13
12
  "files": [
14
13
  "**/*.js",
@@ -42,5 +41,5 @@
42
41
  "optional": true
43
42
  }
44
43
  },
45
- "gitHead": "6fb3db40aff2f3dbce116fc24b49c186ff5c0e5e"
44
+ "gitHead": "f0532815ff3cdcf289dc582ddd3b8e3bff0cba26"
46
45
  }