mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
lsp: Add reference documentation on hover
For most constructs and keywords, show the relevant section of the reference documentation on hover.
This commit is contained in:
parent
b107a85947
commit
e19975e1f8
28 changed files with 326 additions and 21 deletions
|
@ -174,7 +174,7 @@ class LookupOp(InfixExpr):
|
|||
|
||||
class CastExpr(InfixExpr):
|
||||
grammar = [
|
||||
"as",
|
||||
Keyword("as"),
|
||||
AnyOf(
|
||||
["<", TypeName, Match(">").expected()],
|
||||
[
|
||||
|
@ -220,6 +220,10 @@ class CastExpr(InfixExpr):
|
|||
],
|
||||
)
|
||||
|
||||
@docs("as")
|
||||
def ref_docs(self):
|
||||
return get_docs_section("Syntax CastExpression")
|
||||
|
||||
|
||||
class ClosureArg(AstNode):
|
||||
grammar = Expression
|
||||
|
@ -269,6 +273,10 @@ class ClosureExpr(ExprBase):
|
|||
if not self.tokens["extern"]:
|
||||
raise CompileError(f"{self.closure_name} is not a builtin function")
|
||||
|
||||
@docs("name")
|
||||
def ref_docs(self):
|
||||
return get_docs_section("Syntax ClosureExpression")
|
||||
|
||||
|
||||
expr.children = [
|
||||
AnyOf(ClosureExpr, LiteralExpr, ["(", Expression, ")"]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue