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:
James Westman 2024-10-19 18:46:10 -05:00
parent b107a85947
commit e19975e1f8
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
28 changed files with 326 additions and 21 deletions

View file

@ -40,6 +40,10 @@ class SignalFlag(AstNode):
f"Duplicate flag '{self.flag}'", lambda x: x.flag == self.flag
)
@docs()
def ref_docs(self):
return get_docs_section("Syntax Signal")
class Signal(AstNode):
grammar = Statement(
@ -50,7 +54,7 @@ class Signal(AstNode):
UseIdent("detail_name").expected("a signal detail name"),
]
),
"=>",
Keyword("=>"),
Mark("detail_start"),
Optional(["$", UseLiteral("extern", True)]),
UseIdent("handler").expected("the name of a function to handle the signal"),
@ -184,6 +188,10 @@ class Signal(AstNode):
if prop is not None:
return prop.doc
@docs("=>")
def ref_docs(self):
return get_docs_section("Syntax Signal")
@decompiler("signal")
def decompile_signal(