volar-service-html 0.0.33 → 0.0.35

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 -9
  2. package/index.js +12 -9
  3. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Disposable, DocumentSelector, FormattingOptions, Result, ServiceContext, ServicePlugin } from '@volar/language-service';
1
+ import type { Disposable, DocumentSelector, FormattingOptions, ProviderResult, ServiceContext, LanguageServicePlugin } from '@volar/language-service';
2
2
  import * as html from 'vscode-html-languageservice';
3
3
  import { TextDocument } from 'vscode-languageserver-textdocument';
4
4
  export interface Provide {
@@ -9,14 +9,14 @@ export interface Provide {
9
9
  export declare function create({ documentSelector, useDefaultDataProvider, getDocumentContext, isFormattingEnabled, isAutoCreateQuotesEnabled, isAutoClosingTagsEnabled, getFormattingOptions, getCompletionConfiguration, getHoverSettings, getCustomData, onDidChangeCustomData, }?: {
10
10
  documentSelector?: DocumentSelector;
11
11
  useDefaultDataProvider?: boolean;
12
- isFormattingEnabled?(document: TextDocument, context: ServiceContext): Result<boolean>;
13
- isAutoCreateQuotesEnabled?(document: TextDocument, context: ServiceContext): Result<boolean>;
14
- isAutoClosingTagsEnabled?(document: TextDocument, context: ServiceContext): Result<boolean>;
12
+ isFormattingEnabled?(document: TextDocument, context: ServiceContext): ProviderResult<boolean>;
13
+ isAutoCreateQuotesEnabled?(document: TextDocument, context: ServiceContext): ProviderResult<boolean>;
14
+ isAutoClosingTagsEnabled?(document: TextDocument, context: ServiceContext): ProviderResult<boolean>;
15
15
  getDocumentContext?(context: ServiceContext): html.DocumentContext;
16
- getFormattingOptions?(document: TextDocument, options: FormattingOptions, context: ServiceContext): Result<html.HTMLFormatConfiguration>;
17
- getCompletionConfiguration?(document: TextDocument, context: ServiceContext): Result<html.CompletionConfiguration | undefined>;
18
- getHoverSettings?(document: TextDocument, context: ServiceContext): Result<html.HoverSettings | undefined>;
19
- getCustomData?(context: ServiceContext): Result<html.IHTMLDataProvider[]>;
16
+ getFormattingOptions?(document: TextDocument, options: FormattingOptions, context: ServiceContext): ProviderResult<html.HTMLFormatConfiguration>;
17
+ getCompletionConfiguration?(document: TextDocument, context: ServiceContext): ProviderResult<html.CompletionConfiguration | undefined>;
18
+ getHoverSettings?(document: TextDocument, context: ServiceContext): ProviderResult<html.HoverSettings | undefined>;
19
+ getCustomData?(context: ServiceContext): ProviderResult<html.IHTMLDataProvider[]>;
20
20
  onDidChangeCustomData?(listener: () => void, context: ServiceContext): Disposable;
21
- }): ServicePlugin;
21
+ }): LanguageServicePlugin;
22
22
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -96,7 +96,7 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
96
96
  disposable.dispose();
97
97
  },
98
98
  provide: {
99
- 'html/htmlDocument': (document) => {
99
+ 'html/htmlDocument': document => {
100
100
  if (matchDocument(documentSelector, document)) {
101
101
  return getHtmlDocument(document);
102
102
  }
@@ -111,7 +111,7 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
111
111
  });
112
112
  },
113
113
  provideRenameRange(document, position) {
114
- return worker(document, (htmlDocument) => {
114
+ return worker(document, htmlDocument => {
115
115
  const offset = document.offsetAt(position);
116
116
  return htmlLs
117
117
  .findDocumentHighlights(document, position, htmlDocument)
@@ -120,7 +120,7 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
120
120
  });
121
121
  },
122
122
  provideRenameEdits(document, position, newName) {
123
- return worker(document, (htmlDocument) => {
123
+ return worker(document, htmlDocument => {
124
124
  return htmlLs.doRename(document, position, newName, htmlDocument);
125
125
  });
126
126
  },
@@ -131,7 +131,7 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
131
131
  });
132
132
  },
133
133
  provideDocumentHighlights(document, position) {
134
- return worker(document, (htmlDocument) => {
134
+ return worker(document, htmlDocument => {
135
135
  return htmlLs.findDocumentHighlights(document, position, htmlDocument);
136
136
  });
137
137
  },
@@ -141,7 +141,7 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
141
141
  });
142
142
  },
143
143
  provideDocumentSymbols(document) {
144
- return worker(document, (htmlDocument) => {
144
+ return worker(document, htmlDocument => {
145
145
  return htmlLs.findDocumentSymbols2(document, htmlDocument);
146
146
  });
147
147
  },
@@ -255,10 +255,11 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
255
255
  });
256
256
  },
257
257
  provideLinkedEditingRanges(document, position) {
258
- return worker(document, (htmlDocument) => {
258
+ return worker(document, htmlDocument => {
259
259
  const ranges = htmlLs.findLinkedEditingRanges(document, position, htmlDocument);
260
- if (!ranges)
260
+ if (!ranges) {
261
261
  return;
262
+ }
262
263
  return { ranges };
263
264
  });
264
265
  },
@@ -302,11 +303,13 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
302
303
  return doc;
303
304
  }
304
305
  async function worker(document, callback) {
305
- if (!matchDocument(documentSelector, document))
306
+ if (!matchDocument(documentSelector, document)) {
306
307
  return;
308
+ }
307
309
  const htmlDocument = getHtmlDocument(document);
308
- if (!htmlDocument)
310
+ if (!htmlDocument) {
309
311
  return;
312
+ }
310
313
  await (initializing ??= initialize());
311
314
  return callback(htmlDocument);
312
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-html",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Integrate vscode-languageservice-html into Volar",
5
5
  "homepage": "https://github.com/volarjs/services/tree/master/packages/html",
6
6
  "bugs": "https://github.com/volarjs/services/issues",
@@ -32,12 +32,12 @@
32
32
  "@types/node": "latest"
33
33
  },
34
34
  "peerDependencies": {
35
- "@volar/language-service": "~2.1.0"
35
+ "@volar/language-service": "~2.2.0-alpha.0"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "@volar/language-service": {
39
39
  "optional": true
40
40
  }
41
41
  },
42
- "gitHead": "d04c9ea5f5b58c5e0b6db9a65a8aba1a5a2ed9ef"
42
+ "gitHead": "cbd8ef0ada6eae9656286535599c9b289134d1e3"
43
43
  }