diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-08-02 15:24:45 +0200 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-08-11 00:38:31 +0200 |
| commit | 44f5bf677282308b959411c416da2b5b08db2062 (patch) | |
| tree | f350d7a16c3c3c431e2744ae321d781b27641413 /src/lsp.h | |
| parent | 9b78fc83dbd29b5594431b1c49b7d13865141aaa (diff) | |
support lookups via language servers (LSP)HEADmaster-fmsbw-cimaster
* The main interface is the `FT` command.
`FT` was an undocumented Video TECO command for etags/ctags lookups.
I don't want to exactly copy its interface, though.
* `FT` allows looking up symbol names,
definitions and references.
* ctags will be supported via ctags-lsp.
LSP support is more powerful though and works without
regenerating TAGS files all the time.
The LSP will also allow you to customize auto-completions
using SciTECO itself (i.e. by writing a language server
in SciTECO).
* For multiple results, `FT$` can be used to cycle through
results - this should mimic repeated `S$` or `N$`.
* `:FT...$` does a fuzzy search. IMHO it's not important
to return a status integer instead. `FT` will only
really be used in interactive mode.
* Document synchronization is supported via hooks from
ring.c and via Scintilla notifications.
* Currently, the LSP communication is based on blocking
GIOChannels. This means that a misbehaving hanging
server could "lock up" the entire editor (FIXME).
Only on ncurses you can always kill the subprocess by
pressing CTRL+C.
We need helper functions in spawn.c to read and write
with interruptions.
* The textDocument/didChange notification transmits
not only all edits, but all files' contents as well
during initial synchronization.
Therefore it is optimized to write and JSON-escape
data without copying them around in memory and without
destroying the buffer gap.
* Use $SCITECO_LSP to configure the language server.
You can also use `tee` to capture stdin and stdout.
Perhaps $SCITECO_LSP should be saved in .teco_session,
so you can change it between projects?
* $SCITECO_LSP_ROOT is used to point to the project's
root directory. session.tes will set it up automatically.
Diffstat (limited to 'src/lsp.h')
| -rw-r--r-- | src/lsp.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lsp.h b/src/lsp.h new file mode 100644 index 0000000..325c204 --- /dev/null +++ b/src/lsp.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2012-2026 Robin Haberkorn + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include <glib.h> + +#include "parser.h" +#include "ring.h" + +gboolean teco_lsp_didopen(teco_buffer_t *buffer, GError **error); +gboolean teco_lsp_didchange_insert(teco_buffer_t *buffer, gsize pos, gsize len, + const gchar *text, GError **error); +gboolean teco_lsp_didchange_delete(teco_buffer_t *buffer, gsize pos, gsize len, + GError **error); +gboolean teco_lsp_didclose(teco_buffer_t *buffer, GError **error); + +gboolean teco_lsp_sync(teco_buffer_t *buffer, GError **error); + +gboolean teco_lsp_symbol_auto_complete(const gchar *symbol, teco_string_t *insert); + +extern teco_state_t teco_state_lsp_lookup; |
