[Geany-Devel] [FT-plugins] Proposed "Features"

Matthew Brush mbrush at xxxxx
Thu Sep 1 00:50:41 UTC 2016

On 2016-08-31 07:55 AM, Thomas Martitz wrote:
> Am 31.08.2016 um 16:52 schrieb Lex Trotman:
>> On 1 September 2016 at 00:43, Thomas Martitz <kugel at rockbox.org> wrote:
>>> Am 31.08.2016 um 16:39 schrieb Matthew Brush:
>>>> I can't speak to all compiler libraries, but at least
>>>> libclang, libpython and libvala "compile" the source (well just
>>>> the front-end of the compiler is needed). They literally use
>>>> the built-in compiler front ends to understand the code. In the
>>>> case of libclang, it additionally provides helpful methods for
>>>> performing IDE-related features on the AST, while say with
>>>> libvala, the ft-plugin would be required to perform it's own
>>>> analysis of the AST to implement those feaures, which is still
>>>> a lot less work than in Geany/TM since it has access to the
>>>> full AST/context and the ft-plugin need not fear encoding
>>>> language specific semantics into its logic.
>>> How do you pass {C,CXX,CPP}FLAGS to libclang? And where do you get them
>>> from?
>> Libclang needs the full-fat build knowledge that "project" systems on
>> other IDEs provide.  Another reason to keep it separate from Geany.
> So one would have to adjust the build settings and one or more
> ft-plugins all the time?

One would have to tell the ft-plugin how to compile the code (where 
applicable). libclang can read a so-called "compilation-database"[0] 
which can be generated by CMake[1], Ninja[2], a Make wrapper called 
Bear[3], or written by hand.

> IMO, complex build system integration is out of scope for ft-plugins.

I generally agree, although we could potentially look at improving 
projects/build commands in the future to some extent, I don't think we 
should look at it much at this point with ft-plugins.

> But I see that not all features can be supported properly without build
> system.

I don't think they'll usually require a "build system" per se, but they 
definitively need to be told how to compile the code where applicable.

For libpython, I don't think it needs any flags. For libvala IIRC and 
libclang (if not using compile_commands.json) they require the `argv` 
you'd pass to the compiler itself. It may very well be possible for 
ft-plugins using libraries with the `argv` approach to just grab the 
compile command from Geany's build commands and convert it back into an 
`argv` array or something.

Matthew Brush

[0]: http://clang.llvm.org/docs/JSONCompilationDatabase.html
[2]: https://ninja-build.org/manual.html#_extra_tools
[3]: https://github.com/rizsotto/Bear

More information about the Devel mailing list