-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completion provider #155
base: main
Are you sure you want to change the base?
Completion provider #155
Conversation
We already have blueprint-compiler as a module that we can use. It also fixes the issue of blueprint-compiler not working in Workbench when built under vscode-flatpak.
05f69f1
to
55e450f
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Functionality that is static and performance sensitive can be moved here as necessary, but more importantly it can be used to work around problems with introspection in GJS.
Currently facing this issue
It looks like it is left in an incorrect state. Screencast.from.2023-08-20.11-04-25.webm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some notes, but not much help I'm afraid :/
Object.assign(this, completion_proposal); | ||
} | ||
|
||
get_typed_text() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_typed_text() { | |
vfunc_get_typed_text() { |
#onCompletionRequest = (provider, request) => { | ||
console.log(`completion-request: ${request.context.get_word()}`); | ||
|
||
const [, start, end] = request.context.get_bounds(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [, start, end] = request.context.get_bounds(); | |
const [success, start, end] = request.context.get_bounds(); | |
if (!success) { | |
request.state_changed(Workbench.RequestState.CANCELLED); | |
return; | |
} |
context | ||
.get_view() | ||
.push_snippet( | ||
Source.Snippet.new_parsed(proposal.get_typed_text()), | ||
null, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context | |
.get_view() | |
.push_snippet( | |
Source.Snippet.new_parsed(proposal.get_typed_text()), | |
null, | |
); | |
context.get_buffer().begin_user_action(); | |
const [success, start, end] = context.get_bounds(); | |
if (success) context.get_buffer().delete(start, end); | |
context | |
.get_view() | |
.push_snippet( | |
Source.Snippet.new_parsed(proposal.get_typed_text()), | |
null, | |
); | |
context.get_buffer().end_user_action(); |
}) | ||
.catch(logError) | ||
.finally(() => { | ||
request.state_changed(Workbench.RequestState.COMPLETE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly not sure what's going wrong, since I'm not familiar with GtkSource. I noticed the finally()
handler is not getting called very often though.
Fixes #257
EDIT: the following is outdated thanks to #371
This is blocked by https://gitlab.gnome.org/GNOME/gjs/-/issues/72
https://gitlab.gnome.org/GNOME/gjs/-/issues/255 is a better explanation of the problem