vscode-css-languageservice 5.4.1 → 6.0.1
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.
- package/CHANGELOG.md +5 -1
- package/README.md +1 -0
- package/lib/esm/beautify/beautify-css.js +50 -8
- package/lib/esm/cssLanguageService.d.ts +37 -37
- package/lib/esm/cssLanguageService.js +72 -75
- package/lib/esm/cssLanguageTypes.d.ts +238 -238
- package/lib/esm/cssLanguageTypes.js +42 -42
- package/lib/esm/data/webCustomData.js +21959 -21965
- package/lib/esm/languageFacts/builtinData.js +142 -142
- package/lib/esm/languageFacts/colors.js +469 -472
- package/lib/esm/languageFacts/dataManager.js +88 -92
- package/lib/esm/languageFacts/dataProvider.js +73 -79
- package/lib/esm/languageFacts/entry.js +137 -138
- package/lib/esm/languageFacts/facts.js +8 -8
- package/lib/esm/parser/cssErrors.js +48 -50
- package/lib/esm/parser/cssNodes.js +1502 -2019
- package/lib/esm/parser/cssParser.js +1534 -1566
- package/lib/esm/parser/cssScanner.js +592 -599
- package/lib/esm/parser/cssSymbolScope.js +311 -341
- package/lib/esm/parser/lessParser.js +714 -740
- package/lib/esm/parser/lessScanner.js +57 -78
- package/lib/esm/parser/scssErrors.js +18 -20
- package/lib/esm/parser/scssParser.js +796 -818
- package/lib/esm/parser/scssScanner.js +95 -116
- package/lib/esm/services/cssCodeActions.js +77 -81
- package/lib/esm/services/cssCompletion.js +1054 -1149
- package/lib/esm/services/cssFolding.js +190 -193
- package/lib/esm/services/cssFormatter.js +136 -136
- package/lib/esm/services/cssHover.js +148 -151
- package/lib/esm/services/cssNavigation.js +378 -470
- package/lib/esm/services/cssSelectionRange.js +47 -47
- package/lib/esm/services/cssValidation.js +41 -44
- package/lib/esm/services/lessCompletion.js +378 -397
- package/lib/esm/services/lint.js +518 -532
- package/lib/esm/services/lintRules.js +76 -83
- package/lib/esm/services/lintUtil.js +196 -205
- package/lib/esm/services/pathCompletion.js +157 -231
- package/lib/esm/services/scssCompletion.js +354 -378
- package/lib/esm/services/scssNavigation.js +82 -154
- package/lib/esm/services/selectorPrinting.js +492 -536
- package/lib/esm/utils/arrays.js +40 -46
- package/lib/esm/utils/objects.js +11 -11
- package/lib/esm/utils/resources.js +11 -24
- package/lib/esm/utils/strings.js +102 -104
- package/lib/umd/beautify/beautify-css.js +50 -8
- package/lib/umd/cssLanguageService.d.ts +37 -37
- package/lib/umd/cssLanguageService.js +99 -102
- package/lib/umd/cssLanguageTypes.d.ts +238 -238
- package/lib/umd/cssLanguageTypes.js +89 -88
- package/lib/umd/data/webCustomData.js +21972 -21978
- package/lib/umd/languageFacts/builtinData.js +154 -154
- package/lib/umd/languageFacts/colors.js +492 -495
- package/lib/umd/languageFacts/dataManager.js +101 -104
- package/lib/umd/languageFacts/dataProvider.js +86 -91
- package/lib/umd/languageFacts/entry.js +152 -153
- package/lib/umd/languageFacts/facts.js +29 -29
- package/lib/umd/parser/cssErrors.js +61 -62
- package/lib/umd/parser/cssNodes.js +1587 -2034
- package/lib/umd/parser/cssParser.js +1547 -1578
- package/lib/umd/parser/cssScanner.js +606 -611
- package/lib/umd/parser/cssSymbolScope.js +328 -353
- package/lib/umd/parser/lessParser.js +727 -752
- package/lib/umd/parser/lessScanner.js +70 -90
- package/lib/umd/parser/scssErrors.js +31 -32
- package/lib/umd/parser/scssParser.js +809 -830
- package/lib/umd/parser/scssScanner.js +108 -128
- package/lib/umd/services/cssCodeActions.js +90 -93
- package/lib/umd/services/cssCompletion.js +1067 -1161
- package/lib/umd/services/cssFolding.js +203 -206
- package/lib/umd/services/cssFormatter.js +150 -150
- package/lib/umd/services/cssHover.js +161 -163
- package/lib/umd/services/cssNavigation.js +391 -482
- package/lib/umd/services/cssSelectionRange.js +60 -60
- package/lib/umd/services/cssValidation.js +54 -56
- package/lib/umd/services/lessCompletion.js +391 -409
- package/lib/umd/services/lint.js +531 -544
- package/lib/umd/services/lintRules.js +91 -95
- package/lib/umd/services/lintUtil.js +210 -218
- package/lib/umd/services/pathCompletion.js +171 -244
- package/lib/umd/services/scssCompletion.js +367 -390
- package/lib/umd/services/scssNavigation.js +95 -166
- package/lib/umd/services/selectorPrinting.js +510 -550
- package/lib/umd/utils/arrays.js +55 -61
- package/lib/umd/utils/objects.js +25 -25
- package/lib/umd/utils/resources.js +26 -39
- package/lib/umd/utils/strings.js +120 -122
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
6.0.0 / 2022-05-18
|
|
4
|
+
================
|
|
5
|
+
* Update to `vscode-languageserver-types@3.17`
|
|
6
|
+
|
|
2
7
|
5.4.0 / 2022-04-01
|
|
3
8
|
==================
|
|
4
9
|
* new formatter settings: `braceStyle`, `preserveNewLines`, `maxPreserveNewLines`, `wrapLineLength`, `indentEmptyLines`
|
|
5
10
|
|
|
6
|
-
|
|
7
11
|
5.3.0 / 2022-03-23
|
|
8
12
|
==================
|
|
9
13
|
* renamed `CSSFormatConfiguration.selectorSeparatorNewline` to `CSSFormatConfiguration.newlineBetweenSelectors`
|
package/README.md
CHANGED
|
@@ -52,6 +52,7 @@ How can I run and debug the service?
|
|
|
52
52
|
How can I run and debug the service inside an instance of VSCode?
|
|
53
53
|
|
|
54
54
|
- run VSCode out of sources setup as described here: https://github.com/Microsoft/vscode/wiki/How-to-Contribute
|
|
55
|
+
- run `yarn link` in the folder of `vscode-css-languageservice`
|
|
55
56
|
- use `yarn link vscode-css-languageservice` in `vscode/extensions/css-language-features/server` to run VSCode with the latest changes from `vscode-css-languageservice`
|
|
56
57
|
- run VSCode out of source (`vscode/scripts/code.sh|bat`) and open a `.css` file
|
|
57
58
|
- in VSCode window that is open on the `vscode-css-languageservice` sources, run command `Debug: Attach to Node process` and pick the `code-oss` process with the `css-language-features` path
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// copied from js-beautify/js/lib/beautify-css.js
|
|
2
|
-
// version: 1.14.
|
|
2
|
+
// version: 1.14.3
|
|
3
3
|
/* AUTO-GENERATED. DO NOT MODIFY. */
|
|
4
4
|
/*
|
|
5
5
|
|
|
@@ -1089,6 +1089,9 @@ function Beautifier(source_text, options) {
|
|
|
1089
1089
|
"@supports": true,
|
|
1090
1090
|
"@document": true
|
|
1091
1091
|
};
|
|
1092
|
+
this.NON_SEMICOLON_NEWLINE_PROPERTY = [
|
|
1093
|
+
"grid-template"
|
|
1094
|
+
];
|
|
1092
1095
|
|
|
1093
1096
|
}
|
|
1094
1097
|
|
|
@@ -1213,7 +1216,9 @@ Beautifier.prototype.beautify = function() {
|
|
|
1213
1216
|
var enteringConditionalGroup = false;
|
|
1214
1217
|
var insideAtExtend = false;
|
|
1215
1218
|
var insideAtImport = false;
|
|
1219
|
+
var insideScssMap = false;
|
|
1216
1220
|
var topCharacter = this._ch;
|
|
1221
|
+
var insideNonSemiColonValues = false;
|
|
1217
1222
|
var whitespace;
|
|
1218
1223
|
var isAfterSpace;
|
|
1219
1224
|
var previous_ch;
|
|
@@ -1265,7 +1270,7 @@ Beautifier.prototype.beautify = function() {
|
|
|
1265
1270
|
|
|
1266
1271
|
// Ensures any new lines following the comment are preserved
|
|
1267
1272
|
this.eatWhitespace(true);
|
|
1268
|
-
} else if (this._ch === '@') {
|
|
1273
|
+
} else if (this._ch === '@' || this._ch === '$') {
|
|
1269
1274
|
this.preserveSingleSpace(isAfterSpace);
|
|
1270
1275
|
|
|
1271
1276
|
// deal with less propery mixins @{...}
|
|
@@ -1336,7 +1341,12 @@ Beautifier.prototype.beautify = function() {
|
|
|
1336
1341
|
this.indent();
|
|
1337
1342
|
this._output.set_indent(this._indentLevel);
|
|
1338
1343
|
} else {
|
|
1339
|
-
|
|
1344
|
+
// inside mixin and first param is object
|
|
1345
|
+
if (previous_ch === '(') {
|
|
1346
|
+
this._output.space_before_token = false;
|
|
1347
|
+
} else if (previous_ch !== ',') {
|
|
1348
|
+
this.indent();
|
|
1349
|
+
}
|
|
1340
1350
|
this.print_string(this._ch);
|
|
1341
1351
|
}
|
|
1342
1352
|
|
|
@@ -1368,7 +1378,21 @@ Beautifier.prototype.beautify = function() {
|
|
|
1368
1378
|
this._output.add_new_line(true);
|
|
1369
1379
|
}
|
|
1370
1380
|
}
|
|
1381
|
+
if (this._input.peek() === ')') {
|
|
1382
|
+
this._output.trim(true);
|
|
1383
|
+
if (this._options.brace_style === "expand") {
|
|
1384
|
+
this._output.add_new_line(true);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1371
1387
|
} else if (this._ch === ":") {
|
|
1388
|
+
|
|
1389
|
+
for (var i = 0; i < this.NON_SEMICOLON_NEWLINE_PROPERTY.length; i++) {
|
|
1390
|
+
if (this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[i])) {
|
|
1391
|
+
insideNonSemiColonValues = true;
|
|
1392
|
+
break;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1372
1396
|
if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
|
|
1373
1397
|
// 'property: value' delimiter
|
|
1374
1398
|
// which could be in a conditional group query
|
|
@@ -1401,6 +1425,7 @@ Beautifier.prototype.beautify = function() {
|
|
|
1401
1425
|
this.print_string(this._ch + this.eatString(this._ch));
|
|
1402
1426
|
this.eatWhitespace(true);
|
|
1403
1427
|
} else if (this._ch === ';') {
|
|
1428
|
+
insideNonSemiColonValues = false;
|
|
1404
1429
|
if (parenLevel === 0) {
|
|
1405
1430
|
if (insidePropertyValue) {
|
|
1406
1431
|
this.outdent();
|
|
@@ -1442,20 +1467,32 @@ Beautifier.prototype.beautify = function() {
|
|
|
1442
1467
|
} else {
|
|
1443
1468
|
this.preserveSingleSpace(isAfterSpace);
|
|
1444
1469
|
this.print_string(this._ch);
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
this.
|
|
1470
|
+
|
|
1471
|
+
// handle scss/sass map
|
|
1472
|
+
if (insidePropertyValue && previous_ch === "$" && this._options.selector_separator_newline) {
|
|
1473
|
+
this._output.add_new_line();
|
|
1474
|
+
insideScssMap = true;
|
|
1475
|
+
} else {
|
|
1476
|
+
this.eatWhitespace();
|
|
1477
|
+
parenLevel++;
|
|
1478
|
+
this.indent();
|
|
1479
|
+
}
|
|
1448
1480
|
}
|
|
1449
1481
|
} else if (this._ch === ')') {
|
|
1450
1482
|
if (parenLevel) {
|
|
1451
1483
|
parenLevel--;
|
|
1452
1484
|
this.outdent();
|
|
1453
1485
|
}
|
|
1486
|
+
if (insideScssMap && this._input.peek() === ";" && this._options.selector_separator_newline) {
|
|
1487
|
+
insideScssMap = false;
|
|
1488
|
+
this.outdent();
|
|
1489
|
+
this._output.add_new_line();
|
|
1490
|
+
}
|
|
1454
1491
|
this.print_string(this._ch);
|
|
1455
1492
|
} else if (this._ch === ',') {
|
|
1456
1493
|
this.print_string(this._ch);
|
|
1457
1494
|
this.eatWhitespace(true);
|
|
1458
|
-
if (this._options.selector_separator_newline && !insidePropertyValue && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
|
|
1495
|
+
if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
|
|
1459
1496
|
this._output.add_new_line();
|
|
1460
1497
|
} else {
|
|
1461
1498
|
this._output.space_before_token = true;
|
|
@@ -1489,8 +1526,13 @@ Beautifier.prototype.beautify = function() {
|
|
|
1489
1526
|
this.print_string(' ');
|
|
1490
1527
|
this.print_string(this._ch);
|
|
1491
1528
|
} else {
|
|
1492
|
-
|
|
1529
|
+
var preserveAfterSpace = previous_ch === '"' || previous_ch === '\'';
|
|
1530
|
+
this.preserveSingleSpace(preserveAfterSpace || isAfterSpace);
|
|
1493
1531
|
this.print_string(this._ch);
|
|
1532
|
+
|
|
1533
|
+
if (!this._output.just_added_newline() && this._input.peek() === '\n' && insideNonSemiColonValues) {
|
|
1534
|
+
this._output.add_new_line();
|
|
1535
|
+
}
|
|
1494
1536
|
}
|
|
1495
1537
|
}
|
|
1496
1538
|
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1, HoverSettings, CompletionSettings, TextEdit, CSSFormatConfiguration } from './cssLanguageTypes';
|
|
2
|
-
export declare type Stylesheet = {};
|
|
3
|
-
export * from './cssLanguageTypes';
|
|
4
|
-
export interface LanguageService {
|
|
5
|
-
configure(raw?: LanguageSettings): void;
|
|
6
|
-
setDataProviders(useDefaultDataProvider: boolean, customDataProviders: ICSSDataProvider[]): void;
|
|
7
|
-
doValidation(document: TextDocument, stylesheet: Stylesheet, documentSettings?: LanguageSettings): Diagnostic[];
|
|
8
|
-
parseStylesheet(document: TextDocument): Stylesheet;
|
|
9
|
-
doComplete(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: CompletionSettings): CompletionList;
|
|
10
|
-
doComplete2(document: TextDocument, position: Position, stylesheet: Stylesheet, documentContext: DocumentContext, settings?: CompletionSettings): Promise<CompletionList>;
|
|
11
|
-
setCompletionParticipants(registeredCompletionParticipants: ICompletionParticipant[]): void;
|
|
12
|
-
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: HoverSettings): Hover | null;
|
|
13
|
-
findDefinition(document: TextDocument, position: Position, stylesheet: Stylesheet): Location | null;
|
|
14
|
-
findReferences(document: TextDocument, position: Position, stylesheet: Stylesheet): Location[];
|
|
15
|
-
findDocumentHighlights(document: TextDocument, position: Position, stylesheet: Stylesheet): DocumentHighlight[];
|
|
16
|
-
findDocumentLinks(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): DocumentLink[];
|
|
17
|
-
/**
|
|
18
|
-
* Return statically resolved links, and dynamically resolved links if `fsProvider` is proved.
|
|
19
|
-
*/
|
|
20
|
-
findDocumentLinks2(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): Promise<DocumentLink[]>;
|
|
21
|
-
findDocumentSymbols(document: TextDocument, stylesheet: Stylesheet): SymbolInformation[];
|
|
22
|
-
doCodeActions(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): Command[];
|
|
23
|
-
doCodeActions2(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): CodeAction[];
|
|
24
|
-
findDocumentColors(document: TextDocument, stylesheet: Stylesheet): ColorInformation[];
|
|
25
|
-
getColorPresentations(document: TextDocument, stylesheet: Stylesheet, color: Color, range: Range): ColorPresentation[];
|
|
26
|
-
doRename(document: TextDocument, position: Position, newName: string, stylesheet: Stylesheet): WorkspaceEdit;
|
|
27
|
-
getFoldingRanges(document: TextDocument, context?: {
|
|
28
|
-
rangeLimit?: number;
|
|
29
|
-
}): FoldingRange[];
|
|
30
|
-
getSelectionRanges(document: TextDocument, positions: Position[], stylesheet: Stylesheet): SelectionRange[];
|
|
31
|
-
format(document: TextDocument, range: Range | undefined, options: CSSFormatConfiguration): TextEdit[];
|
|
32
|
-
}
|
|
33
|
-
export declare function getDefaultCSSDataProvider(): ICSSDataProvider;
|
|
34
|
-
export declare function newCSSDataProvider(data: CSSDataV1): ICSSDataProvider;
|
|
35
|
-
export declare function getCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
36
|
-
export declare function getSCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
37
|
-
export declare function getLESSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
1
|
+
import { LanguageSettings, ICompletionParticipant, DocumentContext, LanguageServiceOptions, Diagnostic, Position, CompletionList, Hover, Location, DocumentHighlight, DocumentLink, SymbolInformation, Range, CodeActionContext, Command, CodeAction, ColorInformation, Color, ColorPresentation, WorkspaceEdit, FoldingRange, SelectionRange, TextDocument, ICSSDataProvider, CSSDataV1, HoverSettings, CompletionSettings, TextEdit, CSSFormatConfiguration } from './cssLanguageTypes';
|
|
2
|
+
export declare type Stylesheet = {};
|
|
3
|
+
export * from './cssLanguageTypes';
|
|
4
|
+
export interface LanguageService {
|
|
5
|
+
configure(raw?: LanguageSettings): void;
|
|
6
|
+
setDataProviders(useDefaultDataProvider: boolean, customDataProviders: ICSSDataProvider[]): void;
|
|
7
|
+
doValidation(document: TextDocument, stylesheet: Stylesheet, documentSettings?: LanguageSettings): Diagnostic[];
|
|
8
|
+
parseStylesheet(document: TextDocument): Stylesheet;
|
|
9
|
+
doComplete(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: CompletionSettings): CompletionList;
|
|
10
|
+
doComplete2(document: TextDocument, position: Position, stylesheet: Stylesheet, documentContext: DocumentContext, settings?: CompletionSettings): Promise<CompletionList>;
|
|
11
|
+
setCompletionParticipants(registeredCompletionParticipants: ICompletionParticipant[]): void;
|
|
12
|
+
doHover(document: TextDocument, position: Position, stylesheet: Stylesheet, settings?: HoverSettings): Hover | null;
|
|
13
|
+
findDefinition(document: TextDocument, position: Position, stylesheet: Stylesheet): Location | null;
|
|
14
|
+
findReferences(document: TextDocument, position: Position, stylesheet: Stylesheet): Location[];
|
|
15
|
+
findDocumentHighlights(document: TextDocument, position: Position, stylesheet: Stylesheet): DocumentHighlight[];
|
|
16
|
+
findDocumentLinks(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): DocumentLink[];
|
|
17
|
+
/**
|
|
18
|
+
* Return statically resolved links, and dynamically resolved links if `fsProvider` is proved.
|
|
19
|
+
*/
|
|
20
|
+
findDocumentLinks2(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): Promise<DocumentLink[]>;
|
|
21
|
+
findDocumentSymbols(document: TextDocument, stylesheet: Stylesheet): SymbolInformation[];
|
|
22
|
+
doCodeActions(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): Command[];
|
|
23
|
+
doCodeActions2(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): CodeAction[];
|
|
24
|
+
findDocumentColors(document: TextDocument, stylesheet: Stylesheet): ColorInformation[];
|
|
25
|
+
getColorPresentations(document: TextDocument, stylesheet: Stylesheet, color: Color, range: Range): ColorPresentation[];
|
|
26
|
+
doRename(document: TextDocument, position: Position, newName: string, stylesheet: Stylesheet): WorkspaceEdit;
|
|
27
|
+
getFoldingRanges(document: TextDocument, context?: {
|
|
28
|
+
rangeLimit?: number;
|
|
29
|
+
}): FoldingRange[];
|
|
30
|
+
getSelectionRanges(document: TextDocument, positions: Position[], stylesheet: Stylesheet): SelectionRange[];
|
|
31
|
+
format(document: TextDocument, range: Range | undefined, options: CSSFormatConfiguration): TextEdit[];
|
|
32
|
+
}
|
|
33
|
+
export declare function getDefaultCSSDataProvider(): ICSSDataProvider;
|
|
34
|
+
export declare function newCSSDataProvider(data: CSSDataV1): ICSSDataProvider;
|
|
35
|
+
export declare function getCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
36
|
+
export declare function getSCSSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
37
|
+
export declare function getLESSLanguageService(options?: LanguageServiceOptions): LanguageService;
|
|
@@ -1,75 +1,72 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
'use strict';
|
|
6
|
-
import { Parser } from './parser/cssParser';
|
|
7
|
-
import { CSSCompletion } from './services/cssCompletion';
|
|
8
|
-
import { CSSHover } from './services/cssHover';
|
|
9
|
-
import { CSSNavigation } from './services/cssNavigation';
|
|
10
|
-
import { CSSCodeActions } from './services/cssCodeActions';
|
|
11
|
-
import { CSSValidation } from './services/cssValidation';
|
|
12
|
-
import { SCSSParser } from './parser/scssParser';
|
|
13
|
-
import { SCSSCompletion } from './services/scssCompletion';
|
|
14
|
-
import { LESSParser } from './parser/lessParser';
|
|
15
|
-
import { LESSCompletion } from './services/lessCompletion';
|
|
16
|
-
import { getFoldingRanges } from './services/cssFolding';
|
|
17
|
-
import { format } from './services/cssFormatter';
|
|
18
|
-
import { CSSDataManager } from './languageFacts/dataManager';
|
|
19
|
-
import { CSSDataProvider } from './languageFacts/dataProvider';
|
|
20
|
-
import { getSelectionRanges } from './services/cssSelectionRange';
|
|
21
|
-
import { SCSSNavigation } from './services/scssNavigation';
|
|
22
|
-
import { cssData } from './data/webCustomData';
|
|
23
|
-
export * from './cssLanguageTypes';
|
|
24
|
-
export function getDefaultCSSDataProvider() {
|
|
25
|
-
return newCSSDataProvider(cssData);
|
|
26
|
-
}
|
|
27
|
-
export function newCSSDataProvider(data) {
|
|
28
|
-
return new CSSDataProvider(data);
|
|
29
|
-
}
|
|
30
|
-
function createFacade(parser, completion, hover, navigation, codeActions, validation, cssDataManager) {
|
|
31
|
-
return {
|
|
32
|
-
configure:
|
|
33
|
-
validation.configure(settings);
|
|
34
|
-
completion.configure(settings
|
|
35
|
-
hover.configure(settings
|
|
36
|
-
},
|
|
37
|
-
setDataProviders: cssDataManager.setDataProviders.bind(cssDataManager),
|
|
38
|
-
doValidation: validation.doValidation.bind(validation),
|
|
39
|
-
parseStylesheet: parser.parseStylesheet.bind(parser),
|
|
40
|
-
doComplete: completion.doComplete.bind(completion),
|
|
41
|
-
doComplete2: completion.doComplete2.bind(completion),
|
|
42
|
-
setCompletionParticipants: completion.setCompletionParticipants.bind(completion),
|
|
43
|
-
doHover: hover.doHover.bind(hover),
|
|
44
|
-
format
|
|
45
|
-
findDefinition: navigation.findDefinition.bind(navigation),
|
|
46
|
-
findReferences: navigation.findReferences.bind(navigation),
|
|
47
|
-
findDocumentHighlights: navigation.findDocumentHighlights.bind(navigation),
|
|
48
|
-
findDocumentLinks: navigation.findDocumentLinks.bind(navigation),
|
|
49
|
-
findDocumentLinks2: navigation.findDocumentLinks2.bind(navigation),
|
|
50
|
-
findDocumentSymbols: navigation.findDocumentSymbols.bind(navigation),
|
|
51
|
-
doCodeActions: codeActions.doCodeActions.bind(codeActions),
|
|
52
|
-
doCodeActions2: codeActions.doCodeActions2.bind(codeActions),
|
|
53
|
-
findDocumentColors: navigation.findDocumentColors.bind(navigation),
|
|
54
|
-
getColorPresentations: navigation.getColorPresentations.bind(navigation),
|
|
55
|
-
doRename: navigation.doRename.bind(navigation),
|
|
56
|
-
getFoldingRanges
|
|
57
|
-
getSelectionRanges
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function getCSSLanguageService(options) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var cssDataManager = new CSSDataManager(options);
|
|
74
|
-
return createFacade(new LESSParser(), new LESSCompletion(options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider, true), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
75
|
-
}
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
'use strict';
|
|
6
|
+
import { Parser } from './parser/cssParser';
|
|
7
|
+
import { CSSCompletion } from './services/cssCompletion';
|
|
8
|
+
import { CSSHover } from './services/cssHover';
|
|
9
|
+
import { CSSNavigation } from './services/cssNavigation';
|
|
10
|
+
import { CSSCodeActions } from './services/cssCodeActions';
|
|
11
|
+
import { CSSValidation } from './services/cssValidation';
|
|
12
|
+
import { SCSSParser } from './parser/scssParser';
|
|
13
|
+
import { SCSSCompletion } from './services/scssCompletion';
|
|
14
|
+
import { LESSParser } from './parser/lessParser';
|
|
15
|
+
import { LESSCompletion } from './services/lessCompletion';
|
|
16
|
+
import { getFoldingRanges } from './services/cssFolding';
|
|
17
|
+
import { format } from './services/cssFormatter';
|
|
18
|
+
import { CSSDataManager } from './languageFacts/dataManager';
|
|
19
|
+
import { CSSDataProvider } from './languageFacts/dataProvider';
|
|
20
|
+
import { getSelectionRanges } from './services/cssSelectionRange';
|
|
21
|
+
import { SCSSNavigation } from './services/scssNavigation';
|
|
22
|
+
import { cssData } from './data/webCustomData';
|
|
23
|
+
export * from './cssLanguageTypes';
|
|
24
|
+
export function getDefaultCSSDataProvider() {
|
|
25
|
+
return newCSSDataProvider(cssData);
|
|
26
|
+
}
|
|
27
|
+
export function newCSSDataProvider(data) {
|
|
28
|
+
return new CSSDataProvider(data);
|
|
29
|
+
}
|
|
30
|
+
function createFacade(parser, completion, hover, navigation, codeActions, validation, cssDataManager) {
|
|
31
|
+
return {
|
|
32
|
+
configure: (settings) => {
|
|
33
|
+
validation.configure(settings);
|
|
34
|
+
completion.configure(settings?.completion);
|
|
35
|
+
hover.configure(settings?.hover);
|
|
36
|
+
},
|
|
37
|
+
setDataProviders: cssDataManager.setDataProviders.bind(cssDataManager),
|
|
38
|
+
doValidation: validation.doValidation.bind(validation),
|
|
39
|
+
parseStylesheet: parser.parseStylesheet.bind(parser),
|
|
40
|
+
doComplete: completion.doComplete.bind(completion),
|
|
41
|
+
doComplete2: completion.doComplete2.bind(completion),
|
|
42
|
+
setCompletionParticipants: completion.setCompletionParticipants.bind(completion),
|
|
43
|
+
doHover: hover.doHover.bind(hover),
|
|
44
|
+
format,
|
|
45
|
+
findDefinition: navigation.findDefinition.bind(navigation),
|
|
46
|
+
findReferences: navigation.findReferences.bind(navigation),
|
|
47
|
+
findDocumentHighlights: navigation.findDocumentHighlights.bind(navigation),
|
|
48
|
+
findDocumentLinks: navigation.findDocumentLinks.bind(navigation),
|
|
49
|
+
findDocumentLinks2: navigation.findDocumentLinks2.bind(navigation),
|
|
50
|
+
findDocumentSymbols: navigation.findDocumentSymbols.bind(navigation),
|
|
51
|
+
doCodeActions: codeActions.doCodeActions.bind(codeActions),
|
|
52
|
+
doCodeActions2: codeActions.doCodeActions2.bind(codeActions),
|
|
53
|
+
findDocumentColors: navigation.findDocumentColors.bind(navigation),
|
|
54
|
+
getColorPresentations: navigation.getColorPresentations.bind(navigation),
|
|
55
|
+
doRename: navigation.doRename.bind(navigation),
|
|
56
|
+
getFoldingRanges,
|
|
57
|
+
getSelectionRanges
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const defaultLanguageServiceOptions = {};
|
|
61
|
+
export function getCSSLanguageService(options = defaultLanguageServiceOptions) {
|
|
62
|
+
const cssDataManager = new CSSDataManager(options);
|
|
63
|
+
return createFacade(new Parser(), new CSSCompletion(null, options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider, false), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
64
|
+
}
|
|
65
|
+
export function getSCSSLanguageService(options = defaultLanguageServiceOptions) {
|
|
66
|
+
const cssDataManager = new CSSDataManager(options);
|
|
67
|
+
return createFacade(new SCSSParser(), new SCSSCompletion(options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new SCSSNavigation(options && options.fileSystemProvider), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
68
|
+
}
|
|
69
|
+
export function getLESSLanguageService(options = defaultLanguageServiceOptions) {
|
|
70
|
+
const cssDataManager = new CSSDataManager(options);
|
|
71
|
+
return createFacade(new LESSParser(), new LESSCompletion(options, cssDataManager), new CSSHover(options && options.clientCapabilities, cssDataManager), new CSSNavigation(options && options.fileSystemProvider, true), new CSSCodeActions(cssDataManager), new CSSValidation(cssDataManager), cssDataManager);
|
|
72
|
+
}
|