vscode-css-languageservice 5.4.2 → 6.1.0

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 (83) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/SECURITY.md +41 -0
  3. package/lib/esm/beautify/beautify-css.js +11 -4
  4. package/lib/esm/cssLanguageService.d.ts +2 -1
  5. package/lib/esm/cssLanguageService.js +15 -17
  6. package/lib/esm/cssLanguageTypes.js +2 -2
  7. package/lib/esm/data/webCustomData.js +356 -232
  8. package/lib/esm/languageFacts/builtinData.js +15 -15
  9. package/lib/esm/languageFacts/colors.js +66 -69
  10. package/lib/esm/languageFacts/dataManager.js +38 -42
  11. package/lib/esm/languageFacts/dataProvider.js +17 -23
  12. package/lib/esm/languageFacts/entry.js +22 -23
  13. package/lib/esm/parser/cssErrors.js +5 -7
  14. package/lib/esm/parser/cssNodes.js +869 -1377
  15. package/lib/esm/parser/cssParser.js +419 -376
  16. package/lib/esm/parser/cssScanner.js +168 -175
  17. package/lib/esm/parser/cssSymbolScope.js +107 -137
  18. package/lib/esm/parser/lessParser.js +177 -202
  19. package/lib/esm/parser/lessScanner.js +22 -43
  20. package/lib/esm/parser/scssErrors.js +5 -7
  21. package/lib/esm/parser/scssParser.js +196 -208
  22. package/lib/esm/parser/scssScanner.js +33 -54
  23. package/lib/esm/services/cssCodeActions.js +36 -40
  24. package/lib/esm/services/cssCompletion.js +300 -395
  25. package/lib/esm/services/cssFolding.js +32 -35
  26. package/lib/esm/services/cssFormatter.js +22 -22
  27. package/lib/esm/services/cssHover.js +30 -33
  28. package/lib/esm/services/cssNavigation.js +260 -289
  29. package/lib/esm/services/cssSelectionRange.js +6 -6
  30. package/lib/esm/services/cssValidation.js +13 -16
  31. package/lib/esm/services/lessCompletion.js +351 -370
  32. package/lib/esm/services/lint.js +161 -175
  33. package/lib/esm/services/lintRules.js +20 -27
  34. package/lib/esm/services/lintUtil.js +19 -28
  35. package/lib/esm/services/pathCompletion.js +84 -158
  36. package/lib/esm/services/scssCompletion.js +283 -307
  37. package/lib/esm/services/scssNavigation.js +65 -137
  38. package/lib/esm/services/selectorPrinting.js +131 -175
  39. package/lib/esm/utils/arrays.js +6 -12
  40. package/lib/esm/utils/objects.js +1 -1
  41. package/lib/esm/utils/resources.js +3 -16
  42. package/lib/esm/utils/strings.js +10 -12
  43. package/lib/umd/beautify/beautify-css.js +11 -4
  44. package/lib/umd/cssLanguageService.d.ts +2 -1
  45. package/lib/umd/cssLanguageService.js +34 -32
  46. package/lib/umd/cssLanguageTypes.js +4 -3
  47. package/lib/umd/data/webCustomData.js +355 -231
  48. package/lib/umd/languageFacts/colors.js +65 -68
  49. package/lib/umd/languageFacts/dataManager.js +41 -44
  50. package/lib/umd/languageFacts/dataProvider.js +17 -22
  51. package/lib/umd/languageFacts/entry.js +22 -23
  52. package/lib/umd/languageFacts/facts.js +5 -1
  53. package/lib/umd/parser/cssErrors.js +5 -6
  54. package/lib/umd/parser/cssNodes.js +870 -1307
  55. package/lib/umd/parser/cssParser.js +424 -380
  56. package/lib/umd/parser/cssScanner.js +168 -173
  57. package/lib/umd/parser/cssSymbolScope.js +109 -134
  58. package/lib/umd/parser/lessParser.js +182 -206
  59. package/lib/umd/parser/lessScanner.js +22 -42
  60. package/lib/umd/parser/scssErrors.js +5 -6
  61. package/lib/umd/parser/scssParser.js +202 -213
  62. package/lib/umd/parser/scssScanner.js +25 -45
  63. package/lib/umd/services/cssCodeActions.js +41 -44
  64. package/lib/umd/services/cssCompletion.js +308 -402
  65. package/lib/umd/services/cssFolding.js +35 -38
  66. package/lib/umd/services/cssFormatter.js +25 -25
  67. package/lib/umd/services/cssHover.js +36 -38
  68. package/lib/umd/services/cssNavigation.js +267 -295
  69. package/lib/umd/services/cssSelectionRange.js +8 -8
  70. package/lib/umd/services/cssValidation.js +17 -19
  71. package/lib/umd/services/lessCompletion.js +354 -372
  72. package/lib/umd/services/lint.js +167 -180
  73. package/lib/umd/services/lintRules.js +20 -24
  74. package/lib/umd/services/lintUtil.js +20 -28
  75. package/lib/umd/services/pathCompletion.js +87 -160
  76. package/lib/umd/services/scssCompletion.js +287 -310
  77. package/lib/umd/services/scssNavigation.js +69 -140
  78. package/lib/umd/services/selectorPrinting.js +134 -174
  79. package/lib/umd/utils/arrays.js +6 -12
  80. package/lib/umd/utils/objects.js +1 -1
  81. package/lib/umd/utils/resources.js +4 -17
  82. package/lib/umd/utils/strings.js +10 -12
  83. package/package.json +16 -15
package/CHANGELOG.md CHANGED
@@ -1,9 +1,15 @@
1
+ 6.1.0 / 2022-09-02
2
+ ================
3
+ * new API `LanguageService.findDocumentSymbols2`, returning `DocumentSymbol[]`
4
+
5
+ 6.0.0 / 2022-05-18
6
+ ================
7
+ * Update to `vscode-languageserver-types@3.17`
1
8
 
2
9
  5.4.0 / 2022-04-01
3
10
  ==================
4
11
  * new formatter settings: `braceStyle`, `preserveNewLines`, `maxPreserveNewLines`, `wrapLineLength`, `indentEmptyLines`
5
12
 
6
-
7
13
  5.3.0 / 2022-03-23
8
14
  ==================
9
15
  * renamed `CSSFormatConfiguration.selectorSeparatorNewline` to `CSSFormatConfiguration.newlineBetweenSelectors`
package/SECURITY.md ADDED
@@ -0,0 +1,41 @@
1
+ <!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
2
+
3
+ ## Security
4
+
5
+ Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6
+
7
+ If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8
+
9
+ ## Reporting Security Issues
10
+
11
+ **Please do not report security vulnerabilities through public GitHub issues.**
12
+
13
+ Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14
+
15
+ If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16
+
17
+ You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18
+
19
+ Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20
+
21
+ * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22
+ * Full paths of source file(s) related to the manifestation of the issue
23
+ * The location of the affected source code (tag/branch/commit or direct URL)
24
+ * Any special configuration required to reproduce the issue
25
+ * Step-by-step instructions to reproduce the issue
26
+ * Proof-of-concept or exploit code (if possible)
27
+ * Impact of the issue, including how an attacker might exploit the issue
28
+
29
+ This information will help us triage your report more quickly.
30
+
31
+ If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32
+
33
+ ## Preferred Languages
34
+
35
+ We prefer all communications to be in English.
36
+
37
+ ## Policy
38
+
39
+ Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40
+
41
+ <!-- END MICROSOFT SECURITY.MD BLOCK -->
@@ -1,5 +1,5 @@
1
1
  // copied from js-beautify/js/lib/beautify-css.js
2
- // version: 1.14.3
2
+ // version: 1.14.6
3
3
  /* AUTO-GENERATED. DO NOT MODIFY. */
4
4
  /*
5
5
 
@@ -1090,6 +1090,7 @@ function Beautifier(source_text, options) {
1090
1090
  "@document": true
1091
1091
  };
1092
1092
  this.NON_SEMICOLON_NEWLINE_PROPERTY = [
1093
+ "grid-template-areas",
1093
1094
  "grid-template"
1094
1095
  ];
1095
1096
 
@@ -1421,7 +1422,8 @@ Beautifier.prototype.beautify = function() {
1421
1422
  }
1422
1423
  }
1423
1424
  } else if (this._ch === '"' || this._ch === '\'') {
1424
- this.preserveSingleSpace(isAfterSpace);
1425
+ var preserveQuoteSpace = previous_ch === '"' || previous_ch === '\'';
1426
+ this.preserveSingleSpace(preserveQuoteSpace || isAfterSpace);
1425
1427
  this.print_string(this._ch + this.eatString(this._ch));
1426
1428
  this.eatWhitespace(true);
1427
1429
  } else if (this._ch === ';') {
@@ -1465,7 +1467,12 @@ Beautifier.prototype.beautify = function() {
1465
1467
  }
1466
1468
  }
1467
1469
  } else {
1468
- this.preserveSingleSpace(isAfterSpace);
1470
+ var space_needed = false;
1471
+ if (this._input.lookBack("with")) {
1472
+ // look back is not an accurate solution, we need tokens to confirm without whitespaces
1473
+ space_needed = true;
1474
+ }
1475
+ this.preserveSingleSpace(isAfterSpace || space_needed);
1469
1476
  this.print_string(this._ch);
1470
1477
 
1471
1478
  // handle scss/sass map
@@ -1523,7 +1530,7 @@ Beautifier.prototype.beautify = function() {
1523
1530
  this._ch = '';
1524
1531
  }
1525
1532
  } else if (this._ch === '!' && !this._input.lookBack("\\")) { // !important
1526
- this.print_string(' ');
1533
+ this._output.space_before_token = true;
1527
1534
  this.print_string(this._ch);
1528
1535
  } else {
1529
1536
  var preserveAfterSpace = previous_ch === '"' || previous_ch === '\'';
@@ -1,4 +1,4 @@
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';
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, DocumentSymbol } from './cssLanguageTypes';
2
2
  export declare type Stylesheet = {};
3
3
  export * from './cssLanguageTypes';
4
4
  export interface LanguageService {
@@ -19,6 +19,7 @@ export interface LanguageService {
19
19
  */
20
20
  findDocumentLinks2(document: TextDocument, stylesheet: Stylesheet, documentContext: DocumentContext): Promise<DocumentLink[]>;
21
21
  findDocumentSymbols(document: TextDocument, stylesheet: Stylesheet): SymbolInformation[];
22
+ findDocumentSymbols2(document: TextDocument, stylesheet: Stylesheet): DocumentSymbol[];
22
23
  doCodeActions(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): Command[];
23
24
  doCodeActions2(document: TextDocument, range: Range, context: CodeActionContext, stylesheet: Stylesheet): CodeAction[];
24
25
  findDocumentColors(document: TextDocument, stylesheet: Stylesheet): ColorInformation[];
@@ -29,10 +29,10 @@ export function newCSSDataProvider(data) {
29
29
  }
30
30
  function createFacade(parser, completion, hover, navigation, codeActions, validation, cssDataManager) {
31
31
  return {
32
- configure: function (settings) {
32
+ configure: (settings) => {
33
33
  validation.configure(settings);
34
- completion.configure(settings === null || settings === void 0 ? void 0 : settings.completion);
35
- hover.configure(settings === null || settings === void 0 ? void 0 : settings.hover);
34
+ completion.configure(settings?.completion);
35
+ hover.configure(settings?.hover);
36
36
  },
37
37
  setDataProviders: cssDataManager.setDataProviders.bind(cssDataManager),
38
38
  doValidation: validation.doValidation.bind(validation),
@@ -41,35 +41,33 @@ function createFacade(parser, completion, hover, navigation, codeActions, valida
41
41
  doComplete2: completion.doComplete2.bind(completion),
42
42
  setCompletionParticipants: completion.setCompletionParticipants.bind(completion),
43
43
  doHover: hover.doHover.bind(hover),
44
- format: format,
44
+ format,
45
45
  findDefinition: navigation.findDefinition.bind(navigation),
46
46
  findReferences: navigation.findReferences.bind(navigation),
47
47
  findDocumentHighlights: navigation.findDocumentHighlights.bind(navigation),
48
48
  findDocumentLinks: navigation.findDocumentLinks.bind(navigation),
49
49
  findDocumentLinks2: navigation.findDocumentLinks2.bind(navigation),
50
- findDocumentSymbols: navigation.findDocumentSymbols.bind(navigation),
50
+ findDocumentSymbols: navigation.findSymbolInformations.bind(navigation),
51
+ findDocumentSymbols2: navigation.findDocumentSymbols.bind(navigation),
51
52
  doCodeActions: codeActions.doCodeActions.bind(codeActions),
52
53
  doCodeActions2: codeActions.doCodeActions2.bind(codeActions),
53
54
  findDocumentColors: navigation.findDocumentColors.bind(navigation),
54
55
  getColorPresentations: navigation.getColorPresentations.bind(navigation),
55
56
  doRename: navigation.doRename.bind(navigation),
56
- getFoldingRanges: getFoldingRanges,
57
- getSelectionRanges: getSelectionRanges
57
+ getFoldingRanges,
58
+ getSelectionRanges
58
59
  };
59
60
  }
60
- var defaultLanguageServiceOptions = {};
61
- export function getCSSLanguageService(options) {
62
- if (options === void 0) { options = defaultLanguageServiceOptions; }
63
- var cssDataManager = new CSSDataManager(options);
61
+ const defaultLanguageServiceOptions = {};
62
+ export function getCSSLanguageService(options = defaultLanguageServiceOptions) {
63
+ const cssDataManager = new CSSDataManager(options);
64
64
  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);
65
65
  }
66
- export function getSCSSLanguageService(options) {
67
- if (options === void 0) { options = defaultLanguageServiceOptions; }
68
- var cssDataManager = new CSSDataManager(options);
66
+ export function getSCSSLanguageService(options = defaultLanguageServiceOptions) {
67
+ const cssDataManager = new CSSDataManager(options);
69
68
  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);
70
69
  }
71
- export function getLESSLanguageService(options) {
72
- if (options === void 0) { options = defaultLanguageServiceOptions; }
73
- var cssDataManager = new CSSDataManager(options);
70
+ export function getLESSLanguageService(options = defaultLanguageServiceOptions) {
71
+ const cssDataManager = new CSSDataManager(options);
74
72
  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
73
  }
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  'use strict';
6
- import { Range, Position, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind } from 'vscode-languageserver-types';
6
+ import { Range, Position, DocumentUri, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind } from 'vscode-languageserver-types';
7
7
  import { TextDocument } from 'vscode-languageserver-textdocument';
8
- export { TextDocument, Range, Position, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind };
8
+ export { TextDocument, Range, Position, DocumentUri, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind };
9
9
  export var ClientCapabilities;
10
10
  (function (ClientCapabilities) {
11
11
  ClientCapabilities.LATEST = {