Sublime Forum

Sublime Autocomplete C < Atom

#1

Hi,
I need a lightweight editor and I found sublime, I really don’t care about the 80 $ dollar.
But I have some problems with the build-in autocompletion for c. For example in Atom “While” got autocompleted but in subl not… As well there is no If/Else autocompletion. Is there any way to fix it or should I spend my money on a powerbank and use Atom.

0 Likes

#2

Completions are provided by either static word lists *.sublime-completions or by plugins which in most cases use backend applications like clang to provide code intelligence features. The core ST provides only few completions to enable end users to decide what functions they need.

There are a couple of plugins available on packagecontrol.io, which provide completions for C/C++ using clang. Maybe one of them is what you need?

Example:

https://packagecontrol.io/packages/ClangAutoComplete

https://packagecontrol.io/packages/EasyClangComplete

With SublimeLinter and its friends you can also get some linting features.

0 Likes

#3

Hey thanks for the response,

I already had installed a clang based autocompletion but it do not include the “While or If/elif Loops”,this completion is provided by the build in completion.
for example if I type “while” nothing happens in sublime but in Atom it gets autocompletet to a loop.

I guess its not a big problem and should be easy to fix by changing some files but I do not know how.

0 Likes

#4

If you just want a while loop snippet you can write that snippet yourself. I’d also like to mention the LSP plugin because it’s The Future ™. Install the clangd server or the cquery server and you basically have an IDE (except for the “find usage/references” functionality).

1 Like

#5

I want to write it myself but I don’t know which files to edit is there any guide out there? :smiley:
Thanks for the LSP tip I will try it soon.

0 Likes

#6

I think the most straight forward way to learn it was to just use the “View Package Resources” function of ST and search for “.sublime-snippet” files. If you’ve seen a couple of them you should be able to write your own. You could also try PackageDev which provides some cool syntaxes and helpers for such file types.

1 Like