@volar/language-server 2.4.16 → 2.4.18

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.
@@ -213,6 +213,7 @@ function createTypeScriptProject(ts, tsLocalized, create) {
213
213
  function createUriConverter(rootFolders) {
214
214
  const encodeds = new Map();
215
215
  const isFileScheme = rootFolders.every(folder => folder.scheme === 'file');
216
+ const fragmentPrefix = '/' + encodeURIComponent('#');
216
217
  return {
217
218
  asFileName,
218
219
  asUri,
@@ -228,7 +229,8 @@ function createUriConverter(rootFolders) {
228
229
  }
229
230
  const encoded = encodeURIComponent(`${parsed.scheme}://${parsed.authority}`);
230
231
  encodeds.set(encoded, parsed);
231
- return `/${encoded}${parsed.path}`;
232
+ const fragment = parsed.fragment ? fragmentPrefix + encodeURIComponent(parsed.fragment) : '';
233
+ return `/${encoded}${parsed.path}${fragment}`;
232
234
  }
233
235
  function asUri(fileName) {
234
236
  for (const [encoded, uri] of encodeds) {
@@ -244,7 +246,7 @@ function createUriConverter(rootFolders) {
244
246
  return vscode_uri_1.URI.from({
245
247
  scheme: uri.scheme,
246
248
  authority: uri.authority,
247
- path: fileName.substring(prefix.length),
249
+ ...getComponents(fileName, prefix.length),
248
250
  });
249
251
  }
250
252
  }
@@ -253,7 +255,7 @@ function createUriConverter(rootFolders) {
253
255
  return vscode_uri_1.URI.from({
254
256
  scheme: uri.scheme,
255
257
  authority: uri.authority,
256
- path: fileName.substring(prefix.length),
258
+ ...getComponents(fileName, prefix.length),
257
259
  });
258
260
  }
259
261
  }
@@ -265,6 +267,21 @@ function createUriConverter(rootFolders) {
265
267
  }
266
268
  return vscode_uri_1.URI.file(fileName);
267
269
  }
270
+ function getComponents(fileName, prefixLength) {
271
+ // Fragment is present when the fileName contains the fragment prefix and is not followed by a slash.
272
+ const fragmentPosition = fileName.lastIndexOf(fragmentPrefix);
273
+ if (fragmentPosition >= prefixLength) {
274
+ if (fileName.indexOf('/', fragmentPosition + fragmentPrefix.length) < 0) {
275
+ return {
276
+ path: fileName.substring(prefixLength, fragmentPosition),
277
+ fragment: decodeURIComponent(fileName.substring(fragmentPosition + fragmentPrefix.length)),
278
+ };
279
+ }
280
+ }
281
+ return {
282
+ path: fileName.substring(prefixLength),
283
+ };
284
+ }
268
285
  }
269
286
  function sortTSConfigs(file, a, b) {
270
287
  const inA = isFileInDir(file, path.dirname(a));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-server",
3
- "version": "2.4.16",
3
+ "version": "2.4.18",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,9 +12,9 @@
12
12
  "directory": "packages/language-server"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-core": "2.4.16",
16
- "@volar/language-service": "2.4.16",
17
- "@volar/typescript": "2.4.16",
15
+ "@volar/language-core": "2.4.18",
16
+ "@volar/language-service": "2.4.18",
17
+ "@volar/typescript": "2.4.18",
18
18
  "path-browserify": "^1.0.1",
19
19
  "request-light": "^0.7.0",
20
20
  "vscode-languageserver": "^9.0.1",
@@ -25,5 +25,5 @@
25
25
  "devDependencies": {
26
26
  "@types/path-browserify": "latest"
27
27
  },
28
- "gitHead": "e0233d53110b4d59ecf6f40844bf3aa53b155653"
28
+ "gitHead": "2093bc370bcea22576f54ad2ab453b00fd1948e3"
29
29
  }