[Geany-Devel] GEANY - New behaviour of "close" document action to close only tabs

Thomas Young thomasyoung at free.fr
Tue Jan 22 09:19:07 UTC 2013


Hi Lex,

 > Or you can load tags files instead, so long as the symbols are in
 > memory, and I am told (I don't use them myself) that the project
 > plugins (there are two with slightly differing behaviour) will arrange
 > for this to happen for you, rather like the msvc system.

Ok, that makes more sense!


 >> (As an aside, for myself, I'm managed to hack something up that uses
 >> libClang to lookup references, that doesn't need know about the 
whole set of
 >> project files in order to work. It actually just executes the 
corresponding
 >> compile command within libClang each time you click 'lookup 
reference', and
 >> so fits in quite nicely with the 'no list of files in project' 
paradigm..)
 >
 > That sounds interesting, are you going to make a plugin from it?

I made a plugin.
It turns out it doesn't actually require a lot of code, once you have 
libClang.

The key source files are attached, for reference.
(Will need a bit hacking to build, sorry, I have a fairly non standard 
build setup, but the key stuff is there. Note that this refers to custom 
vector and string headers but it should be straightforward to replace 
these with stl containers.)

Some notes:

  * For source files, the plugin needs to know the compile command to 
use. In this case this is hardcoded, and is essentially just some 
include paths.

  * For header files, we need to generate a source file in memory that 
includes the header. In the build setup I am using the paradigm is that 
there is one standard base header required at the top of each .cpp, and 
apart from that each header should make sure that it includes anything 
else that it needs. The path to the base header is then hardcoded here.

For a plugin to be useful more generally (i.e. not depending on my 
specific build setup), I guess it could maybe take compile info from the 
project compile command setup, and allow to edit some kind of template 
for generating cpp for headers.


 > Maybe you could load the symbols info into Geany and then not have to
 > run clang again and again.  Matthew was also looking at something
 > similar I think.

Well I just built a new machine, and Clang is pretty fast (much faster 
than Visual Studio compiler for example), so it turns out that this is 
just not an issue for me in practice. ;-)

Note that we only have to compile one single source file to do this, no 
other objects need to be compiled or referenced.

Caching symbols would obviously make things more complicated, and would 
also require to do some kind of dependency check for changes for 
everything that is included by the source file..


Best regards,

Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LookupReference.cpp
Type: text/x-c++src
Size: 3161 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20130122/e5d280d6/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LookupReferencePlugin.cpp
Type: text/x-c++src
Size: 3534 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20130122/e5d280d6/attachment-0001.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PythonStyleString.h
Type: text/x-chdr
Size: 1820 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20130122/e5d280d6/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LookupReference.h
Type: text/x-chdr
Size: 392 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20130122/e5d280d6/attachment-0001.h>


More information about the Devel mailing list