mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
completions: Complete available namespaces
Add completions for namespaces in the typelib path that can be imported. Accepting the completion automatically adds an import statement.
This commit is contained in:
parent
461fe25316
commit
21f138fa83
3 changed files with 37 additions and 7 deletions
|
@ -87,6 +87,7 @@ class Completion:
|
|||
text: T.Optional[str] = None
|
||||
snippet: T.Optional[str] = None
|
||||
detail: T.Optional[str] = None
|
||||
additional_text_edits: T.Optional[T.List["TextEdit"]] = None
|
||||
|
||||
def to_json(self, snippets: bool):
|
||||
insert_text = self.text or self.label
|
||||
|
@ -114,6 +115,11 @@ class Completion:
|
|||
"insertText": insert_text,
|
||||
"insertTextFormat": insert_text_format,
|
||||
"detail": self.detail if self.detail else None,
|
||||
"additionalTextEdits": (
|
||||
[edit.to_json() for edit in self.additional_text_edits]
|
||||
if self.additional_text_edits
|
||||
else None
|
||||
),
|
||||
}
|
||||
return {k: v for k, v in result.items() if v is not None}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue