Indexed
Reference

LSP commands

indexed lsp — serve the index to any editor over the Language Server Protocol (stdio), with client setup.

LSP commands

indexed lsp is a Language Server Protocol server over stdio. Point any LSP client at it (Neovim, Zed, Helix, or a VS Code LSP client extension) and the same collections the CLI and MCP server read become available where you are actually looking at code:

  • workspace/symbol — search the knowledge base from the editor's symbol palette;
  • textDocument/hover — see what the index knows about the file under your cursor, with provenance;
  • textDocument/definition — jump to the indexed chunk(s) that mention the identifier under the cursor;
  • textDocument/references — list the indexed chunks that mention it, bounded;
  • textDocument/publishDiagnostics — two facts the index can actually prove, both Information-level, never fabricated.

For global indexed options (before the subcommand), see Other commands — global options. For the agent-facing surface, see MCP commands.


indexed lsp

indexed lsp                 # global storage (~/.indexed)
indexed --local lsp         # the workspace's ./.indexed storage

The command starts a server on stdin/stdout and stays in the foreground. It speaks LSP 3.17 framing (Content-Length: N\r\n\r\n<json>) and nothing else: stdout carries protocol frames only; diagnostics go to stderr.

Storage mode is resolved exactly like every other command — --local forces the workspace store, otherwise the global store is used. Start the server from the directory you want the --local mode to resolve against.

There is one server process, one store, and no second lifecycle: before initialize every request is refused with ServerNotInitialized (-32002), after shutdown with InvalidRequest (-32600), and any method that is not implemented with MethodNotFound (-32601).


What the server advertises

initialize returns exactly this capability set — nothing that is not implemented and tested is ever advertised:

{
  "capabilities": {
    "textDocumentSync": {
      "openClose": true,
      "change": 0,
      "save": { "includeText": false }
    },
    "definitionProvider": true,
    "hoverProvider": true,
    "referencesProvider": true,
    "workspaceSymbolProvider": true
  },
  "serverInfo": { "name": "indexed", "version": "<installed version>" }
}
CapabilityBehaviour
workspace/symbolRuns a semantic search over the active collections. Each SymbolInformation.location.uri is the matched document's real uri (file://… for local sources) and the range comes from the chunk's own line metadata (0-based, end-exclusive — LSP's own encoding, so it never needs translating).
textDocument/hoverTakes the identifier under the cursor from the file on disk, searches the collection that owns that file, and returns markdown: the chunk text, its collection, source type, index freshness, relevance and raw score.
textDocument/definitionResolves the strict identifier under the cursor to up to 5 chunk locations in the owning collection, in the engine's ranking order. null when nothing matches.
textDocument/referencesThe same lookup, wider and capped: up to 50 locations from the engine's top 10 documents / 40 chunks. Returns [] — never null — when nothing matches.
textDocument/publishDiagnosticsServer → client, only when the client declared support. Two codes, both Information.
anything elseMethodNotFound (-32601). Unsupported requests are refused, never answered with a misleading empty result.

textDocumentSync is an options object, not 0, but change stays 0: the server never holds a buffer. It reads the file from disk, so there is nothing to do per keystroke and it does not ask the client to stream document content. openClose and save are enabled because they are the trigger for diagnostics — nothing else. Save before hovering or jumping.


Definition and references

Both methods answer from the same index and the same resolver, so they cannot disagree about what a chunk says:

  1. Read the identifier strictly under the cursor — [A-Za-z_][A-Za-z0-9_]*. A cursor in whitespace, an unowned file, or a non-file:// URI short-circuits to no answer without touching the index.
  2. Search the collection that owns the file (not the whole store — see Limitations).
  3. Keep only hits where the identifier appears as a whole token, so alpha does not match alphabet.
  4. Report each hit's indexed span — the chunk's own lines — or, when the source carries no line span, a range measured from the whole document.

They differ only in bounds and in the empty answer:

definitionreferences
ResultLocation[] (up to 5) or nullLocation[] (up to 50), [] when empty
Search bounds5 documents / 15 chunks10 documents / 40 chunks
context.includeDeclarationn/aaccepted and ignored

includeDeclaration is ignored on purpose: chunks do not carry a "this is a declaration" bit, so filtering on it would be a guess. The declaration is returned among the references, which is the honest half of that flag.

The answer is chunk-level, not a symbol table

indexed does not build a symbol table and does not resolve scope. A definition answer is "the chunks in this collection that mention the identifier", in the engine's relevance order — which means a call site can outrank the declaration, and a reference list is the top hits, not an exhaustive scan. That is why definition returns several locations instead of one, and why the caps above are in the contract rather than an implementation detail.

When a source has no line span (Markdown headings, plain documents), the location is the whole document, measured from the real file:

file:///repo/docs/notes.md   0:0 → 5:0      # whole file, no invented line

A span-less hit in a remote source (a Jira or Confluence chunk) yields no location at all: there is no local file to measure, and inventing 0:0 would be a fabricated position.


Diagnostics

publishDiagnostics reports exactly two things, both read from metadata the index wrote itself:

CodeMeaningFix
not-in-any-collectionNo collection's source root contains this file, so indexed search can never return it.Add the directory to a collection's sources, or index from the right root.
index-staleThe collection indexed a different version of this file — its own recorded fingerprint disagrees with the file on disk.indexed index update <collection>

Both are DiagnosticSeverity.Information (3), source: "indexed", with a range measured from the whole document. No code path can emit Error or Warning — the index has no opinion about types or lint rules, and painting a file red for either fact would be a fabrication.

Publishing rules:

  • on textDocument/didOpen and textDocument/didSave — the server's only reaction to document events;
  • [] is published when the file is healthy, and on textDocument/didClose, so a stale marker never outlives the session that set it;
  • only to a client that declared textDocument.publishDiagnostics in initialize capabilities (an undeclared capability defaults to false in LSP);
  • unknown is silence. A file with no state.json (never indexed, or migrated from v1) or no entry for that path gets nothing at all — not "healthy", and emphatically not "broken".

diagnosticProvider is deliberately not advertised: pull-model diagnostics are not implemented, so nothing claims they are.


Client setup

Neovim (LSP built in, no plugin required)

The server is client-agnostic, so Neovim 0.11+ can start it directly:

-- ~/.config/nvim/lua/indexed_lsp.lua
local function attach()
  vim.lsp.start({
    name = "indexed",
    -- Drop --local to use the global store instead of ./.indexed
    cmd = { "indexed", "--local", "lsp" },
    root_dir = vim.fs.root(0, { ".indexed", ".git" }) or vim.fn.getcwd(),
  })
end

vim.api.nvim_create_autocmd("FileType", {
  pattern = { "python", "javascript", "typescript", "go", "rust", "markdown" },
  callback = attach,
})
-- then: require("indexed_lsp")
vim.keymap.set("n", "K", vim.lsp.buf.hover)                     -- indexed hover
vim.keymap.set("n", "gd", vim.lsp.buf.definition)              -- indexed definition
vim.keymap.set("n", "gr", vim.lsp.buf.references)              -- indexed references
vim.keymap.set("n", "<leader>is", vim.lsp.buf.workspace_symbol) -- search the index

With nvim-lspconfig, the same server is one custom entry (there is no upstream indexed config yet, so register it once before calling setup):

-- ~/.config/nvim/lua/indexed_lspconfig.lua
local configs = require("lspconfig.configs")
local lspconfig = require("lspconfig")

if not configs.indexed then
  configs.indexed = {
    default_config = {
      cmd = { "indexed", "lsp" },          -- add "--local" for ./.indexed
      filetypes = { "python", "markdown" }, -- the filetypes you index
      root_dir = lspconfig.util.root_pattern(".indexed", ".git"),
    },
  }
end

lspconfig.indexed.setup({})

VS Code

VS Code has no generic "attach an LSP binary from settings.json" hook — it needs an LSP client extension. Indexed does not ship one: install a generic LSP client extension, register indexed lsp as a stdio server, and enable it for the filetypes you index. The server side needs no VS Code-specific code, which is exactly why the same binary works in Neovim, Zed and Helix.

Zed / Helix

Both accept custom language servers in their config (lsp block / languages.toml) with command = "indexed" and args = ["lsp"], launched from the project root.


What hover and symbols contain

A hover answers from the top matching chunk:

**indexed** · `my-project` · localFiles · indexed 2 hours ago

```python
def unified_relevance(raw_score, score_kind):
    return 1.0
```

`/repo/src/indexed/utils/relevance.py:21-23` · relevance 0.6250 · score 0.7500 (l2_squared) · query `unified_relevance`
  • collection — which collection answered;
  • source type — localFiles, jira, confluence, … from the collection's manifest (or unknown when the manifest does not say);
  • freshness — when that collection was last indexed, so a stale index is visible instead of silent;
  • relevance — one comparable 0–1 measure across engines, the same number indexed search --json reports. The engine's raw score follows in brackets with its kind (l2_squared for v1, cosine/rerank for v2) for anyone comparing within one engine: a raw L2 distance is smaller when the match is better, which is why it is not the headline.

Symbol hits are ordered by the engine's ranking. A hit whose source carries no line span (Markdown headings, plain documents) is still listed, with a document-level range — the server never invents a position the index does not know. Hover, symbols, definition and references all take a chunk's position from the same provenance helper (build_locator), and diagnostics measure their range with the same file-level rule — so the four surfaces cannot disagree about where a chunk is.


Limitations

These are deliberate, not missing wiring:

  • Chunk-level, not a symbol table. Definition and references answer from chunk matches ranked by relevance; a call site can outrank a declaration, and a reference ranked below the cap is simply not listed. The caps are in the contract above.
  • Scope is the owning collection. Hover, definition and references search the collection whose source root contains the file, not every collection (issue #126). A definition living in another collection is not found.
  • Hover and jumps need a file inside an indexed collection's source root. A file no collection owns gets null/[] and a not-in-any-collection diagnostic; the server does not scan the whole store on every keystroke.
  • Staleness needs state.json. Collections indexed by the current version record per-file fingerprints; a v1-migrated collection may have none, in which case the server says nothing rather than guessing.
  • No completions, signature help or formatting — indexed is not a type checker and does not resolve scope.
  • First query after start is slow (model load + collection recovery, ~2 s on a real store; subsequent queries are milliseconds). The server sends no progress notifications yet.
  • stdio only — no TCP/websocket transport, and no LSP client extension is published for any editor.

On this page