Parse the document and return cursor position, or null if not WAT content.
(lsp: WatLSP, view: EditorView)
| 311 | |
| 312 | /** Parse the document and return cursor position, or null if not WAT content. */ |
| 313 | function 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 | |
| 327 | function goToDefinition(lsp: WatLSP, view: EditorView): boolean { |
| 328 | try { |
no test coverage detected