vscode-css-languageservice 6.3.10 → 7.0.0-next.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/esm/beautify/beautify-css.js +1437 -1606
  3. package/lib/esm/cssLanguageService.d.ts +2 -2
  4. package/lib/esm/cssLanguageService.js +18 -18
  5. package/lib/esm/languageFacts/colors.js +1 -1
  6. package/lib/esm/languageFacts/dataManager.js +3 -3
  7. package/lib/esm/languageFacts/entry.js +1 -1
  8. package/lib/esm/languageFacts/facts.js +3 -3
  9. package/lib/esm/parser/cssNodes.js +1 -1
  10. package/lib/esm/parser/cssParser.js +5 -5
  11. package/lib/esm/parser/cssSymbolScope.js +2 -2
  12. package/lib/esm/parser/lessParser.js +5 -5
  13. package/lib/esm/parser/lessScanner.js +1 -1
  14. package/lib/esm/parser/scssParser.js +6 -6
  15. package/lib/esm/parser/scssScanner.js +1 -1
  16. package/lib/esm/services/cssCodeActions.js +4 -4
  17. package/lib/esm/services/cssCompletion.js +7 -7
  18. package/lib/esm/services/cssFolding.js +3 -3
  19. package/lib/esm/services/cssFormatter.js +3 -3
  20. package/lib/esm/services/cssHover.js +6 -6
  21. package/lib/esm/services/cssNavigation.js +6 -6
  22. package/lib/esm/services/cssSelectionRange.js +2 -2
  23. package/lib/esm/services/cssValidation.js +4 -4
  24. package/lib/esm/services/lessCompletion.js +2 -2
  25. package/lib/esm/services/lint.js +5 -5
  26. package/lib/esm/services/lintRules.js +1 -1
  27. package/lib/esm/services/lintUtil.js +1 -1
  28. package/lib/esm/services/pathCompletion.js +3 -3
  29. package/lib/esm/services/scssCompletion.js +3 -3
  30. package/lib/esm/services/scssNavigation.js +4 -4
  31. package/lib/esm/services/selectorPrinting.js +3 -3
  32. package/package.json +15 -15
  33. package/lib/umd/beautify/beautify-css.js +0 -1695
  34. package/lib/umd/cssLanguageService.d.ts +0 -39
  35. package/lib/umd/cssLanguageService.js +0 -105
  36. package/lib/umd/cssLanguageTypes.d.ts +0 -267
  37. package/lib/umd/cssLanguageTypes.js +0 -89
  38. package/lib/umd/data/webCustomData.js +0 -44613
  39. package/lib/umd/languageFacts/builtinData.js +0 -155
  40. package/lib/umd/languageFacts/colors.js +0 -949
  41. package/lib/umd/languageFacts/dataManager.js +0 -101
  42. package/lib/umd/languageFacts/dataProvider.js +0 -86
  43. package/lib/umd/languageFacts/entry.js +0 -217
  44. package/lib/umd/languageFacts/facts.js +0 -33
  45. package/lib/umd/parser/cssErrors.js +0 -61
  46. package/lib/umd/parser/cssNodes.js +0 -1676
  47. package/lib/umd/parser/cssParser.js +0 -2035
  48. package/lib/umd/parser/cssScanner.js +0 -619
  49. package/lib/umd/parser/cssSymbolScope.js +0 -328
  50. package/lib/umd/parser/lessParser.js +0 -732
  51. package/lib/umd/parser/lessScanner.js +0 -70
  52. package/lib/umd/parser/scssErrors.js +0 -30
  53. package/lib/umd/parser/scssParser.js +0 -874
  54. package/lib/umd/parser/scssScanner.js +0 -108
  55. package/lib/umd/services/cssCodeActions.js +0 -89
  56. package/lib/umd/services/cssCompletion.js +0 -1109
  57. package/lib/umd/services/cssFolding.js +0 -202
  58. package/lib/umd/services/cssFormatter.js +0 -149
  59. package/lib/umd/services/cssHover.js +0 -174
  60. package/lib/umd/services/cssNavigation.js +0 -539
  61. package/lib/umd/services/cssSelectionRange.js +0 -59
  62. package/lib/umd/services/cssValidation.js +0 -54
  63. package/lib/umd/services/lessCompletion.js +0 -390
  64. package/lib/umd/services/lint.js +0 -577
  65. package/lib/umd/services/lintRules.js +0 -90
  66. package/lib/umd/services/lintUtil.js +0 -210
  67. package/lib/umd/services/pathCompletion.js +0 -171
  68. package/lib/umd/services/scssCompletion.js +0 -367
  69. package/lib/umd/services/scssNavigation.js +0 -169
  70. package/lib/umd/services/selectorPrinting.js +0 -575
  71. package/lib/umd/utils/arrays.js +0 -54
  72. package/lib/umd/utils/objects.js +0 -24
  73. package/lib/umd/utils/resources.js +0 -25
  74. package/lib/umd/utils/strings.js +0 -123
@@ -1,108 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./cssScanner"], factory);
8
- }
9
- })(function (require, exports) {
10
- /*---------------------------------------------------------------------------------------------
11
- * Copyright (c) Microsoft Corporation. All rights reserved.
12
- * Licensed under the MIT License. See License.txt in the project root for license information.
13
- *--------------------------------------------------------------------------------------------*/
14
- 'use strict';
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.SCSSScanner = exports.Module = exports.Ellipsis = exports.SmallerEqualsOperator = exports.GreaterEqualsOperator = exports.NotEqualsOperator = exports.EqualsOperator = exports.Default = exports.InterpolationFunction = exports.VariableName = void 0;
17
- const cssScanner_1 = require("./cssScanner");
18
- const _FSL = '/'.charCodeAt(0);
19
- const _NWL = '\n'.charCodeAt(0);
20
- const _CAR = '\r'.charCodeAt(0);
21
- const _LFD = '\f'.charCodeAt(0);
22
- const _DLR = '$'.charCodeAt(0);
23
- const _HSH = '#'.charCodeAt(0);
24
- const _CUL = '{'.charCodeAt(0);
25
- const _EQS = '='.charCodeAt(0);
26
- const _BNG = '!'.charCodeAt(0);
27
- const _LAN = '<'.charCodeAt(0);
28
- const _RAN = '>'.charCodeAt(0);
29
- const _DOT = '.'.charCodeAt(0);
30
- const _ATS = '@'.charCodeAt(0);
31
- let customTokenValue = cssScanner_1.TokenType.CustomToken;
32
- exports.VariableName = customTokenValue++;
33
- exports.InterpolationFunction = customTokenValue++;
34
- exports.Default = customTokenValue++;
35
- exports.EqualsOperator = customTokenValue++;
36
- exports.NotEqualsOperator = customTokenValue++;
37
- exports.GreaterEqualsOperator = customTokenValue++;
38
- exports.SmallerEqualsOperator = customTokenValue++;
39
- exports.Ellipsis = customTokenValue++;
40
- exports.Module = customTokenValue++;
41
- class SCSSScanner extends cssScanner_1.Scanner {
42
- scanNext(offset) {
43
- // scss variable
44
- if (this.stream.advanceIfChar(_DLR)) {
45
- const content = ['$'];
46
- if (this.ident(content)) {
47
- return this.finishToken(offset, exports.VariableName, content.join(''));
48
- }
49
- else {
50
- this.stream.goBackTo(offset);
51
- }
52
- }
53
- // scss: interpolation function #{..})
54
- if (this.stream.advanceIfChars([_HSH, _CUL])) {
55
- return this.finishToken(offset, exports.InterpolationFunction);
56
- }
57
- // operator ==
58
- if (this.stream.advanceIfChars([_EQS, _EQS])) {
59
- return this.finishToken(offset, exports.EqualsOperator);
60
- }
61
- // operator !=
62
- if (this.stream.advanceIfChars([_BNG, _EQS])) {
63
- return this.finishToken(offset, exports.NotEqualsOperator);
64
- }
65
- // operators <, <=
66
- if (this.stream.advanceIfChar(_LAN)) {
67
- if (this.stream.advanceIfChar(_EQS)) {
68
- return this.finishToken(offset, exports.SmallerEqualsOperator);
69
- }
70
- return this.finishToken(offset, cssScanner_1.TokenType.Delim);
71
- }
72
- // ooperators >, >=
73
- if (this.stream.advanceIfChar(_RAN)) {
74
- if (this.stream.advanceIfChar(_EQS)) {
75
- return this.finishToken(offset, exports.GreaterEqualsOperator);
76
- }
77
- return this.finishToken(offset, cssScanner_1.TokenType.Delim);
78
- }
79
- // ellipis
80
- if (this.stream.advanceIfChars([_DOT, _DOT, _DOT])) {
81
- return this.finishToken(offset, exports.Ellipsis);
82
- }
83
- return super.scanNext(offset);
84
- }
85
- comment() {
86
- if (super.comment()) {
87
- return true;
88
- }
89
- if (!this.inURL && this.stream.advanceIfChars([_FSL, _FSL])) {
90
- this.stream.advanceWhileChar((ch) => {
91
- switch (ch) {
92
- case _NWL:
93
- case _CAR:
94
- case _LFD:
95
- return false;
96
- default:
97
- return true;
98
- }
99
- });
100
- return true;
101
- }
102
- else {
103
- return false;
104
- }
105
- }
106
- }
107
- exports.SCSSScanner = SCSSScanner;
108
- });
@@ -1,89 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../parser/cssNodes", "../utils/strings", "../services/lintRules", "../cssLanguageTypes", "@vscode/l10n"], factory);
8
- }
9
- })(function (require, exports) {
10
- /*---------------------------------------------------------------------------------------------
11
- * Copyright (c) Microsoft Corporation. All rights reserved.
12
- * Licensed under the MIT License. See License.txt in the project root for license information.
13
- *--------------------------------------------------------------------------------------------*/
14
- 'use strict';
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.CSSCodeActions = void 0;
17
- const nodes = require("../parser/cssNodes");
18
- const strings_1 = require("../utils/strings");
19
- const lintRules_1 = require("../services/lintRules");
20
- const cssLanguageTypes_1 = require("../cssLanguageTypes");
21
- const l10n = require("@vscode/l10n");
22
- class CSSCodeActions {
23
- constructor(cssDataManager) {
24
- this.cssDataManager = cssDataManager;
25
- }
26
- doCodeActions(document, range, context, stylesheet) {
27
- return this.doCodeActions2(document, range, context, stylesheet).map(ca => {
28
- const textDocumentEdit = ca.edit && ca.edit.documentChanges && ca.edit.documentChanges[0];
29
- return cssLanguageTypes_1.Command.create(ca.title, '_css.applyCodeAction', document.uri, document.version, textDocumentEdit && textDocumentEdit.edits);
30
- });
31
- }
32
- doCodeActions2(document, range, context, stylesheet) {
33
- const result = [];
34
- if (context.diagnostics) {
35
- for (const diagnostic of context.diagnostics) {
36
- this.appendFixesForMarker(document, stylesheet, diagnostic, result);
37
- }
38
- }
39
- return result;
40
- }
41
- getFixesForUnknownProperty(document, property, marker, result) {
42
- const propertyName = property.getName();
43
- const candidates = [];
44
- this.cssDataManager.getProperties().forEach(p => {
45
- const score = (0, strings_1.difference)(propertyName, p.name);
46
- if (score >= propertyName.length / 2 /*score_lim*/) {
47
- candidates.push({ property: p.name, score });
48
- }
49
- });
50
- // Sort in descending order.
51
- candidates.sort((a, b) => {
52
- return b.score - a.score || a.property.localeCompare(b.property);
53
- });
54
- let maxActions = 3;
55
- for (const candidate of candidates) {
56
- const propertyName = candidate.property;
57
- const title = l10n.t("Rename to '{0}'", propertyName);
58
- const edit = cssLanguageTypes_1.TextEdit.replace(marker.range, propertyName);
59
- const documentIdentifier = cssLanguageTypes_1.VersionedTextDocumentIdentifier.create(document.uri, document.version);
60
- const workspaceEdit = { documentChanges: [cssLanguageTypes_1.TextDocumentEdit.create(documentIdentifier, [edit])] };
61
- const codeAction = cssLanguageTypes_1.CodeAction.create(title, workspaceEdit, cssLanguageTypes_1.CodeActionKind.QuickFix);
62
- codeAction.diagnostics = [marker];
63
- result.push(codeAction);
64
- if (--maxActions <= 0) {
65
- return;
66
- }
67
- }
68
- }
69
- appendFixesForMarker(document, stylesheet, marker, result) {
70
- if (marker.code !== lintRules_1.Rules.UnknownProperty.id) {
71
- return;
72
- }
73
- const offset = document.offsetAt(marker.range.start);
74
- const end = document.offsetAt(marker.range.end);
75
- const nodepath = nodes.getNodePath(stylesheet, offset);
76
- for (let i = nodepath.length - 1; i >= 0; i--) {
77
- const node = nodepath[i];
78
- if (node instanceof nodes.Declaration) {
79
- const property = node.getProperty();
80
- if (property && property.offset === offset && property.end === end) {
81
- this.getFixesForUnknownProperty(document, property, marker, result);
82
- return;
83
- }
84
- }
85
- }
86
- }
87
- }
88
- exports.CSSCodeActions = CSSCodeActions;
89
- });