dot-language-support 2.0.0 → 2.0.5

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.
@@ -1,6 +1,6 @@
1
1
  import type * as lst from "vscode-languageserver-types";
2
+ import type { ColorInformation, Color, ColorPresentation } from "vscode-languageserver-types";
2
3
  import type { TextDocument } from "vscode-languageserver-textdocument";
3
- import { ColorInformation, Color, ColorPresentation } from "./polyfill.js";
4
4
  import { SourceFile, Omit } from "../types.js";
5
5
  export interface DocumentLike {
6
6
  positionAt(offset: number): lst.Position;
@@ -1,6 +1,5 @@
1
- import type * as lst from "vscode-languageserver-types";
2
- import { ColorInformation, Color, ColorPresentation } from "./polyfill.js";
1
+ import type { ColorInformation, ColorPresentation, Range, Color } from "vscode-languageserver-types";
3
2
  import { SourceFile } from "../types.js";
4
3
  import { DocumentLike } from "../index.js";
5
4
  export declare function getDocumentColors(doc: DocumentLike, sourceFile: SourceFile): ColorInformation[] | undefined;
6
- export declare function getColorRepresentations(_doc: DocumentLike, _sourceFile: SourceFile, color: Color, range: lst.Range): ColorPresentation[] | undefined;
5
+ export declare function getColorRepresentations(_doc: DocumentLike, _sourceFile: SourceFile, color: Color, range: Range): ColorPresentation[] | undefined;
@@ -8,14 +8,9 @@ export function getDocumentColors(doc, sourceFile) {
8
8
  : undefined;
9
9
  }
10
10
  export function getColorRepresentations(_doc, _sourceFile, color, range) {
11
- if (!color || !range)
12
- return undefined;
13
- const hexColor = getColorStringFromColor(color);
14
- return [
15
- {
16
- label: '"' + hexColor + '"',
17
- }
18
- ];
11
+ return !color || !range
12
+ ? undefined
13
+ : [{ label: '"' + getColorStringFromColor(color) + '"', }];
19
14
  }
20
15
  function colorTableToColorInformation(doc, sf, colors) {
21
16
  if (!colors || colors.size === 0)
@@ -37,7 +32,7 @@ function colorTableToColorInformation(doc, sf, colors) {
37
32
  function getColorFromName(name) {
38
33
  if (name.charAt(0) === "#")
39
34
  return getHexCodeColor(name);
40
- const colorAlias = colorMap[name];
35
+ const colorAlias = colorMap[name.toLowerCase()];
41
36
  return colorAlias
42
37
  ? getHexCodeColor(colorAlias)
43
38
  : undefined;