lsp: Add more "go to reference" implementations

This commit is contained in:
James Westman 2024-10-19 20:44:34 -05:00
parent 94b532bc35
commit f6d05be10b
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
3 changed files with 27 additions and 0 deletions

View file

@ -39,6 +39,12 @@ class Widget(AstNode):
self.group.tokens["name"].range,
)
def get_reference(self, _idx: int) -> T.Optional[LocationLink]:
if obj := self.context[ScopeCtx].objects.get(self.name):
return LocationLink(self.range, obj.range, obj.ranges["id"])
else:
return None
@validate("name")
def obj_widget(self):
object = self.context[ScopeCtx].objects.get(self.tokens["name"])