It is possible to add it?
If somebody writes the code to do it sure. Pull requests are welcome.
If somebody writes the code to do it sure. Pull requests are welcome.
Ok.
~1.5 years ago I tried to add autocompletion for D language: https://github.com/denizzzka/geany_dlang
But faced with problem because Geany isn't supported autocompletion callbacks or something like that for plugins. Something is changed from this times?
But faced with problem because Geany isn't supported autocompletion callbacks or something like that for plugins.
Yes that would be the code that needs writing, then the plugins could provide their specific language input. The actual language server part would be in a plugin, much of which may be common between languages.
I saw that a year ago there was a discussion of this in mailing list. It ended with nothing?
Not that I recall, but my .. erm you know, thingy, erm oh yeah, memory!! is not so good :)
So, if someone write a suitable patch and no one does discussed about it, it will be accepted?
I suspect the main problem is that nobody who had the time and interest had the capability and nobody who had the capability and interest had the time, something many Geany contributors are short of at the moment due to things in the real world.
But if someone comes up with a concrete proposal for an API allowing plugins to provide autocompletes it is likely that it will get some discussion, and a nice implementation will get accepted, especially if you can arrange for a number of testers, thats often the difficulty, if the changes require using a plugin to test it takes too much of a potential committers time to test.
It's theoretically possible for a plugin to force and keep off Scintilla's (very basic) auto-complete list and replace with a better one using plain GTK+ calls. I did this before when tinkering with integrating libclang auto-completions in a plugin. It's hacky, but it would be easier to actually get it merged in a plugin than making larger changes to Geany core.
@codebrainz thats a good idea, even if initially the user had to manually turn off Geany autocompletes in prefs it would allow the plugin to be developed fully standalone to show its usability, and then a later improvement could allow the plugin to shut down Geany autocompletes.
It's theoretically possible for a plugin to force and keep off Scintilla's (very basic) auto-complete list and replace with a better one using plain GTK+ calls.
Currently my plugin listen on_editor_notify and checks if SCN_CHARADDED is occured. Is there some other mechanism? I'm not very familiar with the GTK
thats a good idea, even if initially the user had to manually turn off Geany autocompletes in prefs it would allow the plugin to be developed fully standalone to show its usability, and then a later improvement could allow the plugin to shut down Geany autocompletes.
May be just add an ability to replace of autocompletion list by plugin?
Its probably going to be easier to just have your own autocomplete dialog, the Geany version is provided by Scintilla, but populated by Geany, and is strongly linked to Geany's tags and symbols mechanism that you won't be using. So its likely to be more complicated to modify to allow external input without breaking any existing functionality (havn't examined in detail, but reasonably suspect this is the case, especially as @codebrainz who is a Geany dev, found it easier).
It is likely it would get the plugin up and running faster if you had your own, and compared to talking a protocol to language servers without blocking, GTK dialogs are likely to be a piece of cake :)
Its probably going to be easier to just have your own autocomplete dialog
Ok, but at least it is need to add notify for start of dialog displaying.
the Geany version is provided by Scintilla, but populated by Geany, and is strongly linked to Geany's tags and symbols mechanism that you won't be using. So its likely to be more complicated to modify to allow external input without breaking any existing functionality
Currently I use this code for autocompletion dialog in my own plugin without any problems:
```D /// This is D language scintilla_send_message( doc.editor.sci, Sci.SCI_AUTOCSHOW, cast(uptr_t) alreadyEnteredNum, cast(sptr_t) preparedList.toStringz ); ```
So it is only need some public function pointer inside of Geany what returns list for autocompletion and also another one for tips window. If plugin will be able to replace this pointers by its own it will be very usable.
I don't get it, why does Geany need to send you the autocompletion list? Isn't that what the language server gives you?
This is second option if it is impossible to add notify for start of completion/tips dialog displaying. Although it would be more correct to have this notify.
I still don't understand, how can Geany notify the plugin of anything for autocompletion?
The plugin is getting characters added from the `editor_notify` signal that is already in the API and the plugin is talking to the language server to get the autocompletes. The plugin has all the info to show the autocomplete dialog without any input from Geany. As I suggested above, for now just turn off Geany autocomplete manually.
I still don't understand, how can Geany notify the plugin of anything for autocompletion?
I am isn't know. It is possible to emit notify like SCN_CHARADDED? Something like GEANY_DISPLAY_AUTOCOMPLETE? Plugin will be able to listen for this notify and display its own dialog instead of built-in.
Or maybe substitution of function ptr what returns autocompletion list will be more suitable for this: plugin will replace this function by its own.
I still don't understand, how can Geany notify the plugin of anything for autocompletion?
I meant how can Geany know WHEN to notify the plugin? As I said above the plugin has the information that an autocomplete is available, not Geany, so Geany has no way of knowing it should notify the plugin.
I meant how can Geany know WHEN to notify the plugin?
Then Geany displays built-in autocompletion window. Or I isn't understand something?
(Topic can be changed to "Autocompletion plugins support"?)
I think we have a fundamental misunderstanding of what is happening.
My understanding is that the plugin will get notified of characters the user types by the `editor-notify` signal, when it has a suitable sequence of identifier characters its sends those to the language server to get what possible autocompletes are available at that position. When the language server returns the list the plugin displays its autocomplete dialog, and if the user selects one, the plugin inserts that using `editor_insert_text_block()`.
So there is no Geany interaction with the autocompletion at all, and as I said Geany autocompletes should be turned off, you don't want two things trying to decide autocompletion at the same time, thats chaos.
My understanding is that the plugin will get notified of characters the user types by the editor-notify signal, when it has a suitable sequence of identifier characters its sends those to the language server to get what possible autocompletes are available at that position. When the language server returns the list the plugin displays its autocomplete dialog, and if the user selects one, the plugin inserts that using editor_insert_text_block().
But in Geany we already have fine tune settings for autocompletion. And if extrenal autocompletion will be implemented as substitution of internal autocompletion function it will be more comfortably to use.
And, yes, if it is need for autocompletion plugin for some purposes (performance) characters sequencies already can be captured.
So there is no Geany interaction with the autocompletion at all, and as I said Geany autocompletes should be turned off, you don't want two things trying to decide autocompletion at the same time, thats chaos.
So it is need to clearly separate settings of built-in autocomplete and third-party. Because 99% of user isn't distinguish this details. And it will look ugly.
But in Geany we already have fine tune settings for autocompletion. And if extrenal autocompletion will be implemented as substitution of internal autocompletion function it will be more comfortably to use.
I would strongly suggest that the plugin should be shown to work first, before you worry about interacting with settings in Geany.
Making the communication with the language server work, without blocking Geany, and fast enough, is possibly going to be a challenge. And you have to handle the user typing fast enough that the server hasn't replied when you get the next `editor-notify` signal, unlike your dlang plugin which uses a library version of the d compiler IIUC (similar to @codebrainz use of clanglib) and so is blocking which makes life simple.
I would strongly suggest that the plugin should be shown to work first, before you worry about interacting with settings in Geany.
Why? Currently it works ok by way similar what I proposed here (except fact that it counts chars, not receives notify like GEANY_DISPLAY_AUTOCOMPLETE)
But actually I am isn't use my own plugin because: 1) in GTK3 version I isn't see gdb debugger plugin support (offtopic) 2) my own autocompletion plugin requires to disable built-in autocompletion but I write not only D code
Making the communication with the language server work, without blocking Geany, and fast enough, is possibly going to be a challenge.
I do not think that complexity should matter here. Alternative - the lack of autocompletion in 2018
Alternative - the lack of autocompletion in 2018
Which is why first it should be made to work.
To be frank, Geany's autocompletion is very stupid and has no language specific understanding (for example name visibilities and scopes or non-top level names), it should not be the trigger for language specific autocompletions, they should replace the Geany autocompletion. I mostly run with autocompletes off because the things Geany offers for C++ completions are usually so irrelevant as to be a distraction.
So the settings in the Geany dialogs should not affect the plugins, the plugins should have their own language specific settings.
If the plugin has any interaction with Geany autocomplete it should only be to have Geany autocomplete turn off for that language.
A pull request that adds a call for a plugin to turn a specific language autocomplete on or off may be accepted if it is simple and reliable enough. I havn't studied what it would take in Geany to turn autocompletes off for one language, the pull request writer would have to identify that, but hopefully it won't be too complex.
But the pull request is unlikely to get much traction until there is a plugin that could use it in reasonably common use, at least listed on the Geany plugins website and preferably in the `geany-plugins` package.
To be frank, Geany's autocompletion is very stupid and has no language specific understanding (for example name visibilities and scopes or non-top level names), it should not be the trigger for language specific autocompletions, they should replace the Geany autocompletion. I mostly run with autocompletes off because the things Geany offers for C++ completions are usually so irrelevant as to be a distraction.
On the contrary, I like that it works at least a little on virtually any file, regardless of language(?)
And I'm very impressed with the idea that the settings of autocompletion will be in one place, where they are already now. Design of the window can be changed, user settings too, so it's better to be able to transfer lists to this window than draw plugin-own window.
So that someone has a specific plan?
@denizzzka if your last post means "Is someone working on it?" I am not aware of anyone.
There is a completion implementaion [here](https://github.com/notetau/geany-clang-complete/tree/master/geany-complete-c...) but I donot know if it could be picked upon or if it is compatible to current geany plugin architecture. Actually, I used it with python but seemed slow as it used http for completion so I wrote something for [python](https://github.com/sagarchalise/geany-pyjedi) myself based upon current scintilla autocompletions.
See #3849.
Closed #1854 as completed.
github-comments@lists.geany.org