volar-service-css 0.0.31 → 0.0.33

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 +3 -3
  2. package/index.js +6 -7
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import type { Disposable, DocumentSelector, Result, ServiceContext, ServicePlugin } from '@volar/language-service';
1
+ import type { Disposable, DocumentSelector, FormattingOptions, Result, ServiceContext, ServicePlugin } from '@volar/language-service';
2
2
  import * as css from 'vscode-css-languageservice';
3
3
  import { TextDocument } from 'vscode-languageserver-textdocument';
4
4
  export interface Provide {
5
5
  'css/stylesheet': (document: TextDocument, ls: css.LanguageService) => css.Stylesheet;
6
6
  'css/languageService': (document: TextDocument) => css.LanguageService | undefined;
7
7
  }
8
- export declare function create({ cssDocumentSelector, scssDocumentSelector, lessDocumentSelector, useDefaultDataProvider, getDocumentContext, isFormattingEnabled, getFormatConfiguration, getLanguageSettings, getCustomData, onDidChangeCustomData, }?: {
8
+ export declare function create({ cssDocumentSelector, scssDocumentSelector, lessDocumentSelector, useDefaultDataProvider, getDocumentContext, isFormattingEnabled, getFormattingOptions, getLanguageSettings, getCustomData, onDidChangeCustomData, }?: {
9
9
  cssDocumentSelector?: DocumentSelector;
10
10
  scssDocumentSelector?: DocumentSelector;
11
11
  lessDocumentSelector?: DocumentSelector;
12
12
  useDefaultDataProvider?: boolean;
13
13
  getDocumentContext?(context: ServiceContext): css.DocumentContext;
14
14
  isFormattingEnabled?(document: TextDocument, context: ServiceContext): Result<boolean>;
15
- getFormatConfiguration?(document: TextDocument, context: ServiceContext): Result<css.CSSFormatConfiguration | undefined>;
15
+ getFormattingOptions?(document: TextDocument, options: FormattingOptions, context: ServiceContext): Result<css.CSSFormatConfiguration>;
16
16
  getLanguageSettings?(document: TextDocument, context: ServiceContext): Result<css.LanguageSettings | undefined>;
17
17
  getCustomData?(context: ServiceContext): Result<css.ICSSDataProvider[]>;
18
18
  onDidChangeCustomData?(listener: () => void, context: ServiceContext): Disposable;
package/index.js CHANGED
@@ -25,8 +25,11 @@ function create({ cssDocumentSelector = ['css'], scssDocumentSelector = ['scss']
25
25
  };
26
26
  }, isFormattingEnabled = async (document, context) => {
27
27
  return await context.env.getConfiguration?.(document.languageId + '.format.enable') ?? true;
28
- }, getFormatConfiguration = async (document, context) => {
29
- return await context.env.getConfiguration?.(document.languageId + '.format');
28
+ }, getFormattingOptions = async (document, options, context) => {
29
+ return {
30
+ ...options,
31
+ ...await context.env.getConfiguration?.(document.languageId + '.format'),
32
+ };
30
33
  }, getLanguageSettings = async (document, context) => {
31
34
  return await context.env.getConfiguration?.(document.languageId);
32
35
  }, getCustomData = async (context) => {
@@ -170,11 +173,7 @@ function create({ cssDocumentSelector = ['css'], scssDocumentSelector = ['scss']
170
173
  if (!await isFormattingEnabled(document, context)) {
171
174
  return;
172
175
  }
173
- const formatSettings = await getFormatConfiguration(document, context);
174
- const formatOptions = {
175
- ...options,
176
- ...formatSettings,
177
- };
176
+ const formatOptions = await getFormattingOptions(document, options, context);
178
177
  let formatDocument = document;
179
178
  let prefixes = [];
180
179
  let suffixes = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-css",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "description": "Integrate vscode-css-languageservice into Volar",
5
5
  "homepage": "https://github.com/volarjs/services/tree/master/packages/css",
6
6
  "bugs": "https://github.com/volarjs/services/issues",
@@ -39,5 +39,5 @@
39
39
  "optional": true
40
40
  }
41
41
  },
42
- "gitHead": "f7005aef724767786ee9fe943fa976231cc79bf1"
42
+ "gitHead": "d04c9ea5f5b58c5e0b6db9a65a8aba1a5a2ed9ef"
43
43
  }