lsp/eval: process field attributes and specialise queries for embeds
Add specific support to the lsp evaluator for processing embed field
attributes; querying the import graph for embeddings; and providing
specialised behaviour for doc-comments, and completions when working in
embedded files.
The goal is that when editing an embedded file, you get doc comments /
hover docs, and completions, based on where the file is embedded. This
is, in some ways, a bit odd: an embedded file is upstream, and if you
think about upstream imports, when editing a normal .cue file, you don't
get hover docs / completions based on where the current package is
imported downstream. Nevertheless, it's thought that this feature is
going to be very well received and useful.
To do this, we need a slightly different way of calculating those hover
docs and completions; we need for the evaluator to be able to query the
import graph for embeddings and discover where the current evaluator is
embedded (and vice versa), and when evaluating the AST and in particular
a field, we need to process any embed attributes it has.
Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: I85b0d58c1fbd831f2c64d7ad69254b631eac7ad8
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1228810
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>