MCPcopy Create free account
hub / github.com/EmNudge/watlings / lspCursorContext

Function lspCursorContext

web-build/src/editor.ts:313–325  ·  view source on GitHub ↗

Parse the document and return cursor position, or null if not WAT content.

(lsp: WatLSP, view: EditorView)

Source from the content-addressed store, hash-verified

311
312/** Parse the document and return cursor position, or null if not WAT content. */
313function lspCursorContext(lsp: WatLSP, view: EditorView) {
314 const text = view.state.doc.toString();
315 if (!isWatContent(text)) return null;
316
317 const pos = view.state.selection.main.head;
318 const line = view.state.doc.lineAt(pos);
319 lsp.parse(text);
320 return {
321 doc: view.state.doc,
322 lineNum: line.number - 1,
323 col: pos - line.from,
324 };
325}
326
327function goToDefinition(lsp: WatLSP, view: EditorView): boolean {
328 try {

Callers 2

goToDefinitionFunction · 0.85
findReferencesFunction · 0.85

Calls 1

isWatContentFunction · 0.85

Tested by

no test coverage detected