AutoCompletion for my DSL keywords in Geany - autocomplete

Geany(IDE) supports Autocompletion or IntelliSense as you program, but this is done based on the words you've used in the code so far.
Is there any way so I could have Autocompletion for my language keywords?

You can achieve this by writing your own tag file. It should be name like <somename>.<filetype>.tags and can be stored e.g. inside .geany-folder or inside global folders. You can import it via Tools-menu.
The tag file contains of a list of your methods, functions etc of your language as well as optimally some options for these commands used a tooltip. You can find some details inside manual
Of course, you could also check the wiki whether there might be already some tag file available for your language.

Related

Where Can I Find All Scope Selectors And Definitions for VSC?

I want to create my own Visual Studio Code theme. The JSON file for VSC themes consists of an object called colors, which contains UI colors, and an array called tokenColors, which contains syntax colors (from my understanding).
The VSC documentation for the different colors selectors can be found here. What I haven't found is a list of the different tokenColors and what they mean.
So far, I have found out that you can use the Developer: Inspect Editor Tokens and Scopes command to find out what token/scope every word/symbol in your code belongs to. But I can't write code in every language containing every possible code construct and keyword just to then inspect them and find out the scope they belong to.
I also learnt that these scopes are the same or similar to the ones used in Sublime Text. However, this documentation only contains a small portion of the scopes used in VSC's built in themes. How am I supposed to find out what the remaining scopes stand for?
For syntax highlighting a different set of colors is used, with an own set of token identifiers (aka. scopes). The Syntax Highlighting Guide describes details of the tokenization + theming process and refers to the TextMate rules, which are used also in VS Code.
This page contains section about naming conventions and that's essentially the base set of token IDs that have become the de-facto standard. Extensions often create their own scopes, but you cannot handle all of them. So, focus on the base set instead.
Fortunately, scope selectors are hierarchically organized. When the highlighter cannot find a color for, say, keyword.sql.mysql it tries again with keyword.sql or finally with keyword. That means, as long as all scopes follow these rules, then there will be at least a color available from the base set.

Visual Studio Code C++ color formatting in type declarations

As you can see, in C++ type declarations (string and new type), the colors of the types are in normal text color, which I find oddly peculiar, since it isn't the case for java source codes (even using the exact same theme).
I've tried customizing it in user settings:
But all that does is change the color of the type in the type definitions, not in the declarations.
I've also tried out various themes, but it's all the same.
Strangely, this doesn't happen for java source codes as shown in the image below:
I might be missing something. Maybe there's some field or attribute in the user settings that I should change instead of the 'type'.
Does anyone know how?
According to the Developer: Inpsect TM scopes command, the entire string x declaration has the same scopes:
source.cpp - the "base" scope for cpp files that everything in them has
meta.block.c - just tells you that it's inside of a block / {}
Consequently, there's not really anything to target with editor.tokenColorCustomizations, since that's based on scopes.
You could search for an extension that replaces the built-in CPP grammar with one that is better in this regard. Note that the only one I've found so far, Reloaded C/C++, doesn't help. Alternatively, you could search for a better grammar elsewhere - TmLanguage grammars are very commonplace and used in many editors, not just VSCode. Even GitHub uses them for their syntax highlighting.

Notepad++ and autocompletion

I'm using mainly Notepad++ for my C++ developing and recently i'm in need for some kind of basic autocompletion, nothing fuzzy, just want to type some letters and get my function declaration instead of having a manual opened all of the time..
The integrated autocompletion feature of my Notepad++ version (6.9.2) gives the declaration of basic C functionality like say fopen and parses my current file user defined functions, but without declaration.
I guess it's normal for a text editor to not give easily such information since it has nothing to parse i.e. other files where your declarations are (as it's not an IDE), but i don't want either to mess again with MSVC just for the sake of autocomplete.
Is there an easy, not so-hackish way to add some basic C++ and/or user defined autocomplete?
UPDATE
Adding declarations the "hard way" in some file cpp.xml is a no-no for me as i have a pretty big base of ever changing declarations. Is there a way to just input say some list of h/cpp files and get declarations? or this falls into custom plugin area ?
Edit the cpp.xml file and add all the keywords and function descriptions you'd like. Just make sure you add them in alphabetical order or they will not show up.
Another option is to select Function and word completion in the Auto-Completion area of the Settings-->Preferences dialog. NPP will suggest every "word" in the current file that starts with the first N letters you type (you choose a value for N in the Auto-Completion controls).

Shortcut for clike languages comments not working/implemented?

I'm using the Brackets code editor to code in C++ and I'm having a hard time having the shortcut for lineComment and blockComment working...
The shortcuts are [Ctrl+/] and [Ctrl+Shift+/], they work perfectly for CSS, JS.. etc but not with C++ files.
I looked into the clike.js file in the CodeMirror folder of Brackets, the blockCommentStart, blockCommentEnd and lineComment are correctly defined.
Is it a known issue? has anyone found a workaround?
Before that,I was coding with Notepad++ and this feature was the one I used the most. It's really hard not to have it anymore
You said you saw that blockCommentStart, blockCommentEnd and lineComment are correctly defined in clike.js. From CodeMirror documentation
This file defines, in the simplest case, a lexer (tokenizer) for your
language—a function that takes a character stream as input, advances
it past a token, and returns a style for that token. More advanced
modes can also handle indentation for the language.
It is used to highlight the c++ file. But also it could be used to auto comment line with shortcut. However it is probably not implemented for C++. For this feature comment addon from CodeMirror might be used http://codemirror.net/addon/comment/comment.js since The addon also defines a toggleComment command, which will try to uncomment the current selection, and if that fails, line-comments it.
This was a Brackets bug, but it was fixed in the Sprint 39 release.
(Fwiw though, language metadata in Brackets is defined in a file called languages.json - although Brackets extensions can add to / modify this metadata as well).

How does Geany auto-completion wơrk?

This question might seem a bit odd but I searched for like an hour and didn't find any hit that actually answered my question(s) about the auto-complete features of geany:
does it have auto-complete
for which languages does it have auto-complete (plugins?)
how do i use auto-complete
How about simply put: Ctrl+Space
I know 4 years passed ... but the correct answer is :
Edit->Preferences->Editor->Completions->[Check the "Autocomplete all words in document"]
press (CTRL+SPACE)
Geany does have autocomplete.
The main way autocomplete is used is by typing a long word, and by narrowing that list of autocomplete possibilities down. Let's say you type gtk_combo_box_. It will have a small list of different commands that match this description. Typing eTAB will narrow the search down to gtk_combo_box_entry_. Typing sENTER will then bring it to the proper to gtk_combo_entry_set_text_column. See the Geany manual.
Geany uses own internal engine and currently limited to:
C
Pascal
PHP
HTML
LaTeX
Python
It file format uses 3 types of encoding:
Tagmanager format
Pipe-separated format
CTags format
With CTAGS you can use external and powerful ctags utility that support a lot of langs.
Refer to official docs: http://www.geany.org/manual/current/#tags
Geany surely have autocomplete and can offer a list of possible completions for symbols defined in the tags and for all words in a document.
The autocompletion list for symbols is presented when the first few characters of the symbol are typed or when the Complete word (Ctrl-Space) keybinding is pressed.
When the defined keybinding is typed and the Autocomplete all words in document preference is selected then the autocompletion list will show all matching words previously mentioned in the document, if there are no matching symbols.
Autocompletion also can be based on specific words like keywords and etc. For this you can check this link
As the manual states:
Upon opening, files of supported filetypes are parsed to extract the
symbol information (aka "workspace symbols"). You can also have Geany
automatically load external files containing the symbol information
(aka "global tags files") upon startup, or manually using Tools -->
Load Tags File.
Global tags files are used to provide symbols for autocompletion and
calltips without having to open the source files containing these
symbols. This is intended for library APIs, as the tags file only has
to be updated when you upgrade the library.
Some global tags files are distributed with Geany and will be loaded
automatically when the corresponding filetype is first used. Currently
this includes global tags files for these languages: C, Pascal, PHP,
HTML, LaTeX, Python
For other languages, like Java, you have to download a tag file from here (if available), and load it upon startup or manually.