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.
- package/CHANGELOG.md +7 -1
- package/SECURITY.md +41 -0
- package/lib/esm/beautify/beautify-css.js +11 -4
- package/lib/esm/cssLanguageService.d.ts +2 -1
- package/lib/esm/cssLanguageService.js +15 -17
- package/lib/esm/cssLanguageTypes.js +2 -2
- package/lib/esm/data/webCustomData.js +356 -232
- package/lib/esm/languageFacts/builtinData.js +15 -15
- package/lib/esm/languageFacts/colors.js +66 -69
- package/lib/esm/languageFacts/dataManager.js +38 -42
- package/lib/esm/languageFacts/dataProvider.js +17 -23
- package/lib/esm/languageFacts/entry.js +22 -23
- package/lib/esm/parser/cssErrors.js +5 -7
- package/lib/esm/parser/cssNodes.js +869 -1377
- package/lib/esm/parser/cssParser.js +419 -376
- package/lib/esm/parser/cssScanner.js +168 -175
- package/lib/esm/parser/cssSymbolScope.js +107 -137
- package/lib/esm/parser/lessParser.js +177 -202
- package/lib/esm/parser/lessScanner.js +22 -43
- package/lib/esm/parser/scssErrors.js +5 -7
- package/lib/esm/parser/scssParser.js +196 -208
- package/lib/esm/parser/scssScanner.js +33 -54
- package/lib/esm/services/cssCodeActions.js +36 -40
- package/lib/esm/services/cssCompletion.js +300 -395
- package/lib/esm/services/cssFolding.js +32 -35
- package/lib/esm/services/cssFormatter.js +22 -22
- package/lib/esm/services/cssHover.js +30 -33
- package/lib/esm/services/cssNavigation.js +260 -289
- package/lib/esm/services/cssSelectionRange.js +6 -6
- package/lib/esm/services/cssValidation.js +13 -16
- package/lib/esm/services/lessCompletion.js +351 -370
- package/lib/esm/services/lint.js +161 -175
- package/lib/esm/services/lintRules.js +20 -27
- package/lib/esm/services/lintUtil.js +19 -28
- package/lib/esm/services/pathCompletion.js +84 -158
- package/lib/esm/services/scssCompletion.js +283 -307
- package/lib/esm/services/scssNavigation.js +65 -137
- package/lib/esm/services/selectorPrinting.js +131 -175
- package/lib/esm/utils/arrays.js +6 -12
- package/lib/esm/utils/objects.js +1 -1
- package/lib/esm/utils/resources.js +3 -16
- package/lib/esm/utils/strings.js +10 -12
- package/lib/umd/beautify/beautify-css.js +11 -4
- package/lib/umd/cssLanguageService.d.ts +2 -1
- package/lib/umd/cssLanguageService.js +34 -32
- package/lib/umd/cssLanguageTypes.js +4 -3
- package/lib/umd/data/webCustomData.js +355 -231
- package/lib/umd/languageFacts/colors.js +65 -68
- package/lib/umd/languageFacts/dataManager.js +41 -44
- package/lib/umd/languageFacts/dataProvider.js +17 -22
- package/lib/umd/languageFacts/entry.js +22 -23
- package/lib/umd/languageFacts/facts.js +5 -1
- package/lib/umd/parser/cssErrors.js +5 -6
- package/lib/umd/parser/cssNodes.js +870 -1307
- package/lib/umd/parser/cssParser.js +424 -380
- package/lib/umd/parser/cssScanner.js +168 -173
- package/lib/umd/parser/cssSymbolScope.js +109 -134
- package/lib/umd/parser/lessParser.js +182 -206
- package/lib/umd/parser/lessScanner.js +22 -42
- package/lib/umd/parser/scssErrors.js +5 -6
- package/lib/umd/parser/scssParser.js +202 -213
- package/lib/umd/parser/scssScanner.js +25 -45
- package/lib/umd/services/cssCodeActions.js +41 -44
- package/lib/umd/services/cssCompletion.js +308 -402
- package/lib/umd/services/cssFolding.js +35 -38
- package/lib/umd/services/cssFormatter.js +25 -25
- package/lib/umd/services/cssHover.js +36 -38
- package/lib/umd/services/cssNavigation.js +267 -295
- package/lib/umd/services/cssSelectionRange.js +8 -8
- package/lib/umd/services/cssValidation.js +17 -19
- package/lib/umd/services/lessCompletion.js +354 -372
- package/lib/umd/services/lint.js +167 -180
- package/lib/umd/services/lintRules.js +20 -24
- package/lib/umd/services/lintUtil.js +20 -28
- package/lib/umd/services/pathCompletion.js +87 -160
- package/lib/umd/services/scssCompletion.js +287 -310
- package/lib/umd/services/scssNavigation.js +69 -140
- package/lib/umd/services/selectorPrinting.js +134 -174
- package/lib/umd/utils/arrays.js +6 -12
- package/lib/umd/utils/objects.js +1 -1
- package/lib/umd/utils/resources.js +4 -17
- package/lib/umd/utils/strings.js +10 -12
- package/package.json +16 -15
|
@@ -7,7 +7,7 @@ import { TokenType, Scanner } from '../parser/cssScanner';
|
|
|
7
7
|
import { SCSSScanner, InterpolationFunction } from '../parser/scssScanner';
|
|
8
8
|
import { LESSScanner } from '../parser/lessScanner';
|
|
9
9
|
export function getFoldingRanges(document, context) {
|
|
10
|
-
|
|
10
|
+
const ranges = computeFoldingRanges(document);
|
|
11
11
|
return limitFoldingRanges(ranges, context);
|
|
12
12
|
}
|
|
13
13
|
function computeFoldingRanges(document) {
|
|
@@ -28,27 +28,27 @@ function computeFoldingRanges(document) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
function tokenToRange(t, kind) {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const startLine = getStartLine(t);
|
|
32
|
+
const endLine = getEndLine(t);
|
|
33
33
|
if (startLine !== endLine) {
|
|
34
34
|
return {
|
|
35
|
-
startLine
|
|
36
|
-
endLine
|
|
37
|
-
kind
|
|
35
|
+
startLine,
|
|
36
|
+
endLine,
|
|
37
|
+
kind
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const ranges = [];
|
|
45
|
+
const delimiterStack = [];
|
|
46
|
+
const scanner = getScanner();
|
|
47
47
|
scanner.ignoreComment = false;
|
|
48
48
|
scanner.setSource(document.getText());
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
let token = scanner.scan();
|
|
50
|
+
let prevToken = null;
|
|
51
|
+
while (token.type !== TokenType.EOF) {
|
|
52
52
|
switch (token.type) {
|
|
53
53
|
case TokenType.CurlyL:
|
|
54
54
|
case InterpolationFunction:
|
|
@@ -58,11 +58,11 @@ function computeFoldingRanges(document) {
|
|
|
58
58
|
}
|
|
59
59
|
case TokenType.CurlyR: {
|
|
60
60
|
if (delimiterStack.length !== 0) {
|
|
61
|
-
|
|
61
|
+
const prevDelimiter = popPrevStartDelimiterOfType(delimiterStack, 'brace');
|
|
62
62
|
if (!prevDelimiter) {
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
let endLine = getEndLine(token);
|
|
66
66
|
if (prevDelimiter.type === 'brace') {
|
|
67
67
|
/**
|
|
68
68
|
* Other than the case when curly brace is not on a new line by itself, for example
|
|
@@ -76,7 +76,7 @@ function computeFoldingRanges(document) {
|
|
|
76
76
|
if (prevDelimiter.line !== endLine) {
|
|
77
77
|
ranges.push({
|
|
78
78
|
startLine: prevDelimiter.line,
|
|
79
|
-
endLine
|
|
79
|
+
endLine,
|
|
80
80
|
kind: undefined
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -89,7 +89,7 @@ function computeFoldingRanges(document) {
|
|
|
89
89
|
* All comments are marked as `Comment`
|
|
90
90
|
*/
|
|
91
91
|
case TokenType.Comment: {
|
|
92
|
-
|
|
92
|
+
const commentRegionMarkerToDelimiter = (marker) => {
|
|
93
93
|
if (marker === '#region') {
|
|
94
94
|
return { line: getStartLine(token), type: 'comment', isStart: true };
|
|
95
95
|
}
|
|
@@ -97,20 +97,20 @@ function computeFoldingRanges(document) {
|
|
|
97
97
|
return { line: getEndLine(token), type: 'comment', isStart: false };
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const getCurrDelimiter = (token) => {
|
|
101
|
+
const matches = token.text.match(/^\s*\/\*\s*(#region|#endregion)\b\s*(.*?)\s*\*\//);
|
|
102
102
|
if (matches) {
|
|
103
|
-
return
|
|
103
|
+
return commentRegionMarkerToDelimiter(matches[1]);
|
|
104
104
|
}
|
|
105
105
|
else if (document.languageId === 'scss' || document.languageId === 'less') {
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
return
|
|
106
|
+
const matches = token.text.match(/^\s*\/\/\s*(#region|#endregion)\b\s*(.*?)\s*/);
|
|
107
|
+
if (matches) {
|
|
108
|
+
return commentRegionMarkerToDelimiter(matches[1]);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
return null;
|
|
112
112
|
};
|
|
113
|
-
|
|
113
|
+
const currDelimiter = getCurrDelimiter(token);
|
|
114
114
|
// /* */ comment region folding
|
|
115
115
|
// All #region and #endregion cases
|
|
116
116
|
if (currDelimiter) {
|
|
@@ -118,7 +118,7 @@ function computeFoldingRanges(document) {
|
|
|
118
118
|
delimiterStack.push(currDelimiter);
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
121
|
-
|
|
121
|
+
const prevDelimiter = popPrevStartDelimiterOfType(delimiterStack, 'comment');
|
|
122
122
|
if (!prevDelimiter) {
|
|
123
123
|
break;
|
|
124
124
|
}
|
|
@@ -135,7 +135,7 @@ function computeFoldingRanges(document) {
|
|
|
135
135
|
}
|
|
136
136
|
// Multiline comment case
|
|
137
137
|
else {
|
|
138
|
-
|
|
138
|
+
const range = tokenToRange(token, 'comment');
|
|
139
139
|
if (range) {
|
|
140
140
|
ranges.push(range);
|
|
141
141
|
}
|
|
@@ -145,9 +145,6 @@ function computeFoldingRanges(document) {
|
|
|
145
145
|
}
|
|
146
146
|
prevToken = token;
|
|
147
147
|
token = scanner.scan();
|
|
148
|
-
};
|
|
149
|
-
while (token.type !== TokenType.EOF) {
|
|
150
|
-
_loop_1();
|
|
151
148
|
}
|
|
152
149
|
return ranges;
|
|
153
150
|
}
|
|
@@ -155,7 +152,7 @@ function popPrevStartDelimiterOfType(stack, type) {
|
|
|
155
152
|
if (stack.length === 0) {
|
|
156
153
|
return null;
|
|
157
154
|
}
|
|
158
|
-
for (
|
|
155
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
159
156
|
if (stack[i].type === type && stack[i].isStart) {
|
|
160
157
|
return stack.splice(i, 1)[0];
|
|
161
158
|
}
|
|
@@ -168,17 +165,17 @@ function popPrevStartDelimiterOfType(stack, type) {
|
|
|
168
165
|
* - If limit exceeds, only return `rangeLimit` amount of ranges
|
|
169
166
|
*/
|
|
170
167
|
function limitFoldingRanges(ranges, context) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
const maxRanges = context && context.rangeLimit || Number.MAX_VALUE;
|
|
169
|
+
const sortedRanges = ranges.sort((r1, r2) => {
|
|
170
|
+
let diff = r1.startLine - r2.startLine;
|
|
174
171
|
if (diff === 0) {
|
|
175
172
|
diff = r1.endLine - r2.endLine;
|
|
176
173
|
}
|
|
177
174
|
return diff;
|
|
178
175
|
});
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
sortedRanges.forEach(
|
|
176
|
+
const validRanges = [];
|
|
177
|
+
let prevEndLine = -1;
|
|
178
|
+
sortedRanges.forEach(r => {
|
|
182
179
|
if (!(r.startLine < prevEndLine && prevEndLine < r.endLine)) {
|
|
183
180
|
validRanges.push(r);
|
|
184
181
|
prevEndLine = r.endLine;
|
|
@@ -6,15 +6,15 @@ import { Range, Position } from '../cssLanguageTypes';
|
|
|
6
6
|
import { css_beautify } from '../beautify/beautify-css';
|
|
7
7
|
import { repeat } from '../utils/strings';
|
|
8
8
|
export function format(document, range, options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
let value = document.getText();
|
|
10
|
+
let includesEnd = true;
|
|
11
|
+
let initialIndentLevel = 0;
|
|
12
|
+
let inRule = false;
|
|
13
|
+
const tabSize = options.tabSize || 4;
|
|
14
14
|
if (range) {
|
|
15
|
-
|
|
15
|
+
let startOffset = document.offsetAt(range.start);
|
|
16
16
|
// include all leading whitespace iff at the beginning of the line
|
|
17
|
-
|
|
17
|
+
let extendedStart = startOffset;
|
|
18
18
|
while (extendedStart > 0 && isWhitespace(value, extendedStart - 1)) {
|
|
19
19
|
extendedStart--;
|
|
20
20
|
}
|
|
@@ -28,8 +28,8 @@ export function format(document, range, options) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
// include all following whitespace until the end of the line
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
let endOffset = document.offsetAt(range.end);
|
|
32
|
+
let extendedEnd = endOffset;
|
|
33
33
|
while (extendedEnd < value.length && isWhitespace(value, extendedEnd)) {
|
|
34
34
|
extendedEnd++;
|
|
35
35
|
}
|
|
@@ -42,17 +42,17 @@ export function format(document, range, options) {
|
|
|
42
42
|
includesEnd = endOffset === value.length;
|
|
43
43
|
value = value.substring(startOffset, endOffset);
|
|
44
44
|
if (startOffset !== 0) {
|
|
45
|
-
|
|
45
|
+
const startOfLineOffset = document.offsetAt(Position.create(range.start.line, 0));
|
|
46
46
|
initialIndentLevel = computeIndentLevel(document.getText(), startOfLineOffset, options);
|
|
47
47
|
}
|
|
48
48
|
if (inRule) {
|
|
49
|
-
value =
|
|
49
|
+
value = `{\n${trimLeft(value)}`;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
range = Range.create(Position.create(0, 0), document.positionAt(value.length));
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
const cssOptions = {
|
|
56
56
|
indent_size: tabSize,
|
|
57
57
|
indent_char: options.insertSpaces ? ' ' : '\t',
|
|
58
58
|
end_with_newline: includesEnd && getFormatOption(options, 'insertFinalNewline', false),
|
|
@@ -66,12 +66,12 @@ export function format(document, range, options) {
|
|
|
66
66
|
wrap_line_length: getFormatOption(options, 'wrapLineLength', undefined),
|
|
67
67
|
eol: '\n'
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
let result = css_beautify(value, cssOptions);
|
|
70
70
|
if (inRule) {
|
|
71
71
|
result = trimLeft(result.substring(2));
|
|
72
72
|
}
|
|
73
73
|
if (initialIndentLevel > 0) {
|
|
74
|
-
|
|
74
|
+
const indent = options.insertSpaces ? repeat(' ', tabSize * initialIndentLevel) : repeat('\t', initialIndentLevel);
|
|
75
75
|
result = result.split('\n').join('\n' + indent);
|
|
76
76
|
if (range.start.character === 0) {
|
|
77
77
|
result = indent + result; // keep the indent
|
|
@@ -85,11 +85,11 @@ export function format(document, range, options) {
|
|
|
85
85
|
function trimLeft(str) {
|
|
86
86
|
return str.replace(/^\s+/, '');
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const _CUL = '{'.charCodeAt(0);
|
|
89
|
+
const _CUR = '}'.charCodeAt(0);
|
|
90
90
|
function isInRule(str, offset) {
|
|
91
91
|
while (offset >= 0) {
|
|
92
|
-
|
|
92
|
+
const ch = str.charCodeAt(offset);
|
|
93
93
|
if (ch === _CUL) {
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
@@ -102,7 +102,7 @@ function isInRule(str, offset) {
|
|
|
102
102
|
}
|
|
103
103
|
function getFormatOption(options, key, dflt) {
|
|
104
104
|
if (options && options.hasOwnProperty(key)) {
|
|
105
|
-
|
|
105
|
+
const value = options[key];
|
|
106
106
|
if (value !== null) {
|
|
107
107
|
return value;
|
|
108
108
|
}
|
|
@@ -110,11 +110,11 @@ function getFormatOption(options, key, dflt) {
|
|
|
110
110
|
return dflt;
|
|
111
111
|
}
|
|
112
112
|
function computeIndentLevel(content, offset, options) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
let i = offset;
|
|
114
|
+
let nChars = 0;
|
|
115
|
+
const tabSize = options.tabSize || 4;
|
|
116
116
|
while (i < content.length) {
|
|
117
|
-
|
|
117
|
+
const ch = content.charAt(i);
|
|
118
118
|
if (ch === ' ') {
|
|
119
119
|
nChars++;
|
|
120
120
|
}
|
|
@@ -9,29 +9,28 @@ import { SelectorPrinting } from './selectorPrinting';
|
|
|
9
9
|
import { startsWith } from '../utils/strings';
|
|
10
10
|
import { Range, MarkupKind } from '../cssLanguageTypes';
|
|
11
11
|
import { isDefined } from '../utils/objects';
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
export class CSSHover {
|
|
13
|
+
constructor(clientCapabilities, cssDataManager) {
|
|
14
14
|
this.clientCapabilities = clientCapabilities;
|
|
15
15
|
this.cssDataManager = cssDataManager;
|
|
16
16
|
this.selectorPrinting = new SelectorPrinting(cssDataManager);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
configure(settings) {
|
|
19
19
|
this.defaultSettings = settings;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (settings === void 0) { settings = this.defaultSettings; }
|
|
20
|
+
}
|
|
21
|
+
doHover(document, position, stylesheet, settings = this.defaultSettings) {
|
|
23
22
|
function getRange(node) {
|
|
24
23
|
return Range.create(document.positionAt(node.offset), document.positionAt(node.end));
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const offset = document.offsetAt(position);
|
|
26
|
+
const nodepath = nodes.getNodePath(stylesheet, offset);
|
|
28
27
|
/**
|
|
29
28
|
* nodepath is top-down
|
|
30
29
|
* Build up the hover by appending inner node's information
|
|
31
30
|
*/
|
|
32
|
-
|
|
33
|
-
for (
|
|
34
|
-
|
|
31
|
+
let hover = null;
|
|
32
|
+
for (let i = 0; i < nodepath.length; i++) {
|
|
33
|
+
const node = nodepath[i];
|
|
35
34
|
if (node instanceof nodes.Selector) {
|
|
36
35
|
hover = {
|
|
37
36
|
contents: this.selectorPrinting.selectorToMarkedString(node),
|
|
@@ -52,13 +51,13 @@ var CSSHover = /** @class */ (function () {
|
|
|
52
51
|
break;
|
|
53
52
|
}
|
|
54
53
|
if (node instanceof nodes.Declaration) {
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const propertyName = node.getFullPropertyName();
|
|
55
|
+
const entry = this.cssDataManager.getProperty(propertyName);
|
|
57
56
|
if (entry) {
|
|
58
|
-
|
|
57
|
+
const contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings);
|
|
59
58
|
if (contents) {
|
|
60
59
|
hover = {
|
|
61
|
-
contents
|
|
60
|
+
contents,
|
|
62
61
|
range: getRange(node)
|
|
63
62
|
};
|
|
64
63
|
}
|
|
@@ -69,13 +68,13 @@ var CSSHover = /** @class */ (function () {
|
|
|
69
68
|
continue;
|
|
70
69
|
}
|
|
71
70
|
if (node instanceof nodes.UnknownAtRule) {
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const atRuleName = node.getText();
|
|
72
|
+
const entry = this.cssDataManager.getAtDirective(atRuleName);
|
|
74
73
|
if (entry) {
|
|
75
|
-
|
|
74
|
+
const contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings);
|
|
76
75
|
if (contents) {
|
|
77
76
|
hover = {
|
|
78
|
-
contents
|
|
77
|
+
contents,
|
|
79
78
|
range: getRange(node)
|
|
80
79
|
};
|
|
81
80
|
}
|
|
@@ -86,15 +85,15 @@ var CSSHover = /** @class */ (function () {
|
|
|
86
85
|
continue;
|
|
87
86
|
}
|
|
88
87
|
if (node instanceof nodes.Node && node.type === nodes.NodeType.PseudoSelector) {
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const selectorName = node.getText();
|
|
89
|
+
const entry = selectorName.slice(0, 2) === '::'
|
|
91
90
|
? this.cssDataManager.getPseudoElement(selectorName)
|
|
92
91
|
: this.cssDataManager.getPseudoClass(selectorName);
|
|
93
92
|
if (entry) {
|
|
94
|
-
|
|
93
|
+
const contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings);
|
|
95
94
|
if (contents) {
|
|
96
95
|
hover = {
|
|
97
|
-
contents
|
|
96
|
+
contents,
|
|
98
97
|
range: getRange(node)
|
|
99
98
|
};
|
|
100
99
|
}
|
|
@@ -109,8 +108,8 @@ var CSSHover = /** @class */ (function () {
|
|
|
109
108
|
hover.contents = this.convertContents(hover.contents);
|
|
110
109
|
}
|
|
111
110
|
return hover;
|
|
112
|
-
}
|
|
113
|
-
|
|
111
|
+
}
|
|
112
|
+
convertContents(contents) {
|
|
114
113
|
if (!this.doesSupportMarkdown()) {
|
|
115
114
|
if (typeof contents === 'string') {
|
|
116
115
|
return contents;
|
|
@@ -124,7 +123,7 @@ var CSSHover = /** @class */ (function () {
|
|
|
124
123
|
}
|
|
125
124
|
// MarkedString[]
|
|
126
125
|
else if (Array.isArray(contents)) {
|
|
127
|
-
return contents.map(
|
|
126
|
+
return contents.map(c => {
|
|
128
127
|
return typeof c === 'string' ? c : c.value;
|
|
129
128
|
});
|
|
130
129
|
}
|
|
@@ -134,18 +133,16 @@ var CSSHover = /** @class */ (function () {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
return contents;
|
|
137
|
-
}
|
|
138
|
-
|
|
136
|
+
}
|
|
137
|
+
doesSupportMarkdown() {
|
|
139
138
|
if (!isDefined(this.supportsMarkdown)) {
|
|
140
139
|
if (!isDefined(this.clientCapabilities)) {
|
|
141
140
|
this.supportsMarkdown = true;
|
|
142
141
|
return this.supportsMarkdown;
|
|
143
142
|
}
|
|
144
|
-
|
|
143
|
+
const hover = this.clientCapabilities.textDocument && this.clientCapabilities.textDocument.hover;
|
|
145
144
|
this.supportsMarkdown = hover && hover.contentFormat && Array.isArray(hover.contentFormat) && hover.contentFormat.indexOf(MarkupKind.Markdown) !== -1;
|
|
146
145
|
}
|
|
147
146
|
return this.supportsMarkdown;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
}());
|
|
151
|
-
export { CSSHover };
|
|
147
|
+
}
|
|
148
|
+
}
|