@marko/language-server 0.12.10 → 0.12.13
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 +426 -248
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +410 -231
- package/dist/index.mjs.map +3 -3
- package/dist/service/marko/complete/Statement.d.ts +3 -0
- package/dist/service/marko/document-symbols/extract.d.ts +8 -0
- package/dist/service/marko/document-symbols/index.d.ts +2 -0
- package/dist/service/marko/hover/OpenTagName.d.ts +3 -0
- package/dist/service/marko/hover/index.d.ts +14 -0
- package/dist/service/marko/util/get-tag-name-completion.d.ts +8 -0
- package/dist/service/types.d.ts +2 -1
- package/dist/utils/file-system.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TaglibLookup } from "@marko/babel-utils";
|
|
2
|
+
import { SymbolInformation } from "vscode-languageserver";
|
|
3
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
4
|
+
import { type parse } from "../../../utils/parser";
|
|
5
|
+
/**
|
|
6
|
+
* Iterate over the Marko CST and extract all the symbols (mostly tags) in the document.
|
|
7
|
+
*/
|
|
8
|
+
export declare function extractDocumentSymbols(doc: TextDocument, parsed: ReturnType<typeof parse>, lookup: TaglibLookup): SymbolInformation[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
2
|
+
import type { HoverParams, Hover } from "vscode-languageserver";
|
|
3
|
+
import { getCompilerInfo, parse } from "../../../utils/compiler";
|
|
4
|
+
import type { Plugin, Result } from "../../types";
|
|
5
|
+
export declare type HoverResult = Result<Hover>;
|
|
6
|
+
export interface HoverMeta<N = unknown> extends ReturnType<typeof getCompilerInfo> {
|
|
7
|
+
document: TextDocument;
|
|
8
|
+
params: HoverParams;
|
|
9
|
+
parsed: ReturnType<typeof parse>;
|
|
10
|
+
offset: number;
|
|
11
|
+
code: string;
|
|
12
|
+
node: N;
|
|
13
|
+
}
|
|
14
|
+
export declare const doHover: Plugin["doHover"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TagDefinition } from "@marko/babel-utils";
|
|
2
|
+
import { type CompletionItem, type Range } from "vscode-languageserver";
|
|
3
|
+
export default function getTagNameCompletion({ tag, range, showAutoComplete, importer, }: {
|
|
4
|
+
tag: TagDefinition;
|
|
5
|
+
range?: Range;
|
|
6
|
+
importer?: string;
|
|
7
|
+
showAutoComplete?: true;
|
|
8
|
+
}): CompletionItem;
|
package/dist/service/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CancellationToken, CodeAction, CodeActionParams, ColorInformation, ColorPresentation, ColorPresentationParams, Command, CompletionItem, CompletionList, CompletionParams, DefinitionParams, Diagnostic, DocumentColorParams, DocumentFormattingParams, DocumentHighlight, DocumentHighlightParams, DocumentLink, DocumentLinkParams, Hover, HoverParams, InitializeParams, Location, LocationLink, ReferenceParams, RenameParams, TextEdit, WorkspaceEdit } from "vscode-languageserver";
|
|
1
|
+
import type { CancellationToken, CodeAction, CodeActionParams, ColorInformation, ColorPresentation, ColorPresentationParams, Command, CompletionItem, CompletionList, CompletionParams, DefinitionParams, Diagnostic, DocumentColorParams, DocumentFormattingParams, DocumentHighlight, DocumentHighlightParams, DocumentLink, DocumentLinkParams, DocumentSymbolParams, Hover, HoverParams, InitializeParams, Location, LocationLink, ReferenceParams, RenameParams, SymbolInformation, TextEdit, WorkspaceEdit } from "vscode-languageserver";
|
|
2
2
|
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
3
|
export declare type Result<V> = Promise<V | void> | V | void;
|
|
4
4
|
declare type Handler<P, R> = (doc: TextDocument, params: P extends null ? CancellationToken : P, token: P extends null ? never : CancellationToken) => Result<R>;
|
|
@@ -11,6 +11,7 @@ export declare type Plugin = {
|
|
|
11
11
|
doCodeActions: Handler<CodeActionParams, (Command | CodeAction)[]>;
|
|
12
12
|
findDefinition: Handler<DefinitionParams, Location | LocationLink | (Location | LocationLink)[]>;
|
|
13
13
|
findReferences: Handler<ReferenceParams, Location[]>;
|
|
14
|
+
findDocumentSymbols: Handler<DocumentSymbolParams, SymbolInformation[]>;
|
|
14
15
|
findDocumentLinks: Handler<DocumentLinkParams, DocumentLink[]>;
|
|
15
16
|
findDocumentHighlights: Handler<DocumentHighlightParams, DocumentHighlight[]>;
|
|
16
17
|
findDocumentColors: Handler<DocumentColorParams, ColorInformation[]>;
|
|
@@ -5,5 +5,5 @@ declare const _default: {
|
|
|
5
5
|
readDirectory: typeof readDirectory;
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
|
-
declare function stat(
|
|
9
|
-
declare function readDirectory(
|
|
8
|
+
declare function stat(uri: string): Promise<FileStat>;
|
|
9
|
+
declare function readDirectory(uri: string): Promise<[string, FileType][]>;
|