mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-06-22 23:19:25 -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
|
@ -20,6 +20,7 @@
|
|||
import typing as T
|
||||
|
||||
from blueprintcompiler.gir import ArrayType
|
||||
from blueprintcompiler.lsp_utils import SemanticToken
|
||||
|
||||
from .common import *
|
||||
from .contexts import ScopeCtx, ValueTypeCtx
|
||||
|
@ -56,6 +57,10 @@ class Translated(AstNode):
|
|||
f"Cannot convert translated string to {expected_type.full_name}"
|
||||
)
|
||||
|
||||
@docs()
|
||||
def ref_docs(self):
|
||||
return get_docs_section("Syntax Translated")
|
||||
|
||||
|
||||
class TypeLiteral(AstNode):
|
||||
grammar = [
|
||||
|
@ -101,6 +106,10 @@ class TypeLiteral(AstNode):
|
|||
],
|
||||
)
|
||||
|
||||
@docs()
|
||||
def ref_docs(self):
|
||||
return get_docs_section("Syntax TypeLiteral")
|
||||
|
||||
|
||||
class QuotedLiteral(AstNode):
|
||||
grammar = UseQuoted("value")
|
||||
|
@ -258,6 +267,10 @@ class Flags(AstNode):
|
|||
if expected_type is not None and not isinstance(expected_type, gir.Bitfield):
|
||||
raise CompileError(f"{expected_type.full_name} is not a bitfield type")
|
||||
|
||||
@docs()
|
||||
def ref_docs(self):
|
||||
return get_docs_section("Syntax Flags")
|
||||
|
||||
|
||||
class IdentLiteral(AstNode):
|
||||
grammar = UseIdent("value")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue