While it would be nice to get rid of some extra tags, this field is generated in ctags using file name and also some questionable heuristics which doesn't lead to completely reliable results so better to avoid this field.
Reverts #3268.
Fixes #3454. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3457
-- Commit Summary --
* Don't use ctags isFileScope tag information
-- File Changes --
M src/tagmanager/tm_workspace.c (5)
-- Patch Links --
https://github.com/geany/geany/pull/3457.patch https://github.com/geany/geany/pull/3457.diff
I maybe have a better idea how to fix this issue - I think it's fixable in uctags. Will try to prepare a patch.
The thing that will complicate it is that a Geany user can set filetype, and really uctags should use that, not its own determination.
The thing that will complicate it is that a Geany user can set filetype, and really uctags should use that, not its own determination.
That would be hard to do with the hacky interface we have against uctags (and I don't want to introduce too many Geany-specific things to uctags which is primarily a command-line tool).
But the main problem is that for `isHeader()` uctags defaults to `TRUE` for an unknown file extension which is what I'd like to change. In the C++ parser, the logic looks typically like ``` if (tag->isFunctionDeclaration && !isHeader()) tag->local = true; ``` If `isHeader()` returns `FALSE` for `*.foo` files, we'll be fine.
Of course if the user uses something crazy like `*.C` for headers, we'll be doomed but I don't think this is very likely. Also when `*.foo` is a source file we get `tag->local = false` incorrectly but the only difference is there will be some extra tags in the autocompletion popup which is not a big problem either and which would happen for all the tags if we applied this PR.
Also I think `isHeader()` defaulting to `FALSE` for unknown files is a good idea in general because real C/C++ sources tend to have the right extension but it's the headers (or header-like things like CORBA `*.idl` interface definition files) which tend to have some special extension (e.g. `signallist.i` in Geany or the `*.hdl` files that triggered this problem).
But the main problem is that for isHeader() uctags defaults to TRUE for an unknown file extension which is what I'd like to change.
Ok, since Geany can't distinguish header from body (in the actual language there _is_ no distinction, a "header" is just what programmers call a C/C++ file that meets some idioms that allow it to be included multiple times in client and body files without generating multiple declarations or vast repeated quantities of code/data) I guess the only distinction is uctags version, however good (or not) it is.
@techee Do you think it'd be realistic to come up with a fix (nicer than this one) in Geany until something is done in U-CTags? I really think that's something we ought to fix before releasing at least. Maybe "just" have a diff on our side, if it's a simple enough change? not that I like the idea of re-introducing ctags diff, but…
@techee Do you think it'd be realistic to come up with a fix (nicer than this one) in Geany until something is done in U-CTags? I really think that's something we ought to fix before releasing at least. Maybe "just" have a diff on our side, if it's a simple enough change? not that I like the idea of re-introducing ctags diff, but…
I'd say let's wait what @masatake thinks about https://github.com/universal-ctags/ctags/pull/3696. If a solution like that is accepted upstream, I'll backport the fix for Geany. If not, we'd have to figure out what to do.
I really think that's something we ought to fix before releasing at least.
Yes, we should definitely fix it before our regular 3-times-a-year Geany release ;-)
Yes, we should definitely fix it before our regular 3-times-a-year Geany release ;-)
Three years a time? :grin:
Closed #3457.
Closing as this PR is obsoleted by #3490.
github-comments@lists.geany.org