~/bend-docscommunity

src/lsp/proto.bend checks

raw source on the hub · import bolt@1.24.0.0/src/lsp/proto.bend as Proto

lsp/proto: the messages the server sends, and the little it reads of a URI.

13 imports
import Base
import 0xa81e161008ecc2f297c0a3065cb9b188/main.bend as Ezjson
import 0xa81e161008ecc2f297c0a3065cb9b188/src/value.bend as J
import ./frame.bend as Frame
import ./report.bend as Rep
import ../syntax/outline.bend as Outline
import ../syntax/bind.bend as Bind
import ./semantic.bend as Semantic
import ../finding.bend as Lint
import ../codes.bend as Codes
import ../config.bend as Config
import ../version.bend as Ver
import ./enc.bend as Enc

Definitions

def strings source · line 17 · raw

@ss:List<&2, String> -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

strings as JSON strings

def response source · line 25 · raw

@id:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> @result:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a reply to a request

def failure source · line 29 · raw

@id:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> @code:String -> @message:String -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a refusal of a request, with LSP's error code and a message

def notify source · line 34 · raw

@method:String -> @params:0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a notification: no id, no reply expected

def capabilities source · line 40 · raw

@ee:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Enc -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

what the server can do. It takes whole-text edits (change: 1) for hover, definition and symbols; diagnostics still follow open and save, as the checker reads files and their imports from disk

def position.at source · line 58 · raw

@line:U32 -> @character:U32 -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

an LSP position as sent: a line and a character already in the negotiated encoding

def position source · line 63 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @+line:U32 -> @character:U32 -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

an LSP position (0-based line and a code-point character), its character sent in the document's negotiated encoding

def diagnostic source · line 67 · raw

@+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @dd:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/report.Diag -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

the checker gives a line and no columns: a diagnostic covers its whole line

def diagnostics source · line 74 · raw

@ds:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/lsp/report.Diag> -> @+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

diagnostics as JSON

def finding_range source · line 82 · raw

@+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @+line:U32 -> @+col:U32 -> @+len:U32 -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a finding's range: its name, or from its column to the end of the line

def finding source · line 89 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @gg:0x1d907092a452cd105e95df09b21f0aaf/src/finding.Graded -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a graded lint finding as a diagnostic: an error or a warning by its level, its stable code, and bolt(group:slug) as the source

def findings source · line 96 · raw

@gs:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/finding.Graded> -> @+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

findings as JSON

def publish source · line 105 · raw

@+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @uri:String -> @ds:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/lsp/report.Diag> -> @gs:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/finding.Graded> -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

the publishDiagnostics notification for a document: the checker's errors, then the linter's findings

def line_range source · line 110 · raw

@+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @+line:U32 -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a whole line as a range

def hover.text source · line 114 · raw

@sig:String -> @+doc:String -> String

an item as hover text: its signature as code, then its doc comment

def hover source · line 118 · raw

@item:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

an item as hover: signature, then doc

def location source · line 123 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @uri:String -> @item:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

an item's location: its whole line

def kind_name source · line 128 · raw

@kk:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.BindKind -> String

what a binder is, in words

def where_bound source · line 150 · raw

@kk:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.BindKind -> @line:U32 -> String

where a local was bound, for hover

def hover.local source · line 163 · raw

@bb:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.Bind -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a binder of the document: the text that bound it, and what it is. The server knows binding sites, not types: only a declaration carries one

def name_range source · line 169 · raw

@+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @+line:U32 -> @+col:U32 -> @name:String -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

exactly a name's range

def location.local source · line 174 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @uri:String -> @bb:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.Bind -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

exactly the binder's name

def symbol.kind source · line 179 · raw

@kk:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.ItemKind -> U32

LSP's SymbolKind: module 2, function 12, constant 14, enum member 22, struct 23

def symbol source · line 195 · raw

@+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @item:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

an item as a DocumentSymbol

def symbols.go source · line 200 · raw

@items:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item> -> @+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

def symbols source · line 208 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @items:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item> -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

the document symbols

def completion.kind source · line 213 · raw

@kk:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.ItemKind -> U32

LSP's CompletionItemKind: function 3, module 9, enum member 20, constant 21, struct 22

def first_line source · line 229 · raw

@s2:String -> String

a text's first line

def completion source · line 234 · raw

@+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @item:0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item -> @+line:U32 -> @start:U32 -> @col:U32 -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a candidate replaces everything typed of the name, dots included: the editor's own idea of a word stops at a dot

def completions.go source · line 242 · raw

@items:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item> -> @+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @+line:U32 -> @+start:U32 -> @+col:U32 -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

def completions source · line 257 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @items:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/outline.Item> -> @line:U32 -> @start:U32 -> @col:U32 -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

isIncomplete: the server filtered by the prefix, so the editor asks again as the prefix grows

def hex source · line 261 · raw

@ch:Char -> U32

a hex digit's value: 0-9, then a-f and A-F as 10-15

def unpercent source · line 267 · raw

@cs:List<&2, Char> -> List<&2, U32>

a file URI's path: the scheme dropped, the %XX bytes decoded as UTF-8

def path source · line 279 · raw

@+uri:String -> String

a file URI's path: the scheme dropped, the %XX bytes decoded as UTF-8

def locations.go source · line 286 · raw

@ps:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.Pos> -> @+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @+uri:String -> @+name:String -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

def locations source · line 294 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @uri:String -> @name:String -> @ps:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.Pos> -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

the positions a name is at, as Locations

def edits.go source · line 297 · raw

@ps:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.Pos> -> @+cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @+name:String -> @+new:String -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

def rename source · line 305 · raw

@cc:0x1d907092a452cd105e95df09b21f0aaf/src/lsp/enc.Cols -> @uri:String -> @name:String -> @new:String -> @ps:List<&2, 0x1d907092a452cd105e95df09b21f0aaf/src/syntax/bind.Pos> -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

a WorkspaceEdit over the one document

def nums source · line 309 · raw

@ns:List<&2, U32> -> List<&2, 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json>

numbers as JSON numbers

def semantic source · line 317 · raw

@data:List<&2, U32> -> 0xa81e161008ecc2f297c0a3065cb9b188/src/value.Json

the semantic tokens response