src/lsp/nav.bend checks
raw source on the hub · import bolt@1.42.0.0/src/lsp/nav.bend as Nav
lsp/nav: from a name to the item it names. A use is answered as the binder
resolved it: a binder of the document, an item of the document (before any
alias), rest in the file behind the import Alias of Alias.rest, or
Base. A word the binder has nothing for (a half-typed name) is looked up
behind its alias, else in the document, else in Base. Open documents are
read from the store (what the editor shows), everything else through the
files service.
8 imports
import Base import ../syntax/outline.bend as Outline import ../syntax/word.bend as Word import ../syntax/bind.bend as Bind import ./files/service.bend as F import ./docs.bend as Docs import ./path.bend as Path import ./proto.bend as Proto
Types
type Found source · line 19 · raw
Data
what a name names: an item and the document it lives in, or a binder of the document itself (a parameter, a local, a field, ..)
Found@uri:String -> @item:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item -> Found
Here@uri:String -> @bind:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind -> Found
type Sites source · line 313 · raw
Data
the positions a name is at in its document, and whether the name is the document's own (a binder, or an item of it) -- only those can be renamed
Sites@mine:Bool -> @at:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Pos> -> Sites
Definitions
def found source · line 24 · raw
@mm:Maybe<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @uri:String -> Maybe<&2, Found>
an item, when there is one, in a document
def here source · line 102 · raw
@mm:Maybe<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind> -> @uri:String -> Maybe<&2, Found>
a binder, when there is one, in a document
def hover.binder source · line 200 · raw
@mm:Maybe<&2, Found> -> @uri:String -> @bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind -> Maybe<&2, Found>
the binder, when the outline has nothing for that name
def hover.pick source · line 210 · raw
@mm:Maybe<&2, Found> -> @local:Maybe<&2, Found> -> @uri:String -> @bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind -> Maybe<&2, Found>
an outline item when the name resolved, else one in this document, else the binder. A comment above a law stays on that law: a file header separated by an import or a blank line is not part of it
def sites.of source · line 316 · raw
@site:Maybe<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Site> -> @+bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bound -> Sites
def sites.in source · line 333 · raw
@+text:String -> @+line:U32 -> @+col:U32 -> Sites
def as_items source · line 379 · raw
@ls:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind> -> List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>
a binder as a candidate: its note stands for a signature
Templates
template load.miss source · line 31 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @open:Maybe<&2, String> -> @path:String -> IO(String)
template load source · line 41 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @path:String -> IO(String)
a document's text: the open one, or the file's; "" when there is neither
template in_file source · line 45 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+path:String -> @name:String -> IO(Maybe<&2, Found>)
the item of a name in a file
template in_base source · line 51 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @name:String -> IO(Maybe<&2, Found>)
the item of a name in Base
template own source · line 57 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @mm:Maybe<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @name:String -> IO(Maybe<&2, Found>)
an item of the document, else of Base
template via source · line 71 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @imp:Maybe<&2, String> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @+name:String -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> IO(Maybe<&2, Found>)
through an import alias when the name has one, else the document's own
template among source · line 86 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @+name:String -> IO(Maybe<&2, Found>)
a name against a document's items
template resolve source · line 96 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @name:String -> IO(Maybe<&2, Found>)
the item a name in a document names
template at.qual source · line 112 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @imp:Maybe<&2, String> -> @rest:String -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @+name:String -> IO(Maybe<&2, Found>)
a name behind an import alias: rest in the file the import names,
relative to the document; the document's own item when the outline has no
import of that alias
template at.target source · line 131 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @tg:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Target -> @+name:String -> @binds:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind> -> @+items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> IO(Maybe<&2, Found>)
a use, by what the binder resolved it to: a binder of the document is that binder; an item of the document is that item, before any alias; a name behind an alias is looked up in the file the import names; a free name is the document's item of that name, else Base's
template at.site source · line 153 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @site:Maybe<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Site> -> @binds:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind> -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @name:String -> IO(Maybe<&2, Found>)
a binder of the document is answered from the document, and a use as the binder resolved it; nothing at all falls back to the word under the cursor (a half-typed name)
template at.bound source · line 170 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bound -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @name:String -> @+line:U32 -> @+col:U32 -> IO(Maybe<&2, Found>)
template at.in source · line 183 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+text:String -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @+line:U32 -> @+col:U32 -> IO(Maybe<&2, Found>)
template at source · line 194 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @line:U32 -> @col:U32 -> IO(Maybe<&2, Found>)
what the name under a position of a document names
template hover.item source · line 219 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+name:String -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind -> IO(Maybe<&2, Found>)
the outline item a top-level name hovers as. Alias.law is the law in the
file behind Alias (the comment lives there); a bare name is this document's
template hover.kind source · line 232 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @kind:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.BindKind -> @name:String -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind -> IO(Maybe<&2, Found>)
a def, law or type is its outline item; any other binder is itself
template hover.bind source · line 248 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> IO(Maybe<&2, Found>)
the binder under the cursor, read for hover
template hover.site source · line 261 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @site:Maybe<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Site> -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @+binds:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bind> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @+name:String -> IO(Maybe<&2, Found>)
a binder of an item is the outline item (signature, then the comment above
it). A use is answered the same way at answers it, so a call keeps the
callee's doc
template hover.bound source · line 277 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @bb:0x48472bda0552c4630a4b2041d1b4866f/src/syntax/bind.Bound -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @name:String -> @+line:U32 -> @+col:U32 -> IO(Maybe<&2, Found>)
hover at a binding site of a parsed document
template hover.in source · line 291 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+text:String -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @+line:U32 -> @+col:U32 -> IO(Maybe<&2, Found>)
hover at a position of a document's text
template hover source · line 303 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @line:U32 -> @col:U32 -> IO(Maybe<&2, Found>)
what a hover at a position should show. Definition stays on at: an item's
own name is still that binder
template sites source · line 338 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @line:U32 -> @col:U32 -> IO(Sites)
the positions of the name at a position of a document
template outline source · line 344 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
the items of a document
template starting_in source · line 357 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+path:String -> @prefix:String -> @qual:String -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
the items of a file that start with a prefix, renamed for insertion
template from_base source · line 369 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @typed:Bool -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @prefix:String -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
Base is big: it is offered once something is typed
template unqualified source · line 388 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+prefix:String -> @locals:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
candidates for a plain prefix: visible names, the document's items, its aliases, then Base
template candidates.via source · line 403 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @imp:Maybe<&2, String> -> @items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @+prefix:String -> @locals:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
Alias.re completes from the file behind the alias; anything else from the
document, its aliases and Base
template candidates.among source · line 418 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+items:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @+prefix:String -> @locals:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item> -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
template candidates.in source · line 428 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+text:String -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @uri:String -> @prefix:String -> @line:U32 -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
template candidates source · line 440 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @+docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> @prefix:String -> @line:U32 -> IO(List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/syntax/outline.Item>)
what could complete the prefix typed at a line of a document: the locals visible there, then items, each named by the text to insert
template text_of source · line 452 · raw
@-fs:0x48472bda0552c4630a4b2041d1b4866f/src/lsp/files/service.Files -> @docs:List<&2, 0x48472bda0552c4630a4b2041d1b4866f/src/lsp/docs.Doc> -> @+uri:String -> IO(String)
a document's text