@astrojs/language-server 0.7.19 → 0.8.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 +6 -0
- package/dist/core/config/ConfigManager.js +2 -2
- package/dist/core/documents/Document.js +6 -6
- package/dist/core/documents/DocumentBase.js +2 -2
- package/dist/core/documents/DocumentManager.js +6 -6
- package/dist/core/documents/DocumentMapper.js +5 -5
- package/dist/core/documents/parseAstro.js +2 -2
- package/dist/core/documents/parseHtml.js +2 -2
- package/dist/core/documents/utils.js +4 -4
- package/dist/plugins/PluginHost.js +4 -4
- package/dist/plugins/astro/AstroPlugin.js +5 -5
- package/dist/plugins/astro/features/CompletionProvider.js +5 -5
- package/dist/plugins/css/CSSDocument.js +1 -1
- package/dist/plugins/css/CSSPlugin.js +7 -7
- package/dist/plugins/css/StyleAttributeDocument.js +1 -1
- package/dist/plugins/html/HTMLPlugin.js +4 -4
- package/dist/plugins/typescript/DocumentSnapshot.js +15 -15
- package/dist/plugins/typescript/LanguageServiceManager.js +7 -7
- package/dist/plugins/typescript/SnapshotManager.js +2 -2
- package/dist/plugins/typescript/TypeScriptPlugin.js +10 -10
- package/dist/plugins/typescript/astro-sys.js +4 -4
- package/dist/plugins/typescript/astro2tsx.js +1 -1
- package/dist/plugins/typescript/features/CompletionsProvider.js +4 -4
- package/dist/plugins/typescript/features/DiagnosticsProvider.js +5 -5
- package/dist/plugins/typescript/features/HoverProvider.js +4 -4
- package/dist/plugins/typescript/features/SignatureHelpProvider.js +2 -2
- package/dist/plugins/typescript/languageService.js +7 -7
- package/dist/plugins/typescript/module-loader.js +6 -6
- package/dist/plugins/typescript/utils.js +3 -3
- package/dist/server.js +4 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -79,7 +79,7 @@ class ConfigManager {
|
|
|
79
79
|
// Ideally we shouldn't need the merge here because all updates should be valid and complete configs.
|
|
80
80
|
// But since those configs come from the client they might be out of synch with the valid config:
|
|
81
81
|
// We might at some point in the future forget to synch config settings in all packages after updating the config.
|
|
82
|
-
this.config = lodash_1.merge({}, defaultLSConfig, this.config, config);
|
|
82
|
+
this.config = (0, lodash_1.merge)({}, defaultLSConfig, this.config, config);
|
|
83
83
|
// Merge will keep arrays/objects if the new one is empty/has less entries,
|
|
84
84
|
// therefore we need some extra checks if there are new settings
|
|
85
85
|
if (config.astro?.compilerWarnings) {
|
|
@@ -99,7 +99,7 @@ class ConfigManager {
|
|
|
99
99
|
* @param key a string which is a path. Example: 'astro.diagnostics.enable'.
|
|
100
100
|
*/
|
|
101
101
|
get(key) {
|
|
102
|
-
return lodash_1.get(this.config, key);
|
|
102
|
+
return (0, lodash_1.get)(this.config, key);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Register a listener which is invoked when the config changed.
|
|
@@ -16,9 +16,9 @@ class Document {
|
|
|
16
16
|
this.updateDocInfo();
|
|
17
17
|
}
|
|
18
18
|
updateDocInfo() {
|
|
19
|
-
this.html = parseHtml_1.parseHtml(this.content);
|
|
20
|
-
this.astro = parseAstro_1.parseAstro(this.content);
|
|
21
|
-
this.styleInfo = utils_2.extractStyleTag(this.content, this.html);
|
|
19
|
+
this.html = (0, parseHtml_1.parseHtml)(this.content);
|
|
20
|
+
this.astro = (0, parseAstro_1.parseAstro)(this.content);
|
|
21
|
+
this.styleInfo = (0, utils_2.extractStyleTag)(this.content, this.html);
|
|
22
22
|
if (this.styleInfo) {
|
|
23
23
|
this.styleInfo.attributes.lang = 'css';
|
|
24
24
|
}
|
|
@@ -46,7 +46,7 @@ class Document {
|
|
|
46
46
|
* @param offset The index of the position
|
|
47
47
|
*/
|
|
48
48
|
positionAt(offset) {
|
|
49
|
-
offset = utils_1.clamp(offset, 0, this.getTextLength());
|
|
49
|
+
offset = (0, utils_1.clamp)(offset, 0, this.getTextLength());
|
|
50
50
|
const lineOffsets = this.getLineOffsets();
|
|
51
51
|
let low = 0;
|
|
52
52
|
let high = lineOffsets.length;
|
|
@@ -81,7 +81,7 @@ class Document {
|
|
|
81
81
|
}
|
|
82
82
|
const lineOffset = lineOffsets[position.line];
|
|
83
83
|
const nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this.getTextLength();
|
|
84
|
-
return utils_1.clamp(nextLineOffset, lineOffset, lineOffset + position.character);
|
|
84
|
+
return (0, utils_1.clamp)(nextLineOffset, lineOffset, lineOffset + position.character);
|
|
85
85
|
}
|
|
86
86
|
getLineUntilOffset(offset) {
|
|
87
87
|
const { line, character } = this.positionAt(offset);
|
|
@@ -117,7 +117,7 @@ class Document {
|
|
|
117
117
|
* Returns the file path if the url scheme is file
|
|
118
118
|
*/
|
|
119
119
|
getFilePath() {
|
|
120
|
-
return utils_1.urlToPath(this.uri);
|
|
120
|
+
return (0, utils_1.urlToPath)(this.uri);
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* Get URL file path.
|
|
@@ -24,7 +24,7 @@ class ReadableDocument {
|
|
|
24
24
|
* @param offset The index of the position
|
|
25
25
|
*/
|
|
26
26
|
positionAt(offset) {
|
|
27
|
-
offset = utils_1.clamp(offset, 0, this.getTextLength());
|
|
27
|
+
offset = (0, utils_1.clamp)(offset, 0, this.getTextLength());
|
|
28
28
|
const lineOffsets = this.getLineOffsets();
|
|
29
29
|
let low = 0;
|
|
30
30
|
let high = lineOffsets.length;
|
|
@@ -59,7 +59,7 @@ class ReadableDocument {
|
|
|
59
59
|
}
|
|
60
60
|
const lineOffset = lineOffsets[position.line];
|
|
61
61
|
const nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this.getTextLength();
|
|
62
|
-
return utils_1.clamp(nextLineOffset, lineOffset, lineOffset + position.character);
|
|
62
|
+
return (0, utils_1.clamp)(nextLineOffset, lineOffset, lineOffset + position.character);
|
|
63
63
|
}
|
|
64
64
|
getLineOffsets() {
|
|
65
65
|
const lineOffsets = [];
|
|
@@ -14,7 +14,7 @@ class DocumentManager {
|
|
|
14
14
|
this.deleteCandidates = new Set();
|
|
15
15
|
}
|
|
16
16
|
get(uri) {
|
|
17
|
-
return this.documents.get(utils_1.normalizeUri(uri));
|
|
17
|
+
return this.documents.get((0, utils_1.normalizeUri)(uri));
|
|
18
18
|
}
|
|
19
19
|
openDocument(textDocument) {
|
|
20
20
|
let document;
|
|
@@ -25,14 +25,14 @@ class DocumentManager {
|
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
document = this.createDocument(textDocument);
|
|
28
|
-
this.documents.set(utils_1.normalizeUri(textDocument.uri), document);
|
|
28
|
+
this.documents.set((0, utils_1.normalizeUri)(textDocument.uri), document);
|
|
29
29
|
this.notify('documentOpen', document);
|
|
30
30
|
}
|
|
31
31
|
this.notify('documentChange', document);
|
|
32
32
|
return document;
|
|
33
33
|
}
|
|
34
34
|
closeDocument(uri) {
|
|
35
|
-
uri = utils_1.normalizeUri(uri);
|
|
35
|
+
uri = (0, utils_1.normalizeUri)(uri);
|
|
36
36
|
const document = this.documents.get(uri);
|
|
37
37
|
if (!document) {
|
|
38
38
|
throw new Error('Cannot call methods on an unopened document');
|
|
@@ -48,7 +48,7 @@ class DocumentManager {
|
|
|
48
48
|
this.openedInClient.delete(uri);
|
|
49
49
|
}
|
|
50
50
|
releaseDocument(uri) {
|
|
51
|
-
uri = utils_1.normalizeUri(uri);
|
|
51
|
+
uri = (0, utils_1.normalizeUri)(uri);
|
|
52
52
|
this.locked.delete(uri);
|
|
53
53
|
this.openedInClient.delete(uri);
|
|
54
54
|
if (this.deleteCandidates.has(uri)) {
|
|
@@ -57,7 +57,7 @@ class DocumentManager {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
updateDocument(uri, changes) {
|
|
60
|
-
const document = this.documents.get(utils_1.normalizeUri(uri));
|
|
60
|
+
const document = this.documents.get((0, utils_1.normalizeUri)(uri));
|
|
61
61
|
if (!document) {
|
|
62
62
|
throw new Error('Cannot call methods on an unopened document');
|
|
63
63
|
}
|
|
@@ -76,7 +76,7 @@ class DocumentManager {
|
|
|
76
76
|
this.notify('documentChange', document);
|
|
77
77
|
}
|
|
78
78
|
markAsOpenedInClient(uri) {
|
|
79
|
-
this.openedInClient.add(utils_1.normalizeUri(uri));
|
|
79
|
+
this.openedInClient.add((0, utils_1.normalizeUri)(uri));
|
|
80
80
|
}
|
|
81
81
|
getAllOpenedByClient() {
|
|
82
82
|
return Array.from(this.documents.entries()).filter((doc) => this.openedInClient.has(doc[0]));
|
|
@@ -47,18 +47,18 @@ class FragmentMapper {
|
|
|
47
47
|
this.url = url;
|
|
48
48
|
}
|
|
49
49
|
getOriginalPosition(generatedPosition) {
|
|
50
|
-
const parentOffset = this.offsetInParent(utils_1.offsetAt(generatedPosition, this.tagInfo.content));
|
|
51
|
-
return utils_1.positionAt(parentOffset, this.originalText);
|
|
50
|
+
const parentOffset = this.offsetInParent((0, utils_1.offsetAt)(generatedPosition, this.tagInfo.content));
|
|
51
|
+
return (0, utils_1.positionAt)(parentOffset, this.originalText);
|
|
52
52
|
}
|
|
53
53
|
offsetInParent(offset) {
|
|
54
54
|
return this.tagInfo.start + offset;
|
|
55
55
|
}
|
|
56
56
|
getGeneratedPosition(originalPosition) {
|
|
57
|
-
const fragmentOffset = utils_1.offsetAt(originalPosition, this.originalText) - this.tagInfo.start;
|
|
58
|
-
return utils_1.positionAt(fragmentOffset, this.tagInfo.content);
|
|
57
|
+
const fragmentOffset = (0, utils_1.offsetAt)(originalPosition, this.originalText) - this.tagInfo.start;
|
|
58
|
+
return (0, utils_1.positionAt)(fragmentOffset, this.tagInfo.content);
|
|
59
59
|
}
|
|
60
60
|
isInGenerated(pos) {
|
|
61
|
-
const offset = utils_1.offsetAt(pos, this.originalText);
|
|
61
|
+
const offset = (0, utils_1.offsetAt)(pos, this.originalText);
|
|
62
62
|
return offset >= this.tagInfo.start && offset <= this.tagInfo.end;
|
|
63
63
|
}
|
|
64
64
|
getURL() {
|
|
@@ -47,7 +47,7 @@ function getFrontmatter(content) {
|
|
|
47
47
|
function getContent(content, frontmatter) {
|
|
48
48
|
switch (frontmatter.state) {
|
|
49
49
|
case null: {
|
|
50
|
-
const offset = utils_1.getFirstNonWhitespaceIndex(content);
|
|
50
|
+
const offset = (0, utils_1.getFirstNonWhitespaceIndex)(content);
|
|
51
51
|
return { firstNonWhitespaceOffset: offset === -1 ? null : offset };
|
|
52
52
|
}
|
|
53
53
|
case 'open': {
|
|
@@ -56,7 +56,7 @@ function getContent(content, frontmatter) {
|
|
|
56
56
|
case 'closed': {
|
|
57
57
|
const { endOffset } = frontmatter;
|
|
58
58
|
const end = (endOffset ?? 0) + 3;
|
|
59
|
-
const offset = utils_1.getFirstNonWhitespaceIndex(content.slice(end));
|
|
59
|
+
const offset = (0, utils_1.getFirstNonWhitespaceIndex)(content.slice(end));
|
|
60
60
|
return { firstNonWhitespaceOffset: end + offset };
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAttributeContextAtPosition = exports.parseHtml = void 0;
|
|
4
4
|
const vscode_html_languageservice_1 = require("vscode-html-languageservice");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
|
-
const parser = vscode_html_languageservice_1.getLanguageService();
|
|
6
|
+
const parser = (0, vscode_html_languageservice_1.getLanguageService)();
|
|
7
7
|
/**
|
|
8
8
|
* Parses text as HTML
|
|
9
9
|
*/
|
|
@@ -48,7 +48,7 @@ function preprocess(text) {
|
|
|
48
48
|
return text;
|
|
49
49
|
function shouldBlankStartOrEndTagLike(offset) {
|
|
50
50
|
// not null rather than falsy, otherwise it won't work on first tag(0)
|
|
51
|
-
return currentStartTagStart !== null && utils_1.isInsideExpression(text, currentStartTagStart, offset);
|
|
51
|
+
return currentStartTagStart !== null && (0, utils_1.isInsideExpression)(text, currentStartTagStart, offset);
|
|
52
52
|
}
|
|
53
53
|
function blankStartOrEndTagLike(offset) {
|
|
54
54
|
text = text.substring(0, offset) + ' ' + text.substring(offset + 1);
|
|
@@ -73,7 +73,7 @@ function isInsideFrontmatter(text, offset) {
|
|
|
73
73
|
}
|
|
74
74
|
exports.isInsideFrontmatter = isInsideFrontmatter;
|
|
75
75
|
function isInTag(position, tagInfo) {
|
|
76
|
-
return !!tagInfo && utils_1.isInRange(position, vscode_languageserver_1.Range.create(tagInfo.startPos, tagInfo.endPos));
|
|
76
|
+
return !!tagInfo && (0, utils_1.isInRange)(position, vscode_languageserver_1.Range.create(tagInfo.startPos, tagInfo.endPos));
|
|
77
77
|
}
|
|
78
78
|
exports.isInTag = isInTag;
|
|
79
79
|
/**
|
|
@@ -82,7 +82,7 @@ exports.isInTag = isInTag;
|
|
|
82
82
|
* @param text The text for which the position should be retrived
|
|
83
83
|
*/
|
|
84
84
|
function positionAt(offset, text) {
|
|
85
|
-
offset = utils_1.clamp(offset, 0, text.length);
|
|
85
|
+
offset = (0, utils_1.clamp)(offset, 0, text.length);
|
|
86
86
|
const lineOffsets = getLineOffsets(text);
|
|
87
87
|
let low = 0;
|
|
88
88
|
let high = lineOffsets.length;
|
|
@@ -119,7 +119,7 @@ function offsetAt(position, text) {
|
|
|
119
119
|
}
|
|
120
120
|
const lineOffset = lineOffsets[position.line];
|
|
121
121
|
const nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : text.length;
|
|
122
|
-
return utils_1.clamp(nextLineOffset, lineOffset, lineOffset + position.character);
|
|
122
|
+
return (0, utils_1.clamp)(nextLineOffset, lineOffset, lineOffset + position.character);
|
|
123
123
|
}
|
|
124
124
|
exports.offsetAt = offsetAt;
|
|
125
125
|
function getLineOffsets(text) {
|
|
@@ -181,7 +181,7 @@ export function* walk(node: Node, startIndex = 0) {
|
|
|
181
181
|
* @param tag the tag to extract
|
|
182
182
|
*/
|
|
183
183
|
function extractTags(text, tag, html) {
|
|
184
|
-
const rootNodes = html?.roots || parseHtml_1.parseHtml(text).roots;
|
|
184
|
+
const rootNodes = html?.roots || (0, parseHtml_1.parseHtml)(text).roots;
|
|
185
185
|
const matchedNodes = rootNodes.filter((node) => node.tag === tag);
|
|
186
186
|
if (tag === 'style' && !matchedNodes.length && rootNodes.length && rootNodes[0].tag === 'html') {
|
|
187
187
|
for (let child of walk(rootNodes[0])) {
|
|
@@ -30,7 +30,7 @@ class PluginHost {
|
|
|
30
30
|
throw new Error('Cannot call methods on an unopened document');
|
|
31
31
|
}
|
|
32
32
|
const completions = (await this.execute('getCompletions', [document, position, completionContext], ExecuteMode.Collect)).filter((completion) => completion != null);
|
|
33
|
-
let flattenedCompletions = utils_1.flatten(completions.map((completion) => completion.items));
|
|
33
|
+
let flattenedCompletions = (0, utils_1.flatten)(completions.map((completion) => completion.items));
|
|
34
34
|
const isIncomplete = completions.reduce((incomplete, completion) => incomplete || completion.isIncomplete, false);
|
|
35
35
|
return vscode_languageserver_1.CompletionList.create(flattenedCompletions, isIncomplete);
|
|
36
36
|
}
|
|
@@ -39,7 +39,7 @@ class PluginHost {
|
|
|
39
39
|
if (!document) {
|
|
40
40
|
throw new Error('Cannot call methods on an unopened document');
|
|
41
41
|
}
|
|
42
|
-
return utils_1.flatten(await this.execute('getDiagnostics', [document], ExecuteMode.Collect));
|
|
42
|
+
return (0, utils_1.flatten)(await this.execute('getDiagnostics', [document], ExecuteMode.Collect));
|
|
43
43
|
}
|
|
44
44
|
async resolveCompletion(textDocument, completionItem) {
|
|
45
45
|
const document = this.getDocument(textDocument.uri);
|
|
@@ -68,7 +68,7 @@ class PluginHost {
|
|
|
68
68
|
if (!document) {
|
|
69
69
|
throw new Error('Cannot call methods on an unopened document');
|
|
70
70
|
}
|
|
71
|
-
const foldingRanges = utils_1.flatten(await this.execute('getFoldingRanges', [document], ExecuteMode.Collect)).filter((completion) => completion != null);
|
|
71
|
+
const foldingRanges = (0, utils_1.flatten)(await this.execute('getFoldingRanges', [document], ExecuteMode.Collect)).filter((completion) => completion != null);
|
|
72
72
|
return foldingRanges;
|
|
73
73
|
}
|
|
74
74
|
async getDefinitions(textDocument, position) {
|
|
@@ -76,7 +76,7 @@ class PluginHost {
|
|
|
76
76
|
if (!document) {
|
|
77
77
|
throw new Error('Cannot call methods on an unopened document');
|
|
78
78
|
}
|
|
79
|
-
const definitions = utils_1.flatten(await this.execute('getDefinitions', [document, position], ExecuteMode.Collect));
|
|
79
|
+
const definitions = (0, utils_1.flatten)(await this.execute('getDefinitions', [document, position], ExecuteMode.Collect));
|
|
80
80
|
if (this.pluginHostConfig.definitionLinkSupport) {
|
|
81
81
|
return definitions;
|
|
82
82
|
}
|
|
@@ -76,13 +76,13 @@ class AstroPlugin {
|
|
|
76
76
|
}
|
|
77
77
|
const startRange = vscode_languageserver_1.Range.create(vscode_languageserver_1.Position.create(0, 0), vscode_languageserver_1.Position.create(0, 0));
|
|
78
78
|
const links = defs.map((def) => {
|
|
79
|
-
const defFilePath = utils_4.ensureRealFilePath(def.fileName);
|
|
80
|
-
return vscode_languageserver_1.LocationLink.create(utils_1.pathToUrl(defFilePath), startRange, startRange);
|
|
79
|
+
const defFilePath = (0, utils_4.ensureRealFilePath)(def.fileName);
|
|
80
|
+
return vscode_languageserver_1.LocationLink.create((0, utils_1.pathToUrl)(defFilePath), startRange, startRange);
|
|
81
81
|
});
|
|
82
82
|
return links;
|
|
83
83
|
}
|
|
84
84
|
isInsideFrontmatter(document, position) {
|
|
85
|
-
return utils_3.isInsideFrontmatter(document.getText(), document.offsetAt(position));
|
|
85
|
+
return (0, utils_3.isInsideFrontmatter)(document.getText(), document.offsetAt(position));
|
|
86
86
|
}
|
|
87
87
|
isComponentTag(node) {
|
|
88
88
|
if (!node.tag) {
|
|
@@ -92,8 +92,8 @@ class AstroPlugin {
|
|
|
92
92
|
return /[A-Z]/.test(firstChar);
|
|
93
93
|
}
|
|
94
94
|
getDefinitionsForComponentName(document, lang, componentName) {
|
|
95
|
-
const filePath = utils_1.urlToPath(document.uri);
|
|
96
|
-
const tsFilePath = utils_2.toVirtualAstroFilePath(filePath);
|
|
95
|
+
const filePath = (0, utils_1.urlToPath)(document.uri);
|
|
96
|
+
const tsFilePath = (0, utils_2.toVirtualAstroFilePath)(filePath);
|
|
97
97
|
const program = lang.getProgram();
|
|
98
98
|
const sourceFile = program?.getSourceFile(tsFilePath);
|
|
99
99
|
if (!sourceFile) {
|
|
@@ -55,7 +55,7 @@ class CompletionProvider {
|
|
|
55
55
|
}
|
|
56
56
|
getClientHintCompletion(document, position, completionContext) {
|
|
57
57
|
const node = document.html.findNodeAt(document.offsetAt(position));
|
|
58
|
-
if (!utils_2.isPossibleClientComponent(node))
|
|
58
|
+
if (!(0, utils_2.isPossibleClientComponent)(node))
|
|
59
59
|
return null;
|
|
60
60
|
return [
|
|
61
61
|
{
|
|
@@ -128,8 +128,8 @@ class CompletionProvider {
|
|
|
128
128
|
const componentName = node.tag;
|
|
129
129
|
const { lang: thisLang } = await this.tsLanguageServiceManager.getTypeScriptDoc(document);
|
|
130
130
|
// Get the source file
|
|
131
|
-
const filePath = utils_2.urlToPath(document.uri);
|
|
132
|
-
const tsFilePath = utils_3.toVirtualAstroFilePath(filePath);
|
|
131
|
+
const filePath = (0, utils_2.urlToPath)(document.uri);
|
|
132
|
+
const tsFilePath = (0, utils_3.toVirtualAstroFilePath)(filePath);
|
|
133
133
|
const program = thisLang.getProgram();
|
|
134
134
|
const sourceFile = program?.getSourceFile(tsFilePath);
|
|
135
135
|
const typeChecker = program?.getTypeChecker();
|
|
@@ -196,7 +196,7 @@ class CompletionProvider {
|
|
|
196
196
|
}
|
|
197
197
|
for (const decl of sym?.getDeclarations() || []) {
|
|
198
198
|
const fileName = decl.getSourceFile().fileName;
|
|
199
|
-
if (utils_3.isVirtualAstroFilePath(fileName)) {
|
|
199
|
+
if ((0, utils_3.isVirtualAstroFilePath)(fileName)) {
|
|
200
200
|
if (!ts.isFunctionDeclaration(decl)) {
|
|
201
201
|
console.error(`Unexpected: .astro files should export a default function for the component definition.`);
|
|
202
202
|
continue;
|
|
@@ -251,7 +251,7 @@ class CompletionProvider {
|
|
|
251
251
|
return /[A-Z]/.test(firstChar);
|
|
252
252
|
}
|
|
253
253
|
isInsideFrontmatter(document, position) {
|
|
254
|
-
return utils_1.isInsideFrontmatter(document.getText(), document.offsetAt(position));
|
|
254
|
+
return (0, utils_1.isInsideFrontmatter)(document.getText(), document.offsetAt(position));
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
exports.CompletionProvider = CompletionProvider;
|
|
@@ -19,7 +19,7 @@ class CSSDocument extends index_1.ReadableDocument {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
this.languageId = this.language;
|
|
22
|
-
this.stylesheet = service_1.getLanguageService(this.language).parseStylesheet(this);
|
|
22
|
+
this.stylesheet = (0, service_1.getLanguageService)(this.language).parseStylesheet(this);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Get the fragment position relative to the parent
|
|
@@ -35,7 +35,7 @@ class CSSPlugin {
|
|
|
35
35
|
if (cssDocument.isInGenerated(position)) {
|
|
36
36
|
return this.getCompletionsInternal(document, position, cssDocument);
|
|
37
37
|
}
|
|
38
|
-
const attributeContext = parseHtml_1.getAttributeContextAtPosition(document, position);
|
|
38
|
+
const attributeContext = (0, parseHtml_1.getAttributeContextAtPosition)(document, position);
|
|
39
39
|
if (!attributeContext) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
@@ -44,28 +44,28 @@ class CSSPlugin {
|
|
|
44
44
|
return this.getCompletionsInternal(document, position, new StyleAttributeDocument_1.StyleAttributeDocument(document, start, end));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
return getIdClassCompletion_1.getIdClassCompletion(cssDocument, attributeContext);
|
|
47
|
+
return (0, getIdClassCompletion_1.getIdClassCompletion)(cssDocument, attributeContext);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
getCompletionsInternal(document, position, cssDocument) {
|
|
51
51
|
if (isSASS(cssDocument)) {
|
|
52
52
|
// the css language service does not support sass, still we can use
|
|
53
53
|
// the emmet helper directly to at least get emmet completions
|
|
54
|
-
return vscode_emmet_helper_1.doComplete(document, position, 'sass', this.configManager.getEmmetConfig());
|
|
54
|
+
return (0, vscode_emmet_helper_1.doComplete)(document, position, 'sass', this.configManager.getEmmetConfig());
|
|
55
55
|
}
|
|
56
56
|
const type = extractLanguage(cssDocument);
|
|
57
|
-
const lang = service_1.getLanguageService(type);
|
|
57
|
+
const lang = (0, service_1.getLanguageService)(type);
|
|
58
58
|
const emmetResults = {
|
|
59
59
|
isIncomplete: true,
|
|
60
60
|
items: [],
|
|
61
61
|
};
|
|
62
62
|
if (false /* this.configManager.getConfig().css.completions.emmet */) {
|
|
63
63
|
lang.setCompletionParticipants([
|
|
64
|
-
vscode_emmet_helper_1.getEmmetCompletionParticipants(cssDocument, cssDocument.getGeneratedPosition(position), service_1.getLanguage(type), this.configManager.getEmmetConfig(), emmetResults),
|
|
64
|
+
(0, vscode_emmet_helper_1.getEmmetCompletionParticipants)(cssDocument, cssDocument.getGeneratedPosition(position), (0, service_1.getLanguage)(type), this.configManager.getEmmetConfig(), emmetResults),
|
|
65
65
|
]);
|
|
66
66
|
}
|
|
67
67
|
const results = lang.doComplete(cssDocument, cssDocument.getGeneratedPosition(position), cssDocument.stylesheet);
|
|
68
|
-
return vscode_languageserver_1.CompletionList.create([...(results ? results.items : []), ...emmetResults.items].map((completionItem) => documents_1.mapCompletionItemToOriginal(cssDocument, completionItem)),
|
|
68
|
+
return vscode_languageserver_1.CompletionList.create([...(results ? results.items : []), ...emmetResults.items].map((completionItem) => (0, documents_1.mapCompletionItemToOriginal)(cssDocument, completionItem)),
|
|
69
69
|
// Emmet completions change on every keystroke, so they are never complete
|
|
70
70
|
emmetResults.items.length > 0);
|
|
71
71
|
}
|
|
@@ -81,7 +81,7 @@ class CSSPlugin {
|
|
|
81
81
|
return cssDoc;
|
|
82
82
|
}
|
|
83
83
|
isInsideFrontmatter(document, position) {
|
|
84
|
-
return utils_1.isInsideFrontmatter(document.getText(), document.offsetAt(position));
|
|
84
|
+
return (0, utils_1.isInsideFrontmatter)(document.getText(), document.offsetAt(position));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
exports.CSSPlugin = CSSPlugin;
|
|
@@ -13,7 +13,7 @@ class StyleAttributeDocument extends documents_1.ReadableDocument {
|
|
|
13
13
|
this.attrEnd = attrEnd;
|
|
14
14
|
this.version = this.parent.version;
|
|
15
15
|
this.languageId = 'css';
|
|
16
|
-
this.stylesheet = service_1.getLanguageService(this.languageId).parseStylesheet(this);
|
|
16
|
+
this.stylesheet = (0, service_1.getLanguageService)(this.languageId).parseStylesheet(this);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Get the fragment position relative to the parent
|
|
@@ -7,7 +7,7 @@ const vscode_languageserver_1 = require("vscode-languageserver");
|
|
|
7
7
|
const utils_1 = require("../../core/documents/utils");
|
|
8
8
|
class HTMLPlugin {
|
|
9
9
|
constructor(docManager, configManager) {
|
|
10
|
-
this.lang = vscode_html_languageservice_1.getLanguageService();
|
|
10
|
+
this.lang = (0, vscode_html_languageservice_1.getLanguageService)();
|
|
11
11
|
this.documents = new WeakMap();
|
|
12
12
|
this.styleScriptTemplate = new Set(['template', 'style', 'script']);
|
|
13
13
|
this.pluginName = 'HTML';
|
|
@@ -33,7 +33,7 @@ class HTMLPlugin {
|
|
|
33
33
|
isIncomplete: true,
|
|
34
34
|
items: [],
|
|
35
35
|
};
|
|
36
|
-
this.lang.setCompletionParticipants([vscode_emmet_helper_1.getEmmetCompletionParticipants(document, position, 'html', this.configManager.getEmmetConfig(), emmetResults)]);
|
|
36
|
+
this.lang.setCompletionParticipants([(0, vscode_emmet_helper_1.getEmmetCompletionParticipants)(document, position, 'html', this.configManager.getEmmetConfig(), emmetResults)]);
|
|
37
37
|
const results = this.lang.doComplete(document, position, html);
|
|
38
38
|
const items = this.toCompletionItems(results.items);
|
|
39
39
|
return vscode_languageserver_1.CompletionList.create([...this.toCompletionItems(items), ...this.getLangCompletions(items), ...emmetResults.items],
|
|
@@ -99,10 +99,10 @@ class HTMLPlugin {
|
|
|
99
99
|
isInsideExpression(html, document, position) {
|
|
100
100
|
const offset = document.offsetAt(position);
|
|
101
101
|
const node = html.findNodeAt(offset);
|
|
102
|
-
return utils_1.isInsideExpression(document.getText(), node.start, offset);
|
|
102
|
+
return (0, utils_1.isInsideExpression)(document.getText(), node.start, offset);
|
|
103
103
|
}
|
|
104
104
|
isInsideFrontmatter(document, position) {
|
|
105
|
-
return utils_1.isInsideFrontmatter(document.getText(), document.offsetAt(position));
|
|
105
|
+
return (0, utils_1.isInsideFrontmatter)(document.getText(), document.offsetAt(position));
|
|
106
106
|
}
|
|
107
107
|
isComponentTag(node) {
|
|
108
108
|
if (!node.tag) {
|
|
@@ -32,7 +32,7 @@ const os_1 = require("os");
|
|
|
32
32
|
const astro2tsx_1 = __importDefault(require("./astro2tsx"));
|
|
33
33
|
const createDocumentSnapshot = (filePath, currentText, createDocument) => {
|
|
34
34
|
const text = currentText || (ts.sys.readFile(filePath) ?? '');
|
|
35
|
-
if (utils_3.isAstroFilePath(filePath)) {
|
|
35
|
+
if ((0, utils_3.isAstroFilePath)(filePath)) {
|
|
36
36
|
if (!createDocument)
|
|
37
37
|
throw new Error('Astro documents require the "createDocument" utility to be provided');
|
|
38
38
|
const snapshot = new AstroDocumentSnapshot(createDocument(filePath, text, currentText !== null));
|
|
@@ -49,7 +49,7 @@ class AstroDocumentSnapshot {
|
|
|
49
49
|
this.parserError = null;
|
|
50
50
|
}
|
|
51
51
|
async getFragment() {
|
|
52
|
-
const uri = utils_2.pathToUrl(this.filePath);
|
|
52
|
+
const uri = (0, utils_2.pathToUrl)(this.filePath);
|
|
53
53
|
const mapper = await this.getMapper(uri);
|
|
54
54
|
return new DocumentFragmentSnapshot(mapper, this.doc);
|
|
55
55
|
}
|
|
@@ -58,7 +58,7 @@ class AstroDocumentSnapshot {
|
|
|
58
58
|
}
|
|
59
59
|
get text() {
|
|
60
60
|
let raw = this.doc.getText();
|
|
61
|
-
return astro2tsx_1.default(raw).code;
|
|
61
|
+
return (0, astro2tsx_1.default)(raw).code;
|
|
62
62
|
}
|
|
63
63
|
get filePath() {
|
|
64
64
|
return this.doc.getFilePath() || '';
|
|
@@ -76,14 +76,14 @@ class AstroDocumentSnapshot {
|
|
|
76
76
|
return undefined;
|
|
77
77
|
}
|
|
78
78
|
positionAt(offset) {
|
|
79
|
-
return utils_1.positionAt(offset, this.text);
|
|
79
|
+
return (0, utils_1.positionAt)(offset, this.text);
|
|
80
80
|
}
|
|
81
81
|
getLineContainingOffset(offset) {
|
|
82
82
|
const chunks = this.getText(0, offset).split(os_1.EOL);
|
|
83
83
|
return chunks[chunks.length - 1];
|
|
84
84
|
}
|
|
85
85
|
offsetAt(position) {
|
|
86
|
-
return utils_1.offsetAt(position, this.text);
|
|
86
|
+
return (0, utils_1.offsetAt)(position, this.text);
|
|
87
87
|
}
|
|
88
88
|
getMapper(uri) {
|
|
89
89
|
return new documents_1.IdentityMapper(uri);
|
|
@@ -101,9 +101,9 @@ class DocumentFragmentSnapshot {
|
|
|
101
101
|
throw new Error('Cannot create a document fragment from a non-local document');
|
|
102
102
|
const text = parent.getText();
|
|
103
103
|
this.version = parent.version;
|
|
104
|
-
this.filePath = utils_3.toVirtualAstroFilePath(filePath);
|
|
105
|
-
this.url = utils_3.toVirtualAstroFilePath(filePath);
|
|
106
|
-
this.text = astro2tsx_1.default(text).code;
|
|
104
|
+
this.filePath = (0, utils_3.toVirtualAstroFilePath)(filePath);
|
|
105
|
+
this.url = (0, utils_3.toVirtualAstroFilePath)(filePath);
|
|
106
|
+
this.text = (0, astro2tsx_1.default)(text).code;
|
|
107
107
|
}
|
|
108
108
|
getText(start, end) {
|
|
109
109
|
return this.text.substring(start, end);
|
|
@@ -118,14 +118,14 @@ class DocumentFragmentSnapshot {
|
|
|
118
118
|
return undefined;
|
|
119
119
|
}
|
|
120
120
|
positionAt(offset) {
|
|
121
|
-
return utils_1.positionAt(offset, this.text);
|
|
121
|
+
return (0, utils_1.positionAt)(offset, this.text);
|
|
122
122
|
}
|
|
123
123
|
getLineContainingOffset(offset) {
|
|
124
124
|
const chunks = this.getText(0, offset).split(os_1.EOL);
|
|
125
125
|
return chunks[chunks.length - 1];
|
|
126
126
|
}
|
|
127
127
|
offsetAt(position) {
|
|
128
|
-
return utils_1.offsetAt(position, this.text);
|
|
128
|
+
return (0, utils_1.offsetAt)(position, this.text);
|
|
129
129
|
}
|
|
130
130
|
getOriginalPosition(pos) {
|
|
131
131
|
return this.mapper.getOriginalPosition(pos);
|
|
@@ -134,7 +134,7 @@ class DocumentFragmentSnapshot {
|
|
|
134
134
|
return this.mapper.getGeneratedPosition(pos);
|
|
135
135
|
}
|
|
136
136
|
isInGenerated(pos) {
|
|
137
|
-
return !utils_1.isInTag(pos, this.parent.styleInfo);
|
|
137
|
+
return !(0, utils_1.isInTag)(pos, this.parent.styleInfo);
|
|
138
138
|
}
|
|
139
139
|
getURL() {
|
|
140
140
|
return this.url;
|
|
@@ -146,10 +146,10 @@ class TypeScriptDocumentSnapshot {
|
|
|
146
146
|
this.version = version;
|
|
147
147
|
this.filePath = filePath;
|
|
148
148
|
this.text = text;
|
|
149
|
-
this.scriptKind = utils_3.getScriptKindFromFileName(this.filePath);
|
|
149
|
+
this.scriptKind = (0, utils_3.getScriptKindFromFileName)(this.filePath);
|
|
150
150
|
this.scriptInfo = null;
|
|
151
151
|
this.parserError = null;
|
|
152
|
-
this.url = utils_2.pathToUrl(filePath);
|
|
152
|
+
this.url = (0, utils_2.pathToUrl)(filePath);
|
|
153
153
|
}
|
|
154
154
|
getText(start, end) {
|
|
155
155
|
return this.text.substring(start, end);
|
|
@@ -164,10 +164,10 @@ class TypeScriptDocumentSnapshot {
|
|
|
164
164
|
return undefined;
|
|
165
165
|
}
|
|
166
166
|
positionAt(offset) {
|
|
167
|
-
return utils_1.positionAt(offset, this.text);
|
|
167
|
+
return (0, utils_1.positionAt)(offset, this.text);
|
|
168
168
|
}
|
|
169
169
|
offsetAt(position) {
|
|
170
|
-
return utils_1.offsetAt(position, this.text);
|
|
170
|
+
return (0, utils_1.offsetAt)(position, this.text);
|
|
171
171
|
}
|
|
172
172
|
async getFragment() {
|
|
173
173
|
return this;
|
|
@@ -6,7 +6,7 @@ const languageService_1 = require("./languageService");
|
|
|
6
6
|
class LanguageServiceManager {
|
|
7
7
|
constructor(docManager, configManager, workspaceUris) {
|
|
8
8
|
this.createDocument = (fileName, content, overrideText) => {
|
|
9
|
-
const uri = utils_1.pathToUrl(fileName);
|
|
9
|
+
const uri = (0, utils_1.pathToUrl)(fileName);
|
|
10
10
|
const document = this.docManager.openDocument({
|
|
11
11
|
languageId: 'astro',
|
|
12
12
|
version: 0,
|
|
@@ -27,14 +27,14 @@ class LanguageServiceManager {
|
|
|
27
27
|
// This refreshes the document in the ts language service
|
|
28
28
|
this.getTypeScriptDoc(document);
|
|
29
29
|
};
|
|
30
|
-
docManager.on('documentChange', utils_1.debounceSameArg(handleDocumentChange, (newDoc, prevDoc) => newDoc.uri === prevDoc?.uri, 1000));
|
|
30
|
+
docManager.on('documentChange', (0, utils_1.debounceSameArg)(handleDocumentChange, (newDoc, prevDoc) => newDoc.uri === prevDoc?.uri, 1000));
|
|
31
31
|
docManager.on('documentOpen', handleDocumentChange);
|
|
32
32
|
}
|
|
33
33
|
getWorkspaceRoot(fileName) {
|
|
34
34
|
if (this.workspaceUris.length === 1)
|
|
35
|
-
return utils_1.urlToPath(this.workspaceUris[0]);
|
|
35
|
+
return (0, utils_1.urlToPath)(this.workspaceUris[0]);
|
|
36
36
|
return this.workspaceUris.reduce((found, curr) => {
|
|
37
|
-
const url = utils_1.urlToPath(curr);
|
|
37
|
+
const url = (0, utils_1.urlToPath)(curr);
|
|
38
38
|
if (fileName.startsWith(url) && curr.length < url.length)
|
|
39
39
|
return url;
|
|
40
40
|
return found;
|
|
@@ -46,18 +46,18 @@ class LanguageServiceManager {
|
|
|
46
46
|
return tsService.updateDocument(pathOrDoc);
|
|
47
47
|
}
|
|
48
48
|
async getTypeScriptDoc(document) {
|
|
49
|
-
const lang = await languageService_1.getLanguageServiceForDocument(document, this.workspaceUris, this.docContext);
|
|
49
|
+
const lang = await (0, languageService_1.getLanguageServiceForDocument)(document, this.workspaceUris, this.docContext);
|
|
50
50
|
const tsDoc = await this.getSnapshot(document);
|
|
51
51
|
return { tsDoc, lang };
|
|
52
52
|
}
|
|
53
53
|
async getTypeScriptLangForPath(filePath) {
|
|
54
|
-
return languageService_1.getLanguageServiceForPath(filePath, this.workspaceUris, this.docContext);
|
|
54
|
+
return (0, languageService_1.getLanguageServiceForPath)(filePath, this.workspaceUris, this.docContext);
|
|
55
55
|
}
|
|
56
56
|
async getSnapshotManager(filePath) {
|
|
57
57
|
return (await this.getTypeScriptLanguageService(filePath)).snapshotManager;
|
|
58
58
|
}
|
|
59
59
|
getTypeScriptLanguageService(filePath) {
|
|
60
|
-
return languageService_1.getLanguageService(filePath, this.workspaceUris, this.docContext);
|
|
60
|
+
return (0, languageService_1.getLanguageService)(filePath, this.workspaceUris, this.docContext);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
exports.LanguageServiceManager = LanguageServiceManager;
|
|
@@ -48,7 +48,7 @@ class SnapshotManager {
|
|
|
48
48
|
previousSnapshot.update(changes);
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
const newSnapshot = DocumentSnapshot_1.createDocumentSnapshot(fileName, null);
|
|
51
|
+
const newSnapshot = (0, DocumentSnapshot_1.createDocumentSnapshot)(fileName, null);
|
|
52
52
|
if (previousSnapshot) {
|
|
53
53
|
newSnapshot.version = previousSnapshot.version + 1;
|
|
54
54
|
}
|
|
@@ -74,7 +74,7 @@ class SnapshotManager {
|
|
|
74
74
|
return this.documents.delete(fileName);
|
|
75
75
|
}
|
|
76
76
|
getFileNames() {
|
|
77
|
-
return Array.from(this.documents.keys()).map((fileName) => utils_1.toVirtualAstroFilePath(fileName));
|
|
77
|
+
return Array.from(this.documents.keys()).map((fileName) => (0, utils_1.toVirtualAstroFilePath)(fileName));
|
|
78
78
|
}
|
|
79
79
|
getProjectFileNames() {
|
|
80
80
|
return [...this.projectFiles];
|
|
@@ -50,7 +50,7 @@ class TypeScriptPlugin {
|
|
|
50
50
|
const { lang, tsDoc } = await this.languageServiceManager.getTypeScriptDoc(document);
|
|
51
51
|
const fragment = await tsDoc.getFragment();
|
|
52
52
|
const offset = fragment.offsetAt(fragment.getGeneratedPosition(position));
|
|
53
|
-
let renames = lang.findRenameLocations(utils_1.toVirtualAstroFilePath(tsDoc.filePath), offset, false, false, true);
|
|
53
|
+
let renames = lang.findRenameLocations((0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath), offset, false, false, true);
|
|
54
54
|
if (!renames) {
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
@@ -58,13 +58,13 @@ class TypeScriptPlugin {
|
|
|
58
58
|
changes: {}
|
|
59
59
|
};
|
|
60
60
|
renames.forEach(rename => {
|
|
61
|
-
const filePath = utils_1.ensureRealAstroFilePath(rename.fileName);
|
|
61
|
+
const filePath = (0, utils_1.ensureRealAstroFilePath)(rename.fileName);
|
|
62
62
|
if (!(filePath in edit.changes)) {
|
|
63
63
|
edit.changes[filePath] = [];
|
|
64
64
|
}
|
|
65
65
|
edit.changes[filePath].push({
|
|
66
66
|
newText: newName,
|
|
67
|
-
range: utils_1.convertToLocationRange(fragment, rename.textSpan)
|
|
67
|
+
range: (0, utils_1.convertToLocationRange)(fragment, rename.textSpan)
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
return edit;
|
|
@@ -80,7 +80,7 @@ class TypeScriptPlugin {
|
|
|
80
80
|
const { lang, tsDoc } = await this.languageServiceManager.getTypeScriptDoc(document);
|
|
81
81
|
const mainFragment = await tsDoc.getFragment();
|
|
82
82
|
const filePath = tsDoc.filePath;
|
|
83
|
-
const tsFilePath = utils_1.toVirtualAstroFilePath(filePath);
|
|
83
|
+
const tsFilePath = (0, utils_1.toVirtualAstroFilePath)(filePath);
|
|
84
84
|
const fragmentPosition = mainFragment.getGeneratedPosition(position);
|
|
85
85
|
const fragmentOffset = mainFragment.offsetAt(fragmentPosition);
|
|
86
86
|
let defs = lang.getDefinitionAndBoundSpan(tsFilePath, fragmentOffset);
|
|
@@ -98,10 +98,10 @@ class TypeScriptPlugin {
|
|
|
98
98
|
docs.set(tsDoc.filePath, { fragment: mainFragment, snapshot: tsDoc });
|
|
99
99
|
const result = await Promise.all(defs.definitions.map(async (def) => {
|
|
100
100
|
const { fragment, snapshot } = await docs.retrieve(def.fileName);
|
|
101
|
-
if (utils_3.isNoTextSpanInGeneratedCode(snapshot.getFullText(), def.textSpan)) {
|
|
102
|
-
const fileName = utils_1.ensureRealAstroFilePath(def.fileName);
|
|
103
|
-
const textSpan = utils_1.isVirtualAstroFilePath(tsFilePath) ? { start: 0, length: 0 } : def.textSpan;
|
|
104
|
-
return vscode_languageserver_1.LocationLink.create(utils_2.pathToUrl(fileName), utils_1.convertToLocationRange(fragment, textSpan), utils_1.convertToLocationRange(fragment, textSpan), utils_1.convertToLocationRange(mainFragment, defs.textSpan));
|
|
101
|
+
if ((0, utils_3.isNoTextSpanInGeneratedCode)(snapshot.getFullText(), def.textSpan)) {
|
|
102
|
+
const fileName = (0, utils_1.ensureRealAstroFilePath)(def.fileName);
|
|
103
|
+
const textSpan = (0, utils_1.isVirtualAstroFilePath)(tsFilePath) ? { start: 0, length: 0 } : def.textSpan;
|
|
104
|
+
return vscode_languageserver_1.LocationLink.create((0, utils_2.pathToUrl)(fileName), (0, utils_1.convertToLocationRange)(fragment, textSpan), (0, utils_1.convertToLocationRange)(fragment, textSpan), (0, utils_1.convertToLocationRange)(mainFragment, defs.textSpan));
|
|
105
105
|
}
|
|
106
106
|
}));
|
|
107
107
|
return result.filter(utils_2.isNotNullOrUndefined);
|
|
@@ -115,7 +115,7 @@ class TypeScriptPlugin {
|
|
|
115
115
|
async onWatchFileChanges(onWatchFileChangesParams) {
|
|
116
116
|
const doneUpdateProjectFiles = new Set();
|
|
117
117
|
for (const { fileName, changeType } of onWatchFileChangesParams) {
|
|
118
|
-
const scriptKind = utils_1.getScriptKindFromFileName(fileName);
|
|
118
|
+
const scriptKind = (0, utils_1.getScriptKindFromFileName)(fileName);
|
|
119
119
|
if (scriptKind === ts.ScriptKind.Unknown) {
|
|
120
120
|
// We don't deal with svelte files here
|
|
121
121
|
continue;
|
|
@@ -157,7 +157,7 @@ class TypeScriptPlugin {
|
|
|
157
157
|
let decl = node.parent.parent;
|
|
158
158
|
let spec = ts.isStringLiteral(decl.moduleSpecifier) && decl.moduleSpecifier.text;
|
|
159
159
|
if (spec) {
|
|
160
|
-
let fileName = path_1.join(path_1.dirname(tsFilePath), spec);
|
|
160
|
+
let fileName = (0, path_1.join)((0, path_1.dirname)(tsFilePath), spec);
|
|
161
161
|
let start = node.pos + 1;
|
|
162
162
|
let def = {
|
|
163
163
|
definitions: [
|
|
@@ -33,7 +33,7 @@ function createAstroSys(getSnapshot) {
|
|
|
33
33
|
const AstroSys = {
|
|
34
34
|
...ts.sys,
|
|
35
35
|
fileExists(path) {
|
|
36
|
-
let doesExist = ts.sys.fileExists(utils_1.ensureRealAstroFilePath(path));
|
|
36
|
+
let doesExist = ts.sys.fileExists((0, utils_1.ensureRealAstroFilePath)(path));
|
|
37
37
|
return doesExist;
|
|
38
38
|
},
|
|
39
39
|
directoryExists(path) {
|
|
@@ -43,7 +43,7 @@ function createAstroSys(getSnapshot) {
|
|
|
43
43
|
return ts.sys.directoryExists(path);
|
|
44
44
|
},
|
|
45
45
|
readFile(path) {
|
|
46
|
-
if (utils_1.isAstroFilePath(path) || utils_1.isVirtualAstroFilePath(path)) {
|
|
46
|
+
if ((0, utils_1.isAstroFilePath)(path) || (0, utils_1.isVirtualAstroFilePath)(path)) {
|
|
47
47
|
console.log('readFile', path);
|
|
48
48
|
}
|
|
49
49
|
const snapshot = getSnapshot(path);
|
|
@@ -58,8 +58,8 @@ function createAstroSys(getSnapshot) {
|
|
|
58
58
|
if (ts.sys.realpath) {
|
|
59
59
|
const realpath = ts.sys.realpath;
|
|
60
60
|
AstroSys.realpath = function (path) {
|
|
61
|
-
if (utils_1.isVirtualAstroFilePath(path)) {
|
|
62
|
-
return realpath(utils_1.toRealAstroFilePath(path)) + '.ts';
|
|
61
|
+
if ((0, utils_1.isVirtualAstroFilePath)(path)) {
|
|
62
|
+
return realpath((0, utils_1.toRealAstroFilePath)(path)) + '.ts';
|
|
63
63
|
}
|
|
64
64
|
return realpath(path);
|
|
65
65
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fs_1 = require("fs");
|
|
4
4
|
const os_1 = require("os");
|
|
5
|
-
const ASTRO_DEFINITION_BYTES = fs_1.readFileSync(require.resolve('../../../astro.d.ts'));
|
|
5
|
+
const ASTRO_DEFINITION_BYTES = (0, fs_1.readFileSync)(require.resolve('../../../astro.d.ts'));
|
|
6
6
|
const ASTRO_DEFINITION_STR = ASTRO_DEFINITION_BYTES.toString('utf-8');
|
|
7
7
|
function addProps(content, dtsContent) {
|
|
8
8
|
let defaultExportType = 'AstroBuiltinProps & Record<string, any>';
|
|
@@ -35,7 +35,7 @@ class CompletionsProviderImpl {
|
|
|
35
35
|
}
|
|
36
36
|
async getCompletions(document, position, _completionContext) {
|
|
37
37
|
// TODO: handle inside expression
|
|
38
|
-
if (!utils_1.isInsideFrontmatter(document.getText(), document.offsetAt(position))) {
|
|
38
|
+
if (!(0, utils_1.isInsideFrontmatter)(document.getText(), document.offsetAt(position))) {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
41
|
const filePath = document.getFilePath();
|
|
@@ -53,7 +53,7 @@ class CompletionsProviderImpl {
|
|
|
53
53
|
async resolveCompletion(document, completionItem) {
|
|
54
54
|
const { data: comp } = completionItem;
|
|
55
55
|
const { tsDoc, lang } = await this.lang.getTypeScriptDoc(document);
|
|
56
|
-
let filePath = utils_2.toVirtualAstroFilePath(tsDoc.filePath);
|
|
56
|
+
let filePath = (0, utils_2.toVirtualAstroFilePath)(tsDoc.filePath);
|
|
57
57
|
if (!comp || !filePath) {
|
|
58
58
|
return completionItem;
|
|
59
59
|
}
|
|
@@ -77,8 +77,8 @@ class CompletionsProviderImpl {
|
|
|
77
77
|
return {
|
|
78
78
|
label: comp.name,
|
|
79
79
|
insertText: comp.insertText,
|
|
80
|
-
kind: utils_2.scriptElementKindToCompletionItemKind(comp.kind),
|
|
81
|
-
commitCharacters: utils_2.getCommitCharactersForScriptElement(comp.kind),
|
|
80
|
+
kind: (0, utils_2.scriptElementKindToCompletionItemKind)(comp.kind),
|
|
81
|
+
commitCharacters: (0, utils_2.getCommitCharactersForScriptElement)(comp.kind),
|
|
82
82
|
// Make sure svelte component takes precedence
|
|
83
83
|
sortText: comp.sortText,
|
|
84
84
|
preselect: comp.isRecommended,
|
|
@@ -37,7 +37,7 @@ class DiagnosticsProviderImpl {
|
|
|
37
37
|
}
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
|
-
const filePath = utils_1.toVirtualAstroFilePath(tsDoc.filePath);
|
|
40
|
+
const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
|
|
41
41
|
const { script: scriptBoundaries, markdown: markdownBoundaries } = this.getTagBoundaries(lang, filePath);
|
|
42
42
|
const syntaxDiagnostics = lang.getSyntacticDiagnostics(filePath);
|
|
43
43
|
const suggestionDiagnostics = lang.getSuggestionDiagnostics(filePath);
|
|
@@ -55,8 +55,8 @@ class DiagnosticsProviderImpl {
|
|
|
55
55
|
return diagnostics
|
|
56
56
|
.filter(isNotGenerated(tsDoc.getText(0, tsDoc.getLength())))
|
|
57
57
|
.map((diagnostic) => ({
|
|
58
|
-
range: utils_1.convertRange(tsDoc, diagnostic),
|
|
59
|
-
severity: utils_1.mapSeverity(diagnostic.category),
|
|
58
|
+
range: (0, utils_1.convertRange)(tsDoc, diagnostic),
|
|
59
|
+
severity: (0, utils_1.mapSeverity)(diagnostic.category),
|
|
60
60
|
source: isTypescript ? 'ts' : 'js',
|
|
61
61
|
message: typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
|
|
62
62
|
code: diagnostic.code,
|
|
@@ -125,7 +125,7 @@ function getDiagnosticTag(diagnostic) {
|
|
|
125
125
|
}
|
|
126
126
|
function mapRange(fragment, _document) {
|
|
127
127
|
return (diagnostic) => {
|
|
128
|
-
let range = documents_1.mapRangeToOriginal(fragment, diagnostic.range);
|
|
128
|
+
let range = (0, documents_1.mapRangeToOriginal)(fragment, diagnostic.range);
|
|
129
129
|
if (range.start.line < 0) {
|
|
130
130
|
// Could be a props error?
|
|
131
131
|
// From svelte
|
|
@@ -255,6 +255,6 @@ function isNotGenerated(text) {
|
|
|
255
255
|
if (diagnostic.start === undefined || diagnostic.length === undefined) {
|
|
256
256
|
return true;
|
|
257
257
|
}
|
|
258
|
-
return !utils_2.isInGeneratedCode(text, diagnostic.start, diagnostic.start + diagnostic.length);
|
|
258
|
+
return !(0, utils_2.isInGeneratedCode)(text, diagnostic.start, diagnostic.start + diagnostic.length);
|
|
259
259
|
};
|
|
260
260
|
}
|
|
@@ -17,7 +17,7 @@ class HoverProviderImpl {
|
|
|
17
17
|
const { lang, tsDoc } = await this.getLSAndTSDoc(document);
|
|
18
18
|
const fragment = await tsDoc.getFragment();
|
|
19
19
|
const offset = fragment.offsetAt(fragment.getGeneratedPosition(position));
|
|
20
|
-
const filePath = utils_1.toVirtualAstroFilePath(tsDoc.filePath);
|
|
20
|
+
const filePath = (0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath);
|
|
21
21
|
let info = lang.getQuickInfoAtPosition(filePath, offset);
|
|
22
22
|
if (!info) {
|
|
23
23
|
return null;
|
|
@@ -28,11 +28,11 @@ class HoverProviderImpl {
|
|
|
28
28
|
kind: value.kind
|
|
29
29
|
}));
|
|
30
30
|
const declaration = typescript_1.default.displayPartsToString(displayParts);
|
|
31
|
-
const documentation = previewer_1.getMarkdownDocumentation(info.documentation, info.tags);
|
|
31
|
+
const documentation = (0, previewer_1.getMarkdownDocumentation)(info.documentation, info.tags);
|
|
32
32
|
// https://microsoft.github.io/language-server-protocol/specification#textDocument_hover
|
|
33
33
|
const contents = ['```typescript', declaration, '```'].concat(documentation ? ['---', documentation] : []).join('\n');
|
|
34
|
-
return documents_1.mapObjWithRangeToOriginal(fragment, {
|
|
35
|
-
range: utils_1.convertRange(fragment, textSpan),
|
|
34
|
+
return (0, documents_1.mapObjWithRangeToOriginal)(fragment, {
|
|
35
|
+
range: (0, utils_1.convertRange)(fragment, textSpan),
|
|
36
36
|
contents,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -20,7 +20,7 @@ class SignatureHelpProviderImpl {
|
|
|
20
20
|
}
|
|
21
21
|
const offset = fragment.offsetAt(fragment.getGeneratedPosition(position));
|
|
22
22
|
const triggerReason = this.toTsTriggerReason(context);
|
|
23
|
-
const info = lang.getSignatureHelpItems(utils_1.toVirtualAstroFilePath(tsDoc.filePath), offset, triggerReason ? { triggerReason } : undefined);
|
|
23
|
+
const info = lang.getSignatureHelpItems((0, utils_1.toVirtualAstroFilePath)(tsDoc.filePath), offset, triggerReason ? { triggerReason } : undefined);
|
|
24
24
|
if (!info || info.items.some((signature) => this.isInSvelte2tsxGeneratedFunction(signature))) {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
@@ -83,7 +83,7 @@ class SignatureHelpProviderImpl {
|
|
|
83
83
|
signatureLabel += separatorLabel;
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
const signatureDocumentation = previewer_1.getMarkdownDocumentation(item.documentation, item.tags.filter((tag) => tag.name !== 'param'));
|
|
86
|
+
const signatureDocumentation = (0, previewer_1.getMarkdownDocumentation)(item.documentation, item.tags.filter((tag) => tag.name !== 'param'));
|
|
87
87
|
return {
|
|
88
88
|
label: prefixLabel + signatureLabel + suffixLabel,
|
|
89
89
|
documentation: signatureDocumentation
|
|
@@ -29,7 +29,7 @@ const DocumentSnapshot_1 = require("./DocumentSnapshot");
|
|
|
29
29
|
const module_loader_1 = require("./module-loader");
|
|
30
30
|
const services = new Map();
|
|
31
31
|
async function getLanguageService(path, workspaceUris, docContext) {
|
|
32
|
-
const tsconfigPath = utils_1.findTsConfigPath(path, workspaceUris);
|
|
32
|
+
const tsconfigPath = (0, utils_1.findTsConfigPath)(path, workspaceUris);
|
|
33
33
|
const workspaceRoot = docContext.getWorkspaceRoot(path);
|
|
34
34
|
let service;
|
|
35
35
|
if (services.has(tsconfigPath)) {
|
|
@@ -71,7 +71,7 @@ async function createLanguageService(tsconfigPath, workspaceRoot, docContext) {
|
|
|
71
71
|
module: ts.ModuleKind.ESNext,
|
|
72
72
|
target: ts.ScriptTarget.ESNext
|
|
73
73
|
};
|
|
74
|
-
const project = ts.parseJsonConfigFileContent(configJson, parseConfigHost, workspaceRoot, existingCompilerOptions, path_1.basename(tsconfigPath), undefined, [
|
|
74
|
+
const project = ts.parseJsonConfigFileContent(configJson, parseConfigHost, workspaceRoot, existingCompilerOptions, (0, path_1.basename)(tsconfigPath), undefined, [
|
|
75
75
|
{ extension: '.vue', isMixedContent: true, scriptKind: ts.ScriptKind.Deferred },
|
|
76
76
|
{ extension: '.svelte', isMixedContent: true, scriptKind: ts.ScriptKind.Deferred },
|
|
77
77
|
{ extension: '.astro', isMixedContent: true, scriptKind: ts.ScriptKind.Deferred },
|
|
@@ -81,7 +81,7 @@ async function createLanguageService(tsconfigPath, workspaceRoot, docContext) {
|
|
|
81
81
|
exclude: ['node_modules', 'dist'],
|
|
82
82
|
include: ['src'],
|
|
83
83
|
}, workspaceRoot || process.cwd());
|
|
84
|
-
const astroModuleLoader = module_loader_1.createAstroModuleLoader(getScriptSnapshot, {});
|
|
84
|
+
const astroModuleLoader = (0, module_loader_1.createAstroModuleLoader)(getScriptSnapshot, {});
|
|
85
85
|
const host = {
|
|
86
86
|
getNewLine: () => ts.sys.newLine,
|
|
87
87
|
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
|
@@ -123,7 +123,7 @@ async function createLanguageService(tsconfigPath, workspaceRoot, docContext) {
|
|
|
123
123
|
snapshotManager.delete(filePath);
|
|
124
124
|
}
|
|
125
125
|
function updateDocument(documentOrFilePath) {
|
|
126
|
-
const filePath = utils_1.ensureRealAstroFilePath(typeof documentOrFilePath === 'string' ? documentOrFilePath : documentOrFilePath.getFilePath() || '');
|
|
126
|
+
const filePath = (0, utils_1.ensureRealAstroFilePath)(typeof documentOrFilePath === 'string' ? documentOrFilePath : documentOrFilePath.getFilePath() || '');
|
|
127
127
|
const document = typeof documentOrFilePath === 'string' ? undefined : documentOrFilePath;
|
|
128
128
|
if (!filePath) {
|
|
129
129
|
throw new Error(`Unable to find document`);
|
|
@@ -133,18 +133,18 @@ async function createLanguageService(tsconfigPath, workspaceRoot, docContext) {
|
|
|
133
133
|
return previousSnapshot;
|
|
134
134
|
}
|
|
135
135
|
const currentText = document ? document.getText() : null;
|
|
136
|
-
const snapshot = DocumentSnapshot_1.createDocumentSnapshot(filePath, currentText, docContext.createDocument);
|
|
136
|
+
const snapshot = (0, DocumentSnapshot_1.createDocumentSnapshot)(filePath, currentText, docContext.createDocument);
|
|
137
137
|
snapshotManager.set(filePath, snapshot);
|
|
138
138
|
onProjectUpdated();
|
|
139
139
|
return snapshot;
|
|
140
140
|
}
|
|
141
141
|
function getScriptSnapshot(fileName) {
|
|
142
|
-
fileName = utils_1.ensureRealAstroFilePath(fileName);
|
|
142
|
+
fileName = (0, utils_1.ensureRealAstroFilePath)(fileName);
|
|
143
143
|
let doc = snapshotManager.get(fileName);
|
|
144
144
|
if (doc) {
|
|
145
145
|
return doc;
|
|
146
146
|
}
|
|
147
|
-
doc = DocumentSnapshot_1.createDocumentSnapshot(fileName, null, docContext.createDocument);
|
|
147
|
+
doc = (0, DocumentSnapshot_1.createDocumentSnapshot)(fileName, null, docContext.createDocument);
|
|
148
148
|
snapshotManager.set(fileName, doc);
|
|
149
149
|
return doc;
|
|
150
150
|
}
|
|
@@ -41,7 +41,7 @@ class ModuleResolutionCache {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
getKey(moduleName, containingFile) {
|
|
44
|
-
return containingFile + ':::' + utils_1.ensureRealAstroFilePath(moduleName);
|
|
44
|
+
return containingFile + ':::' + (0, utils_1.ensureRealAstroFilePath)(moduleName);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
@@ -57,7 +57,7 @@ class ModuleResolutionCache {
|
|
|
57
57
|
* @param compilerOptions The typescript compiler options
|
|
58
58
|
*/
|
|
59
59
|
function createAstroModuleLoader(getSnapshot, compilerOptions) {
|
|
60
|
-
const astroSys = astro_sys_1.createAstroSys(getSnapshot);
|
|
60
|
+
const astroSys = (0, astro_sys_1.createAstroSys)(getSnapshot);
|
|
61
61
|
const moduleCache = new ModuleResolutionCache();
|
|
62
62
|
return {
|
|
63
63
|
fileExists: astroSys.fileExists,
|
|
@@ -86,17 +86,17 @@ function createAstroModuleLoader(getSnapshot, compilerOptions) {
|
|
|
86
86
|
// If that does not bring up anything, try the Astro Module loader
|
|
87
87
|
// which is able to deal with .astro files.
|
|
88
88
|
const tsResolvedModule = typescript_1.default.resolveModuleName(name, containingFile, compilerOptions, typescript_1.default.sys).resolvedModule;
|
|
89
|
-
if (tsResolvedModule && !utils_1.isVirtualAstroFilePath(tsResolvedModule.resolvedFileName)) {
|
|
89
|
+
if (tsResolvedModule && !(0, utils_1.isVirtualAstroFilePath)(tsResolvedModule.resolvedFileName)) {
|
|
90
90
|
return tsResolvedModule;
|
|
91
91
|
}
|
|
92
92
|
const astroResolvedModule = typescript_1.default.resolveModuleName(name, containingFile, compilerOptions, astroSys).resolvedModule;
|
|
93
|
-
if (!astroResolvedModule || !utils_1.isVirtualAstroFilePath(astroResolvedModule.resolvedFileName)) {
|
|
93
|
+
if (!astroResolvedModule || !(0, utils_1.isVirtualAstroFilePath)(astroResolvedModule.resolvedFileName)) {
|
|
94
94
|
return astroResolvedModule;
|
|
95
95
|
}
|
|
96
|
-
const resolvedFileName = utils_1.ensureRealAstroFilePath(astroResolvedModule.resolvedFileName);
|
|
96
|
+
const resolvedFileName = (0, utils_1.ensureRealAstroFilePath)(astroResolvedModule.resolvedFileName);
|
|
97
97
|
const snapshot = getSnapshot(resolvedFileName);
|
|
98
98
|
const resolvedastroModule = {
|
|
99
|
-
extension: utils_1.getExtensionFromScriptKind(snapshot && snapshot.scriptKind),
|
|
99
|
+
extension: (0, utils_1.getExtensionFromScriptKind)(snapshot && snapshot.scriptKind),
|
|
100
100
|
resolvedFileName,
|
|
101
101
|
};
|
|
102
102
|
return resolvedastroModule;
|
|
@@ -151,7 +151,7 @@ function convertRange(document, range) {
|
|
|
151
151
|
}
|
|
152
152
|
exports.convertRange = convertRange;
|
|
153
153
|
function convertToLocationRange(defDoc, textSpan) {
|
|
154
|
-
const range = documents_1.mapRangeToOriginal(defDoc, convertRange(defDoc, textSpan));
|
|
154
|
+
const range = (0, documents_1.mapRangeToOriginal)(defDoc, convertRange(defDoc, textSpan));
|
|
155
155
|
// Some definition like the svelte component class definition don't exist in the original, so we map to 0,1
|
|
156
156
|
if (range.start.line < 0) {
|
|
157
157
|
range.start.line = 0;
|
|
@@ -226,7 +226,7 @@ function ensureRealFilePath(filePath) {
|
|
|
226
226
|
}
|
|
227
227
|
exports.ensureRealFilePath = ensureRealFilePath;
|
|
228
228
|
function findTsConfigPath(fileName, rootUris) {
|
|
229
|
-
const searchDir = path_1.dirname(fileName);
|
|
229
|
+
const searchDir = (0, path_1.dirname)(fileName);
|
|
230
230
|
const path = ts.findConfigFile(searchDir, ts.sys.fileExists, 'tsconfig.json') || ts.findConfigFile(searchDir, ts.sys.fileExists, 'jsconfig.json') || '';
|
|
231
231
|
// Don't return config files that exceed the current workspace context.
|
|
232
232
|
return !!path && rootUris.some((rootUri) => isSubPath(rootUri, path)) ? path : '';
|
|
@@ -234,7 +234,7 @@ function findTsConfigPath(fileName, rootUris) {
|
|
|
234
234
|
exports.findTsConfigPath = findTsConfigPath;
|
|
235
235
|
/** */
|
|
236
236
|
function isSubPath(uri, possibleSubPath) {
|
|
237
|
-
return utils_1.pathToUrl(possibleSubPath).startsWith(uri);
|
|
237
|
+
return (0, utils_1.pathToUrl)(possibleSubPath).startsWith(uri);
|
|
238
238
|
}
|
|
239
239
|
exports.isSubPath = isSubPath;
|
|
240
240
|
/** Substitutes */
|
package/dist/server.js
CHANGED
|
@@ -12,7 +12,7 @@ const TagCloseRequest = new vscode_languageserver_1.RequestType('html/tag');
|
|
|
12
12
|
* Starts `astro-languageservice`
|
|
13
13
|
*/
|
|
14
14
|
function startServer() {
|
|
15
|
-
let connection = vscode_languageserver_1.createConnection(vscode_languageserver_1.ProposedFeatures.all);
|
|
15
|
+
let connection = (0, vscode_languageserver_1.createConnection)(vscode_languageserver_1.ProposedFeatures.all);
|
|
16
16
|
const docManager = documents_1.DocumentManager.newInstance();
|
|
17
17
|
const configManager = new config_1.ConfigManager();
|
|
18
18
|
const pluginHost = new plugins_1.PluginHost(docManager);
|
|
@@ -83,14 +83,14 @@ function startServer() {
|
|
|
83
83
|
});
|
|
84
84
|
connection.onDidCloseTextDocument((evt) => docManager.closeDocument(evt.textDocument.uri));
|
|
85
85
|
const diagnosticsManager = new DiagnosticsManager_1.DiagnosticsManager(connection.sendDiagnostics, docManager, pluginHost.getDiagnostics.bind(pluginHost));
|
|
86
|
-
const updateAllDiagnostics = utils_1.debounceThrottle(() => diagnosticsManager.updateAll(), 1000);
|
|
86
|
+
const updateAllDiagnostics = (0, utils_1.debounceThrottle)(() => diagnosticsManager.updateAll(), 1000);
|
|
87
87
|
connection.onDidChangeTextDocument((evt) => {
|
|
88
88
|
docManager.updateDocument(evt.textDocument.uri, evt.contentChanges);
|
|
89
89
|
});
|
|
90
90
|
connection.onDidChangeWatchedFiles((evt) => {
|
|
91
91
|
const params = evt.changes
|
|
92
92
|
.map((change) => ({
|
|
93
|
-
fileName: utils_1.urlToPath(change.uri),
|
|
93
|
+
fileName: (0, utils_1.urlToPath)(change.uri),
|
|
94
94
|
changeType: change.type,
|
|
95
95
|
}))
|
|
96
96
|
.filter((change) => !!change.fileName);
|
|
@@ -122,7 +122,7 @@ function startServer() {
|
|
|
122
122
|
connection.onRequest(TagCloseRequest, (evt) => pluginHost.doTagComplete(evt.textDocument, evt.position));
|
|
123
123
|
connection.onSignatureHelp((evt, cancellationToken) => pluginHost.getSignatureHelp(evt.textDocument, evt.position, evt.context, cancellationToken));
|
|
124
124
|
connection.onRenameRequest(evt => pluginHost.rename(evt.textDocument, evt.position, evt.newName));
|
|
125
|
-
docManager.on('documentChange', utils_1.debounceThrottle(async (document) => diagnosticsManager.update(document), 1000));
|
|
125
|
+
docManager.on('documentChange', (0, utils_1.debounceThrottle)(async (document) => diagnosticsManager.update(document), 1000));
|
|
126
126
|
docManager.on('documentClose', (document) => diagnosticsManager.removeDiagnostics(document));
|
|
127
127
|
connection.listen();
|
|
128
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/language-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"author": "Skypack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"source-map": "^0.7.3",
|
|
25
25
|
"ts-morph": "^12.0.0",
|
|
26
|
-
"typescript": "^4.
|
|
26
|
+
"typescript": "^4.5.1-rc",
|
|
27
27
|
"vscode-css-languageservice": "^5.1.1",
|
|
28
28
|
"vscode-emmet-helper": "2.1.2",
|
|
29
29
|
"vscode-html-languageservice": "^3.0.3",
|