Weird autocompletion behavior in Gnome builder

Perhaps this is well well known and I’m being stupid, but I couldn’t figure this out from the documentation so here it goes.

I have been using Gnome builder for the first time as I am learning C and Rust. coming from VSCode, there are some features/issues I need some help with. There aren’t many articles about Gnome builder, and the documentation hasn’t been much help.

I am currently having three autocompletion issues.

First, autocompletion often creates duplicate letters and symbols.

For example, if I type
#inclu
then complete the autocomplete, autocompletion adds an additional # at the beginning like so.
image

Second, autocomplete statements/ functions often lock the keyboard. I’m unsure what exactly is happening, but sometimes, an orange highlighter covers the expressions. Only the highlighted parts can be typed. I can’t escape this by pressing enter, I have to use the arrow keys to exit.
I explain it in much more detail with a video explaining it here. Admittedly, it’s hard to explain so I’m unsure if this is even the correct way to explain it to you.

Finally, In VSCode and other IDEs, I’ve used, If I complete an expression without using autocompletion, then press enter to select the top to autocomplete suggestion, the autocomplete suggested closes, and nothing happens to my code. In Gnome Builder, pressing enter takes me to the next line. Is there a way to change this behavior?

How would I go about fixing these issues?

P.S. how do you edit autoformatting(code beautifier) and indentation length?

That’s because the word that’s being autocompleted is the include snippet, not #include, so I assume you started writing # then inclu and expanded that one, hence why you got two #.

Those orange highlighted parts are the ones that you can complete as part of the snippet, by typing something there then pressing Tab to access the next one. For example in the include snippet the highlighted part will be between "" or <>, or if you autocomplete a function then it’ll highlight all the arguments, like doing foo.call_bar(<arg_1>, <arg_2>) with arg_* being the highlighted parts. Also, generally to cancel something (e.g. this highlighting thing), it’s the Escape key you need to use, not Enter.

I’m not sure I understand what you’re saying there. Do you have screencasts of both behaviour available ?

Indentation length can be changed in the Programming Languages preferences, by selecting one of the languages and scrolling to the bottom. There you’ll be able to change indentation type (space/tabs) and indentation length/width. You can also use an editorconfig file, which will be shared across all IDEs. As for beautifiers, if you’re referring to the beautifiers available in Selection => Beautify when right clicking on the source code (in the menu), then you can either use the built-in ones that include their configuration profiles, or create your own in your project tree if you have special needs.

1 Like

Thanks for the response!

For the first and second issues, I think I get what’s going on, but it’s still quite annoying when it happens while quick typing. Like below

https://www.reddit.com/user/stpaulgym/comments/m0c6zk/issues_1/

Basically, If I type something, and use autocomplete(pressing enter), autocomplete completes whatever I typed. If I type something completely(autocomplete does not edit text) then press enter(presumably selecting one of the autocomplete dialogues), Gnome builder switches to the next line, VsCode, and others just complete the line and stays there.
https://www.reddit.com/user/stpaulgym/comments/m0cagd/issue_2/

Thanks!. One last question, I haven’t looked into this but I assume it is possible to enable formant on save(ctrl + s) feature? Thanks!

Not yet, but that’s something I’d like to address (but feel free to implement it before me if you want, it’s actually quite straight-forward to do)

Hmm… I can’t reproduce that behaviour here. Do you have the latest version from flathub ? Here when I type foo and press Enter to autocomplete the foo function name, then it just acts like in your recording.

Reddit - Dive into anything its this. I linked the wrong video.

I’m surprised this is still an ongoing issue. maybe once I get more proficient with it I might try(still learning)

Yeah now I can reproduce like that. Might be worth opening an issue in Builder’s issue tracker.

The list of changes TBD to achieve it are given in one of the comments if needed.

Apologies for bothering you further, but I’m wondering if there is a way to control when to auto tab code?

For example, if I make an if statement in C by using the autocomplete snippet or by typing by hand,

I often get the following when typing it my self.

if () {

}

and I get the following from the snippet.

if ()
    {
    }

Ideally, I would like to do

if ()
{
}

Yet I cannot seem to able to find a setting for this. Do you know where the setting or config file I must edit is?

Hmm… no, there’s no such setting (or at least I couldn’t find any). This indentation style is the one used through most GNOME modules, which seems to be GNU’s style. Anyway snippets are pretty much static apart from the editable parts (i.e. orange highlighted parts), so I don’t think it would even be doable in the current state of things.

Hmm. I understand.

Just one last thing.

I’ve been trying to get the 3 default Beautifier configs to work, yet all three output the same error message and fails to perform any formatting.

Could you please direct me to where I could fix this issue? Thanks!

Edit, upon further inspection, my system does not have the beautifier plugin file in
~/.config/gnome-builder/beautifier_plugin
Strange’

Sure, that’s normal. Those are for you to add some user-wide beautifiers, but Builder doesn’t put any there. To add some extra C uncrustify beautifiers, you can probably just copy src/plugins/beautifiers/config/c from Builder’s source code to this path, then edit those config files to your needs.

As for uncrustify, you need to have it installed on your system for it to work. I’m assuming you’re not using the flatpak then, since the flatpak already includes uncrustify so it works OOTB there.

From this, I tried installing the Flatpak version and now I’m stuck on Light mode D:. I’ll figure it out though, hopefully.

Thank you. I’ve just install crustify and formatting is working now. I just need to make my own presets and it will all be good. I tried the Flatpak version and I have an issue with themes but I’m sure I’ll figure it out. Thanks!

Check on the first page of the Preferences, it’s like the first option. BTW you’ll need to install the corresponding theme flatpak runtime. Check the list with flatpak search gtk3theme and install your one with flatpak install org.gtk.Gtk3theme.Foobarbaz.

Hmm, after further testing, it seems that the Flatpak theme issues only happen on Arch and not on Fedora. I’ll try yours as well.

with the flatpak from flathub for both ? Fedora has its own flatpak packages, so you might have inadvertently installed from there (that repo is really annoying…).

From Flathub. I think it’s just an Arch quirk.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.