volar-service-markdown 0.0.26 → 0.0.27

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 (2) hide show
  1. package/index.js +19 -3
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -103,10 +103,10 @@ function create(options) {
103
103
  });
104
104
  const syncedVersions = new Map();
105
105
  const sync = () => {
106
- if (!context.typescript) {
106
+ if (!context.language.typescript) {
107
107
  return;
108
108
  }
109
- const { languageServiceHost } = context.typescript;
109
+ const { languageServiceHost } = context.language.typescript;
110
110
  const newProjectVersion = languageServiceHost.getProjectVersion?.();
111
111
  const shouldUpdate = newProjectVersion === undefined || newProjectVersion !== lastProjectVersion;
112
112
  if (!shouldUpdate) {
@@ -183,6 +183,22 @@ function create(options) {
183
183
  };
184
184
  }
185
185
  },
186
+ async provideDefinition(document, position, token) {
187
+ if (prepare(document)) {
188
+ let locations = await ls.getDefinition(document, position, token);
189
+ if (!locations) {
190
+ return;
191
+ }
192
+ if (!Array.isArray(locations)) {
193
+ locations = [locations];
194
+ }
195
+ return locations.map(location => ({
196
+ targetUri: location.uri,
197
+ targetRange: location.range,
198
+ targetSelectionRange: location.range,
199
+ }));
200
+ }
201
+ },
186
202
  async provideDiagnostics(document, token) {
187
203
  if (prepare(document)) {
188
204
  const configuration = await getConfiguration?.(options.configurationSection, document.uri);
@@ -252,7 +268,7 @@ function create(options) {
252
268
  return context.documents.get(uri, virtualCode.languageId, virtualCode.snapshot);
253
269
  }
254
270
  }
255
- const sourceFile = context.files.get(uri);
271
+ const sourceFile = context.language.files.get(uri);
256
272
  if (sourceFile) {
257
273
  return context.documents.get(uri, sourceFile.languageId, sourceFile.snapshot);
258
274
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-markdown",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
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",
@@ -34,12 +34,12 @@
34
34
  "vscode-languageserver-textdocument": "^1.0.11"
35
35
  },
36
36
  "peerDependencies": {
37
- "@volar/language-service": "next"
37
+ "@volar/language-service": "~2.0"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@volar/language-service": {
41
41
  "optional": true
42
42
  }
43
43
  },
44
- "gitHead": "876051c97aedf04531033784019b4344cdd48881"
44
+ "gitHead": "bc83e2d244f494e30f6f789b766e54eeaa0e7a01"
45
45
  }