Expand description
A language server for Nifty: diagnostics, completion, signature help, semantic highlighting, the document outline, go to definition, find references and highlighting the name under the cursor. Every file of a project folder is analysed together, so names resolve across files.
Modulesยง
- context ๐
- What kind of code the cursor is in, worked out from the tokens before it. Code being typed rarely parses, so this reads tokens rather than the syntax tree: it only needs to know which blocks, calls and brackets are open and what came last.
- document ๐
- One source file of a project: its text, its syntax tree, and conversion between byte offsets and LSP positions.
- features ๐
- One module per LSP feature. Each turns a
Documentinto protocol types and knows nothing about the connection. - index ๐
- Every name in a projectโs files, each tied to the declaration it refers to when one exists in the project. Built-in elements, built-in types, fields reached through a value and implicit members have no declaration until the type checker exists, so they stay unresolved.
- project ๐
- The files of one program, analysed together: a project folderโs
.nffiles, or a single file outside any project. A name declared in one file resolves in all of them. - server ๐
- The message loop: keeps open documents up to date and answers requests about them.
- signature ๐
- The parameters of whatever a call names: a built-in element or function, or a function, view or struct declared in any file of the project.
- workspace ๐
- The open documents and the projects they belong to. A document inside a project folder is
analysed with every other
.nffile of that project, open or not; a document outside one is a project of its own. Open documentsโ text wins over what is saved on disk.
Constantsยง
- SERVER_
NAME ๐
Functionsยง
- capabilities ๐
- run
- Serves the language server protocol over stdin and stdout until the client exits.
- serve ๐