@marko/language-server 2.0.1 → 2.0.3
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/dist/index.js +12 -4
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +4 -4
- package/dist/service/marko/util/get-tag-name-completion.d.ts +1 -1
- package/dist/service/marko/util/is-html.d.ts +2 -0
- package/dist/utils/file.d.ts +1 -1
- package/package.json +4 -5
package/dist/index.mjs
CHANGED
|
@@ -1190,6 +1190,13 @@ import {
|
|
|
1190
1190
|
TextEdit as TextEdit3
|
|
1191
1191
|
} from "vscode-languageserver";
|
|
1192
1192
|
import { URI as URI3 } from "vscode-uri";
|
|
1193
|
+
|
|
1194
|
+
// src/service/marko/util/is-html.ts
|
|
1195
|
+
function isHTML(tag) {
|
|
1196
|
+
return tag ? !(tag.types || tag.template || tag.renderer) && tag.html : false;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// src/service/marko/util/get-tag-name-completion.ts
|
|
1193
1200
|
var deprecated = [CompletionItemTag.Deprecated];
|
|
1194
1201
|
function getTagNameCompletion({
|
|
1195
1202
|
tag,
|
|
@@ -1205,9 +1212,10 @@ function getTagNameCompletion({
|
|
|
1205
1212
|
);
|
|
1206
1213
|
const nodeModuleName = nodeModuleMatch && nodeModuleMatch[1];
|
|
1207
1214
|
const isCoreTag = /^@?marko[/-]/.test(tag.taglibId || tag.filePath) || nodeModuleName === "marko";
|
|
1215
|
+
const html = isHTML(tag);
|
|
1208
1216
|
const documentation = {
|
|
1209
1217
|
kind: MarkupKind2.Markdown,
|
|
1210
|
-
value:
|
|
1218
|
+
value: html ? `Built in [<${tag.name}>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/${tag.name}) HTML tag.` : isCoreTag ? `Core Marko <${tag.name}> tag.` : nodeModuleName ? `Custom Marko tag discovered from the ["${nodeModuleName}"](${fileURIForTag}) npm package.` : `Custom Marko tag discovered from:
|
|
1211
1219
|
|
|
1212
1220
|
[${importer ? path4.relative(importer, fileForTag) : fileForTag}](${fileURIForTag})`
|
|
1213
1221
|
};
|
|
@@ -1237,7 +1245,7 @@ ${autocomplete.description}`;
|
|
|
1237
1245
|
documentation,
|
|
1238
1246
|
tags: tag.deprecated ? deprecated : void 0,
|
|
1239
1247
|
insertTextFormat: autocomplete ? InsertTextFormat2.Snippet : void 0,
|
|
1240
|
-
kind:
|
|
1248
|
+
kind: html ? CompletionItemKind3.Property : CompletionItemKind3.Class,
|
|
1241
1249
|
textEdit: range && TextEdit3.replace(range, autocomplete?.snippet || label)
|
|
1242
1250
|
};
|
|
1243
1251
|
}
|
|
@@ -1646,7 +1654,7 @@ function extractDocumentSymbols({
|
|
|
1646
1654
|
case NodeType8.AttrTag:
|
|
1647
1655
|
symbols.push({
|
|
1648
1656
|
name: (node.type === NodeType8.AttrTag ? node.nameText?.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
|
|
1649
|
-
kind: node.nameText && lookup.getTag(node.nameText)
|
|
1657
|
+
kind: node.nameText && isHTML(lookup.getTag(node.nameText)) && SymbolKind.Property || SymbolKind.Class,
|
|
1650
1658
|
location: {
|
|
1651
1659
|
uri,
|
|
1652
1660
|
range: parsed.locationAt(node)
|
|
@@ -1776,7 +1784,7 @@ var doHover = async (doc, params) => {
|
|
|
1776
1784
|
};
|
|
1777
1785
|
|
|
1778
1786
|
// src/service/marko/validate.ts
|
|
1779
|
-
import { DiagnosticType } from "@marko/babel-utils";
|
|
1787
|
+
import { DiagnosticType } from "@marko/compiler/babel-utils";
|
|
1780
1788
|
import { Project as Project4 } from "@marko/language-tools";
|
|
1781
1789
|
import path6 from "path";
|
|
1782
1790
|
import { DiagnosticSeverity } from "vscode-languageserver";
|