mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
lsp: Fix crash on incomplete detailed signal
This commit is contained in:
parent
a6d57cebec
commit
d6f4b88d35
3 changed files with 9 additions and 1 deletions
|
@ -143,12 +143,13 @@ class Signal(AstNode):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def document_symbol(self) -> DocumentSymbol:
|
def document_symbol(self) -> DocumentSymbol:
|
||||||
|
detail = self.ranges["detail_start", "detail_end"]
|
||||||
return DocumentSymbol(
|
return DocumentSymbol(
|
||||||
self.full_name,
|
self.full_name,
|
||||||
SymbolKind.Event,
|
SymbolKind.Event,
|
||||||
self.range,
|
self.range,
|
||||||
self.group.tokens["name"].range,
|
self.group.tokens["name"].range,
|
||||||
self.ranges["detail_start", "detail_end"].text,
|
detail.text if detail is not None else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_reference(self, idx: int) -> T.Optional[LocationLink]:
|
def get_reference(self, idx: int) -> T.Optional[LocationLink]:
|
||||||
|
|
5
tests/sample_errors/incomplete_signal.blp
Normal file
5
tests/sample_errors/incomplete_signal.blp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Label {
|
||||||
|
notify::
|
||||||
|
}
|
2
tests/sample_errors/incomplete_signal.err
Normal file
2
tests/sample_errors/incomplete_signal.err
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
5,1,0,Expected a signal detail name
|
||||||
|
4,9,3,Unexpected tokens
|
Loading…
Add table
Add a link
Reference in a new issue