summaryrefslogtreecommitdiff
path: root/src/lsp/lsp.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/lsp/lsp.zig')
-rw-r--r--src/lsp/lsp.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig
index b8356724..0ce70869 100644
--- a/src/lsp/lsp.zig
+++ b/src/lsp/lsp.zig
@@ -51,6 +51,12 @@ pub const Kind = enum {
format,
/// SPC h
select_refs,
+ /// Tab in insert mode, with a `.` immediately before the cursor. NOT an
+ /// autocomplete popup — the seam returns locations, so this answers "what
+ /// could go here, and where is each of those DEFINED": one row per
+ /// candidate, pointing at its declaration, in the same `+Search` buffer
+ /// `gr` fills. Nothing is inserted.
+ completion,
// The two introspection kinds. A backend that answers nothing is
// indistinguishable from a backend that is broken, so these exist to tell
@@ -160,6 +166,9 @@ pub fn query(gpa: std.mem.Allocator, arena: std.mem.Allocator, req: Req, out: *s
/// base tree shipped with.
const backend = if (@import("pardes_config").zls_backend) @import("lsp_zls.zig") else struct {
pub fn query(_: std.mem.Allocator, _: std.mem.Allocator, _: Req, _: *std.Io.Writer) void {}
+ pub fn speaks(_: []const u8) bool {
+ return false;
+ }
pub const supports: std.EnumSet(Kind) = .initEmpty();
};
@@ -169,5 +178,15 @@ const backend = if (@import("pardes_config").zls_backend) @import("lsp_zls.zig")
/// does not have shows up immediately in the harness's matrix.
pub const supports: std.EnumSet(Kind) = backend.supports;
+/// Does the backend read this file's LANGUAGE at all? `supports` answers what
+/// a backend can do; this answers what it can do it TO, and it exists for the
+/// one key that must not be eaten when the answer is no: insert-mode Tab
+/// diverts to `completion` after a `.`, so in a README — or in any pane the
+/// backend would refuse — it has to indent instead. The core asks rather than
+/// knowing, so the list of extensions stays the backend's business.
+pub fn speaks(path: []const u8) bool {
+ return backend.speaks(path);
+}
+
/// Name shown by the harness and in `SPC ?`. Each implementation renames it.
pub const backend_name = "zls-inproc";