volar-service-prettier 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 +5 -5
  2. package/index.js +2 -1
  3. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import type { DocumentSelector, FormattingOptions, Result, ServiceContext, ServicePlugin, TextDocument } from '@volar/language-service';
1
+ import type { DocumentSelector, FormattingOptions, ProviderResult, ServiceContext, LanguageServicePlugin, TextDocument } from '@volar/language-service';
2
2
  import type { Options } from 'prettier';
3
3
  export declare function create(
4
4
  /**
5
5
  * Prettier instance or getter to use.
6
6
  */
7
- prettierInstanceOrGetter: typeof import('prettier') | ((context: ServiceContext) => Result<typeof import('prettier') | undefined>), { html, documentSelector, isFormattingEnabled, getFormattingOptions, }?: {
7
+ prettierInstanceOrGetter: typeof import('prettier') | ((context: ServiceContext) => ProviderResult<typeof import('prettier') | undefined>), { html, documentSelector, isFormattingEnabled, getFormattingOptions, }?: {
8
8
  html?: {
9
9
  /**
10
10
  * Preprocessing to break "contents" from "HTML tags".
@@ -20,7 +20,7 @@ prettierInstanceOrGetter: typeof import('prettier') | ((context: ServiceContext)
20
20
  * ['html', 'css', 'scss', 'typescript', 'javascript']
21
21
  */
22
22
  documentSelector?: DocumentSelector;
23
- isFormattingEnabled?(prettier: typeof import('prettier'), document: TextDocument, context: ServiceContext): Result<boolean>;
24
- getFormattingOptions?(prettier: typeof import('prettier'), document: TextDocument, formatOptions: FormattingOptions, context: ServiceContext): Result<Options>;
25
- }): ServicePlugin;
23
+ isFormattingEnabled?(prettier: typeof import('prettier'), document: TextDocument, context: ServiceContext): ProviderResult<boolean>;
24
+ getFormattingOptions?(prettier: typeof import('prettier'), document: TextDocument, formatOptions: FormattingOptions, context: ServiceContext): ProviderResult<Options>;
25
+ }): LanguageServicePlugin;
26
26
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -43,7 +43,8 @@ prettierInstanceOrGetter, { html, documentSelector = ['html', 'css', 'scss', 'ty
43
43
  if (!prettier) {
44
44
  return;
45
45
  }
46
- if (!isFormattingEnabled(prettier, document, context)) {
46
+ const hasFormattingEnabled = await isFormattingEnabled(prettier, document, context);
47
+ if (!hasFormattingEnabled) {
47
48
  return;
48
49
  }
49
50
  const fullText = document.getText();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-prettier",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Integrate Prettier into Volar",
5
5
  "homepage": "https://github.com/volarjs/services/tree/master/packages/prettier",
6
6
  "bugs": "https://github.com/volarjs/services/issues",
@@ -32,7 +32,7 @@
32
32
  "prettier": "^3.0.3"
33
33
  },
34
34
  "peerDependencies": {
35
- "@volar/language-service": "~2.1.0",
35
+ "@volar/language-service": "~2.2.0-alpha.0",
36
36
  "prettier": "^2.2 || ^3.0"
37
37
  },
38
38
  "peerDependenciesMeta": {
@@ -43,5 +43,5 @@
43
43
  "optional": true
44
44
  }
45
45
  },
46
- "gitHead": "d04c9ea5f5b58c5e0b6db9a65a8aba1a5a2ed9ef"
46
+ "gitHead": "cbd8ef0ada6eae9656286535599c9b289134d1e3"
47
47
  }