I think it would be really nice and effective if save actions plugin had a feature that would start compiling right after every save. That would be a 'clangd' like feature and would be very easy for us to track down errors and warnings while writing code.
Since saving happens on a timer there is no assurance that the user has finished typing legal code when the save happens, so (after the delay while compile happens) the irrelevant errors will appear just where the user is typing.
I think it would be really nice and effective if save actions plugin had a feature that would start compiling right after every save. That would be a 'clangd' like feature and would be very easy for us to track down errors and warnings while writing code.
I think it's bad because it might slow down the performance of Geany. I think what you need is called "Linter" which a feature/function that will lint your codes while typing and it will show the errors in a a panel. You may open another issue to request for linter plugin.
Since saving happens on a timer there is no assurance that the user has finished typing legal code when the save happens, so (after the delay while compile happens) the irrelevant errors will appear just where the user is typing.
I understand it now, Irrelevant errors can do more harm than good. Thank you 👍
I think it would be really nice and effective if save actions plugin had a feature that would start compiling right after every save. That would be a 'clangd' like feature and would be very easy for us to track down errors and warnings while writing code.
I think it's bad because it might slow down the performance of Geany. I think what you need is called "Linter" which a feature/function that will lint your codes while typing and it will show the errors(without compiling) in a panel. You may open another issue at [geany-plugins](https://github.com/geany/geany-plugins) to request for linter plugin.
It indeed was not a good idea. Now I understand. As I had to lint manually, the best I thought was it. A linter plugin would be my gem here. I will request for linter plugin. Thank you very much. 👍
Actually it doesn't make much different if the new plugin would compile or lint the code from a technical point of view because linting as well as compiling in Geany is just executing a configured command and parse its output.
I also want such a plugin (for linting) but didn't manage to find the time to start writing it.
For any volunteers: in a basic variant it might be easy: take Save Actions' Autosave feature, put it into a new plugin and run the configured "Compile" or "Build" command for the current file (the configured build commands are different per filetype). I'm not sure if the configured build commands can be read via the plugin API, if not, such an API could be added.
In a more comfortable variant (maybe after the first basic version is working), one could ideally configure which of the available build commands is executed per filetype.
Still I would suggest to use Geany's Build commands at all for this feature as for these we already have good support in parsing and showing the output (in the Compiler tab at the bottom) and they are well tested and work fine. Implementing all this again in the plugin would be quite overkill.
take Save Actions' Autosave feature, put it into a new plugin and run the configured "Compile" or "Build" command for the current file (the configured build commands are different per filetype).
I still ask how does it know I have typed sensible code and am not half way through typing an identifier, or have typed `{` but not yet `}`?
I'm not sure if the configured build commands can be read via the plugin API, if not, such an API could be added.
https://www.geany.org/manual/reference/build_8h.html
one could ideally configure which of the available build commands is executed per filetype.
Thats a standard feature of the build commands system, open a C file `Build->Set Build Commands` and the first group of commands are C (or whatever the current filetype is) filetype specific, the user just needs to configure their "lint" command in the same place for each language. (remember its possible to add more command slots, so it doesn't have to use one of the default slots)
take Save Actions' Autosave feature, put it into a new plugin and run the configured "Compile" or "Build" command for the current file (the configured build commands are different per filetype).
I still ask how does it know I have typed sensible code and am not half way through typing an identifier, or have typed `{` but not yet `}`?
True but I guess this is something people using autosave need to accept. For me personally, it would be enough if a command is triggered upon manually saving the file.
So, thinking more about it, the new plugin basically does not need any autosave feature, just start a command once the file is saved in Geany (via signal). It doesn't matter if the existing SaveActions plugin or the user manually saved the file. Even easier!
Thats a standard feature of the build commands system, open a C file `Build->Set Build Commands` and the first group of commands are C (or whatever the current filetype is) filetype specific, the user just needs to configure their "lint" command in the same place for each language. (remember its possible to add more command slots, so it doesn't have to use one of the default slots)
What I meant is that a user can choose per filetype which of the configured commands is executed automatically. For example, for C I might want the "Compile" command which starts `cppcheck` or whatever but for Python I would rather the Build command executed because I configured it to use the linter. This would give more flexibility. Though this is of course a bonus and doesn't need to be available in the first place.
Anyway, let's hope someone feels encouraged to give it a try and implement something cool.
What I meant is that a user can choose per filetype which of the configured commands is executed automatically. For example, for C I might want the "Compile" command which starts `cppcheck` or whatever but for Python I would rather the Build command executed because I configured it to use the linter. This would give more flexibility. Though this is of course a bonus and doesn't need to be available in the first place.
Anyway, let's hope someone feels encouraged to give it a try and implement something cool.
So, in summary new plugin should be 'run on save' which would be able to run custom command per filetype after save happens. I wish I could be the one who write it. But my skill is limited as I only know c,c++ with 0 knowledge of gtk. With a mentor I think I would be able to implement that plugin but that's an option, may never happen. In that case, allow me to request for a plugin in the plugin, let's see if we get any good soul who implements it.
Maybe GeanyLua + `~/.geany/plugins/geanylua/events/saved.lua`? (See [geanylua-intro.html](https://github.com/geany/geany-plugins/blob/master/geanylua/docs/geanylua-in...).) ```lua local alist = { ["C"] = "BUILD_COMPILE", ["Python"] = "BUILD_LINK", ["Lua"] = "BUILD_RUN" } local afile = geany.fileinfo() geany.keycmd(alist[afile.type]) ``` where `["x"]` is the name from `filetype_extensions.conf`.
github-comments@lists.geany.org