@volar/language-service 1.0.17 → 1.0.19

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.
@@ -3,7 +3,21 @@ exports.register = void 0;
3
3
  const featureWorkers_1 = require("../utils/featureWorkers");
4
4
  function register(context) {
5
5
  return (document, position, options) => {
6
- return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, position, () => true, (position, map) => map.toGeneratedPositions(position, data => !!data.completion), (plugin, document, position) => { var _a; return (_a = plugin.doAutoInsert) === null || _a === void 0 ? void 0 : _a.call(plugin, document, position, options); }, (data, map) => {
6
+ return (0, featureWorkers_1.documentArgFeatureWorker)(context, document, { position, options }, () => true, function* ({ position, options }, map) {
7
+ for (const mappedPos of map.toGeneratedPositions(position, data => !!data.completion)) {
8
+ for (const [mappedChangeOffset] of map.map.toGeneratedOffsets(options.lastChange.rangeOffset)) {
9
+ yield {
10
+ position: mappedPos,
11
+ options: {
12
+ lastChange: Object.assign(Object.assign({}, options.lastChange), { rangeOffset: mappedChangeOffset, range: {
13
+ start: map.virtualFileDocument.positionAt(mappedChangeOffset),
14
+ end: map.virtualFileDocument.positionAt(mappedChangeOffset + options.lastChange.rangeLength),
15
+ } })
16
+ }
17
+ };
18
+ }
19
+ }
20
+ }, (plugin, document, { position, options }) => { var _a; return (_a = plugin.doAutoInsert) === null || _a === void 0 ? void 0 : _a.call(plugin, document, position, options); }, (data, map) => {
7
21
  if (typeof data === 'string')
8
22
  return data;
9
23
  const range = map.toSourceRange(data.range);
@@ -18,7 +18,7 @@ function register(context) {
18
18
  if (!range) {
19
19
  range = vscode.Range.create(document.positionAt(0), document.positionAt(document.getText().length));
20
20
  }
21
- const virtualFile = context.documents.getVirtualFileByUri(document.uri);
21
+ const virtualFile = context.documents.getRootFileBySourceFileUri(document.uri);
22
22
  const originalDocument = document;
23
23
  const rootEdits = onTypeParams
24
24
  ? yield tryFormat(document, onTypeParams.position, undefined, onTypeParams.ch)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-service",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,17 +13,16 @@
13
13
  "directory": "packages/language-service"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-core": "1.0.17",
17
- "@volar/shared": "1.0.17",
18
- "@volar/source-map": "1.0.17",
19
- "@volar/transforms": "1.0.17",
20
- "@volar/typescript-faster": "1.0.17",
21
- "@vue/reactivity": "^3.2.45",
16
+ "@volar/language-core": "1.0.19",
17
+ "@volar/shared": "1.0.19",
18
+ "@volar/source-map": "1.0.19",
19
+ "@volar/transforms": "1.0.19",
20
+ "@volar/typescript-faster": "1.0.19",
22
21
  "vscode-html-languageservice": "^5.0.3",
23
22
  "vscode-json-languageservice": "^5.1.3",
24
23
  "vscode-languageserver-protocol": "^3.17.2",
25
24
  "vscode-languageserver-textdocument": "^1.0.8",
26
25
  "vscode-uri": "^3.0.7"
27
26
  },
28
- "gitHead": "b66b64f579b5cafee9b8d70aa9f9303f39b6df49"
27
+ "gitHead": "02267fe83a5567b1cae7025e834cf084c8248546"
29
28
  }