def at.target

bolt@1.27.0.0 · src/lsp/nav.bend:127

import bolt@1.27.0.0/src/lsp/nav.bend as Nav
import Base
import bolt@1.27.0.0/src/syntax/outline.bend as Outline
import bolt@1.27.0.0/src/syntax/bind.bend as Bind
import bolt@1.27.0.0/src/lsp/files/service.bend as F
import bolt@1.27.0.0/src/lsp/docs.bend as Docs

127# a use, by what the binder resolved it to: a binder of the document is that
128# binder; an item of the document is that item, before any alias; a name
129# behind an alias is looked up in the file the import names; a free name is
130# the document's item of that name, else Base's
131def at.target(
132  ~fs: F.Files,
133  tg: Bind.Target,
134  +name: String,
135  binds: List<&2, Bind.Bind>,
136  +items: List<&2, Outline.Item>,
137  docs: List<&2, Docs.Doc>,
138  +uri: String
139) -> IO(Maybe<&2, Found>):
140  match tg:
141    case Bind.TLocal{tl, tc}:
142      IO.pure(Maybe<&2, Found>, here(Bind.binder(binds, tl, tc), uri))
143    case Bind.TItem{+item}:
144      own(~fs, Outline.find(items, item), docs, uri, item)
145    case Bind.TQual{alias, rest}:
146      at.qual(~fs, Outline.import_path(items, alias), rest, items, docs, uri, name)
147    case Bind.TFree{}:
148      own(~fs, Outline.find(items, name), docs, uri, name)

Uses (17)

Used by (1)