lsp: Add code actions

"Did you mean" hints are automatically converted into code actions.
This commit is contained in:
James Westman 2021-11-11 22:59:49 -06:00
parent d89f2356b4
commit d511b3f1e3
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
5 changed files with 82 additions and 16 deletions

View file

@ -388,9 +388,9 @@ class GirContext:
return None
def validate_class(self, name: str, ns: str):
def validate_ns(self, ns: str):
""" Raises an exception if there is a problem looking up the given
class (it doesn't exist, it isn't a class, etc.) """
namespace. """
ns = ns or "Gtk"
@ -400,6 +400,14 @@ class GirContext:
did_you_mean=(ns, self.namespaces.keys()),
)
def validate_class(self, name: str, ns: str):
""" Raises an exception if there is a problem looking up the given
class (it doesn't exist, it isn't a class, etc.) """
ns = ns or "Gtk"
self.validate_ns(ns)
type = self.get_type(name, ns)
if type is None: