Skip to content
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

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Completion provider #155

wants to merge 13 commits into from

Conversation

sonnyp
Copy link
Contributor

@sonnyp sonnyp commented Sep 21, 2022

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

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.
@sonnyp sonnyp added the help wanted Extra attention is needed label Mar 6, 2023
@sonnyp sonnyp mentioned this pull request Apr 1, 2023
@sonnyp sonnyp force-pushed the main branch 3 times, most recently from 05f69f1 to 55e450f Compare May 21, 2023 10:37
@andyholmes

This comment was marked as outdated.

@sonnyp

This comment was marked as outdated.

@sonnyp
Copy link
Contributor Author

sonnyp commented Aug 20, 2023

Currently facing this issue

  • The completion shows
  • Select an entry
  • The completion popup disappears
  • The completion popup won't show again

It looks like it is left in an incorrect state.

Screencast.from.2023-08-20.11-04-25.webm

Copy link
Contributor

@andyholmes andyholmes left a 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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const [, start, end] = request.context.get_bounds();
const [success, start, end] = request.context.get_bounds();
if (!success) {
request.state_changed(Workbench.RequestState.CANCELLED);
return;
}

Comment on lines +30 to +35
context
.get_view()
.push_snippet(
Source.Snippet.new_parsed(proposal.get_typed_text()),
null,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add autocompletion
2 participants