@ripple-ts/language-server 0.3.68 → 0.3.70
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/language-server.js
CHANGED
|
@@ -21204,15 +21204,6 @@ function generateImportEdit(documentText, importName) {
|
|
|
21204
21204
|
* Adds custom completions for Ripple syntax patterns
|
|
21205
21205
|
*/
|
|
21206
21206
|
const RIPPLE_SNIPPETS = [
|
|
21207
|
-
{
|
|
21208
|
-
label: "{style}",
|
|
21209
|
-
kind: import_language_server.CompletionItemKind.Snippet,
|
|
21210
|
-
detail: "Scoped CSS class reference",
|
|
21211
|
-
documentation: "Produces a scoped CSS class string for passing to child components.\nThe class must be defined as a standalone selector in <style>.\n\nUsage: <Child cls={style \"highlight\"} />",
|
|
21212
|
-
insertText: "style \"${1:className}\"",
|
|
21213
|
-
insertTextFormat: import_language_server.InsertTextFormat.Snippet,
|
|
21214
|
-
sortText: "0-style"
|
|
21215
|
-
},
|
|
21216
21207
|
{
|
|
21217
21208
|
label: "module server",
|
|
21218
21209
|
kind: import_language_server.CompletionItemKind.Snippet,
|
|
@@ -21223,13 +21214,13 @@ const RIPPLE_SNIPPETS = [
|
|
|
21223
21214
|
sortText: "0-module-server"
|
|
21224
21215
|
},
|
|
21225
21216
|
{
|
|
21226
|
-
label: "component",
|
|
21217
|
+
label: "function component",
|
|
21227
21218
|
kind: import_language_server.CompletionItemKind.Snippet,
|
|
21228
|
-
detail: "Ripple
|
|
21219
|
+
detail: "Ripple component function",
|
|
21229
21220
|
documentation: "Create a new Ripple component",
|
|
21230
|
-
insertText: "
|
|
21221
|
+
insertText: "function ${1:ComponentName}(${2:props}) {\n return <>\n $0\n </>;\n}",
|
|
21231
21222
|
insertTextFormat: import_language_server.InsertTextFormat.Snippet,
|
|
21232
|
-
sortText: "0-component"
|
|
21223
|
+
sortText: "0-function-component"
|
|
21233
21224
|
},
|
|
21234
21225
|
{
|
|
21235
21226
|
label: "track",
|
|
@@ -21947,12 +21938,11 @@ function createSymbolForDeclaration(node, document, fallbackName) {
|
|
|
21947
21938
|
let id = node.id ?? null;
|
|
21948
21939
|
let name = id ? getIdentifierName(id) : null;
|
|
21949
21940
|
switch (type) {
|
|
21950
|
-
case "Component":
|
|
21951
21941
|
case "FunctionDeclaration": {
|
|
21952
21942
|
const children = getChildSymbols(node, document);
|
|
21953
21943
|
if (!id || !name) if (fallbackName) {
|
|
21954
21944
|
name = fallbackName;
|
|
21955
|
-
id = createFallbackIdentifierNode(node,
|
|
21945
|
+
id = createFallbackIdentifierNode(node, "function");
|
|
21956
21946
|
} else return children;
|
|
21957
21947
|
return [createNamedNodeSymbol(name, import_language_server.SymbolKind.Function, node, id, document, children)];
|
|
21958
21948
|
}
|
|
@@ -22026,7 +22016,7 @@ function createBindingPatternSymbols(pattern, kind, document, rangeNode = patter
|
|
|
22026
22016
|
* @returns {SymbolInfo[]}
|
|
22027
22017
|
*/
|
|
22028
22018
|
function getInitializerChildSymbols(node, document) {
|
|
22029
|
-
if (node.type === "
|
|
22019
|
+
if (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return getChildSymbols(node, document);
|
|
22030
22020
|
return [];
|
|
22031
22021
|
}
|
|
22032
22022
|
/**
|
|
@@ -22036,11 +22026,46 @@ function getInitializerChildSymbols(node, document) {
|
|
|
22036
22026
|
*/
|
|
22037
22027
|
function getChildSymbols(node, document) {
|
|
22038
22028
|
const body = node.body;
|
|
22039
|
-
if (
|
|
22040
|
-
|
|
22029
|
+
if (isTemplateNode(body)) return getTemplateChildSymbols(body, document);
|
|
22030
|
+
if (Array.isArray(body)) {
|
|
22031
|
+
const statements = body;
|
|
22032
|
+
return [...collectSymbolsFromStatements(statements, document), ...statements.flatMap((statement) => getReturnedTemplateSymbols(statement, document))];
|
|
22033
|
+
} else if (Array.isArray(body?.body)) {
|
|
22034
|
+
const statements = body.body;
|
|
22035
|
+
return [...collectSymbolsFromStatements(statements, document), ...statements.flatMap((statement) => getReturnedTemplateSymbols(statement, document))];
|
|
22036
|
+
}
|
|
22041
22037
|
return [];
|
|
22042
22038
|
}
|
|
22043
22039
|
/**
|
|
22040
|
+
* @param {AST.Node} node
|
|
22041
|
+
* @param {TextDocument} document
|
|
22042
|
+
* @returns {SymbolInfo[]}
|
|
22043
|
+
*/
|
|
22044
|
+
function getReturnedTemplateSymbols(node, document) {
|
|
22045
|
+
if (node.type !== "ReturnStatement" || !node.argument) return [];
|
|
22046
|
+
return getTemplateChildSymbols(node.argument, document);
|
|
22047
|
+
}
|
|
22048
|
+
/**
|
|
22049
|
+
* @param {AST.Node | null | undefined} node
|
|
22050
|
+
* @returns {boolean}
|
|
22051
|
+
*/
|
|
22052
|
+
function isTemplateNode(node) {
|
|
22053
|
+
return !!node && (node.type === "Tsrx" || node.type === "Tsx" || node.type === "Element" || node.type === "JSXElement" || node.type === "JSXFragment");
|
|
22054
|
+
}
|
|
22055
|
+
/**
|
|
22056
|
+
* @param {AST.Node} node
|
|
22057
|
+
* @param {TextDocument} document
|
|
22058
|
+
* @returns {SymbolInfo[]}
|
|
22059
|
+
*/
|
|
22060
|
+
function getTemplateChildSymbols(node, document) {
|
|
22061
|
+
if (!isTemplateNode(node)) return [];
|
|
22062
|
+
const children = Array.isArray(
|
|
22063
|
+
/** @type {{ children?: AST.Node[] }} */
|
|
22064
|
+
node.children
|
|
22065
|
+
) ? node.children : [];
|
|
22066
|
+
return [...collectSymbolsFromStatements(children, document), ...children.flatMap((child) => getTemplateChildSymbols(child, document))];
|
|
22067
|
+
}
|
|
22068
|
+
/**
|
|
22044
22069
|
* @param {AST.ClassDeclaration} node
|
|
22045
22070
|
* @param {TextDocument} document
|
|
22046
22071
|
* @returns {SymbolInfo[]}
|
|
@@ -22294,4 +22319,4 @@ Object.defineProperty(exports, 'createRippleLanguageServer', {
|
|
|
22294
22319
|
return createRippleLanguageServer;
|
|
22295
22320
|
}
|
|
22296
22321
|
});
|
|
22297
|
-
//# sourceMappingURL=server-
|
|
22322
|
+
//# sourceMappingURL=server-CiwRUSRR.js.map
|