On 09/20/2013 05:03 PM, Colomban Wendling wrote:
Le 20/09/2013 21:00, Tory Gaurnier a écrit :
[...],
however, I reallized that it's probably getting the line # to point at
from the current line number in File when you actually create the tag,
so I traced down the functions, and it appears to be the case, so with
that method it would most definitely not be pointing at the correct line
for the tag.
So here is my question, does anyone know if another filetype is already
doing something similar to this (scanning ahead to find aditional info
before adding the tag) so I can study it? Or is there maybe a way I can
copy File.fp so I can scan ahead on that one without affecting File? Or
is there a way to rewind File to a specific point (this would probably
be the easiest method)? If I rewind File.fp will it update all the other
info (File.lineNumber, File.filePosition, etc.) with it? I'm just weary
about editing File itself because it's kinda hard to trace down how it's
managed.
To do that, normally you store the File.lineNumber/File.filePosition at
the location you want to generate the tag, and use initTagEntry() and
makeTagEntry() instead of simpler but dumber makeSimpleTag():
createMyTag(qmlKind kind, const char *name, ...) {
tagEntryInfo entry;
initTagEntry (&entry, name);
entry.lineNumber = savedLineNumber;
entry.filePosition = savedFilePosition;
entry.kindName = QMLKinds[kind].name;
entry.kind = (char) QMLKinds[kind].letter;
makeTagEntry (&entry);
}
See e.g. Geany's PHP parser functions makeNamespacePhpTag() or
makeSimplePhpTag().
Regards,
Colomban
_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Sorry for the late reply, been super busy at work. But this is exactly
what I needed, thanks! I could tell makeSimpleTag() was a convenience
function but for some reason I was having trouble finding where and how
makeTagEntry was being used. I seem to have it working, when I run ctags
with a QML file now it prints js functions and QML Objects, and if it
finds their id it prints that as well.
Here's a sample of what it prints:
Item main.qml /^Item {$/;" o
Timer createLibraryTimer main.qml /^ Timer {$/;" o
Timer firstRunTimer main.qml /^ Timer {$/;" o
Timer loadLibraryTimer main.qml /^ Timer {$/;" o
Timer scanFoldersTimer main.qml /^ Timer {$/;" o
testFunc1 main.qml /^ function testFunc1(variable) {$/;" f
testFunc2 main.qml /^ function testFunc2() {$/;" f
Does that look about right?
One thing I notice is I don't see line numbers on output, is there an
option I have to run ctags with to show the line numbers maybe?
_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel