Open Opioid opened 5 years ago
Could you create a minimum cpp file and send it me?
You also need (setq counsel-etags-debug t)
, reproduce the issue and send me emacs output.
Besides, as I see from the tags file, you might need use relative path to create tags file. Use ctags -R -e .
instead of ctags -R -e C:\projs1
main.cpp.txt I get the following emacs output:
No project found. You can create tags file using ‘counsel-etags-scan-code’.
So we don’t need project root at all. Or you can setup ‘counsel-etags-project-root’.
c:\\cygwin64\\bin\\find.exe . \( -iwholename "*/.vscode" -or -iwholename "*/tools" -or -iwholename "*/test" -or -iwholename "*/extern" -or -iwholename "*/doc" -or -iwholename "*/deps" -or -iwholename "*/data" -or -iwholename "*/build" -or -iwholename "*/.git" -or -iwholename "*/.svn" -or -iwholename "*/.cvs" -or -iwholename "*/.bzr" -or -iwholename "*/.hg" -or -iwholename "*/bin" -or -iwholename "*/fonts" -or -iwholename "*/images" -or -iwholename "*/.DS_Store" -or -iwholename "*/.npm" -or -iwholename "*/.tmp" -or -iwholename "*/.sass-cache" -or -iwholename "*/.idea" -or -iwholename "*/node_modules" -or -iwholename "*/bower_components" -or -iwholename "*/.tox" -or -iwholename "*/.cask" \) -prune -o -type f -not -size +800k -not -name ".clang-format" -not -name "*.json" -not -name "*.log" -not -name "tags" -not -name "TAGS" -not -name "*.tgz" -not -name "*.gz" -not -name "*.xz" -not -name "*.zip" -not -name "*.tar" -not -name "*.rar" -not -name "GTAGS" -not -name "GPATH" -not -name "GRTAGS" -not -name "cscope.files" -not -name "*bundle.js" -not -name "*min.js" -not -name "*min.css" -not -name "*.png" -not -name "*.jpg" -not -name "*.jpeg" -not -name "*.gif" -not -name "*.bmp" -not -name "*.tiff" -not -name "*.ico" -not -name "*.doc" -not -name "*.docx" -not -name "*.xls" -not -name "*.ppt" -not -name "*.pdf" -not -name "*.odt" -not -name "*.obj" -not -name "*.so" -not -name "*.o" -not -name "*.a" -not -name "*.ifso" -not -name "*.tbd" -not -name "*.dylib" -not -name "*.lib" -not -name "*.d" -not -name "*.dll" -not -name "*.exe" -not -name ".metadata*" -not -name "*.class" -not -name "*.war" -not -name "*.jar" -not -name "*flymake" -not -name "#*#" -not -name ".#*" -not -name "*.swp" -not -name "*~" -not -name "*.elc" -not -name "*.pyc" -print | ctags -e -L - at e:/projects/workspace/projects/etagsrepro/
counsel-etags-collect-cands: Wrong type argument: stringp, nil
‘c:\\cygwin64\\bin\\find.exe . \( -iwholename "*/.vscode" -or -iwholename "*/tools" -or -iwholename "*/test" -or -iwholename "*/extern" -or -iwholename "*/doc" -or -iwholename "*/deps" -or -iwholename "*/data" -or -iwholename "*/build" -or -iwholename "*/.git" -or -iwholename "*/.svn" -or -iwholename "*/.cvs" -or -iwholename "*/.bzr" -or -iwholename "*/.hg" -or -iwholename "*/bin" -or -iwholename "*/fonts" -or -iwholename "*/images" -or -iwholename "*/.DS_Store" -or -iwholename "*/.npm" -or -iwholename "*/.tmp" -or -iwholename "*/.sass-cache" -or -iwholename "*/.idea" -or -iwholename "*/node_modules" -or -iwholename "*/bower_components" -or -iwholename "*/.tox" -or -iwholename "*/.cask" \) -prune -o -type f -not -size +800k -not -name ".clang-format" -not -name "*.json" -not -name "*.log" -not -name "tags" -not -name "TAGS" -not -name "*.tgz" -not -name "*.gz" -not -name "*.xz" -not -name "*.zip" -not -name "*.tar" -not -name "*.rar" -not -name "GTAGS" -not -name "GPATH" -not -name "GRTAGS" -not -name "cscope.files" -not -name "*bundle.js" -not -name "*min.js" -not -name "*min.css" -not -name "*.png" -not -name "*.jpg" -not -name "*.jpeg" -not -name "*.gif" -not -name "*.bmp" -not -name "*.tiff" -not -name "*.ico" -not -name "*.doc" -not -name "*.docx" -not -name "*.xls" -not -name "*.ppt" -not -name "*.pdf" -not -name "*.odt" -not -name "*.obj" -not -name "*.so" -not -name "*.o" -not -name "*.a" -not -name "*.ifso" -not -name "*.tbd" -not -name "*.dylib" -not -name "*.lib" -not -name "*.d" -not -name "*.dll" -not -name "*.exe" -not -name ".metadata*" -not -name "*.class" -not -name "*.war" -not -name "*.jar" -not -name "*flymake" -not -name "#*#" -not -name ".#*" -not -name "*.swp" -not -name "*~" -not -name "*.elc" -not -name "*.pyc" -print | ctags -e -L -‘ executed.
Tags file e:/projects/workspace/projects/etagsrepro/TAGS was created.
Read file .... nil 140
tags-file=e:/projects/workspace/projects/etagsrepro/TAGS
counsel-etags-cache[tags-file]=nil
force-tags-file=e:/projects/workspace/projects/etagsrepro/TAGS tags-file=e:/projects/workspace/projects/etagsrepro/TAGS
tagname=add
Note: file is write protected
counsel-etags-open-file-api: Search failed: "add"
Looking at my emacs config I don't see any explicit usage of ctags, so it should just be using the defaults.
EDIT:
FWIW, I tried it on my linux machine and it seems to have stopped working completely. This is the ouptut:
find . \( -iwholename "*/.vscode" -or -iwholename "*/tools" -or -iwholename "*/test" -or -iwholename "*/extern" -or -iwholename "*/doc" -or -iwholename "*/deps" -or -iwholename "*/data" -or -iwholename "*/build" -or -iwholename "*/.git" -or -iwholename "*/.svn" -or -iwholename "*/.cvs" -or -iwholename "*/.bzr" -or -iwholename "*/.hg" -or -iwholename "*/bin" -or -iwholename "*/fonts" -or -iwholename "*/images" -or -iwholename "*/.DS_Store" -or -iwholename "*/.npm" -or -iwholename "*/.tmp" -or -iwholename "*/.sass-cache" -or -iwholename "*/.idea" -or -iwholename "*/node_modules" -or -iwholename "*/bower_components" -or -iwholename "*/.tox" -or -iwholename "*/.cask" \) -prune -o -type f -not -size +800k -not -name ".clang-format" -not -name "*.json" -not -name "*.log" -not -name "tags" -not -name "TAGS" -not -name "*.tgz" -not -name "*.gz" -not -name "*.xz" -not -name "*.zip" -not -name "*.tar" -not -name "*.rar" -not -name "GTAGS" -not -name "GPATH" -not -name "GRTAGS" -not -name "cscope.files" -not -name "*bundle.js" -not -name "*min.js" -not -name "*min.css" -not -name "*.png" -not -name "*.jpg" -not -name "*.jpeg" -not -name "*.gif" -not -name "*.bmp" -not -name "*.tiff" -not -name "*.ico" -not -name "*.doc" -not -name "*.docx" -not -name "*.xls" -not -name "*.ppt" -not -name "*.pdf" -not -name "*.odt" -not -name "*.obj" -not -name "*.so" -not -name "*.o" -not -name "*.a" -not -name "*.ifso" -not -name "*.tbd" -not -name "*.dylib" -not -name "*.lib" -not -name "*.d" -not -name "*.dll" -not -name "*.exe" -not -name ".metadata*" -not -name "*.class" -not -name "*.war" -not -name "*.jar" -not -name "*flymake" -not -name "#*#" -not -name ".#*" -not -name "*.swp" -not -name "*~" -not -name "*.elc" -not -name "*.pyc" -print | ctags -e -L - at /home/beni/workspace/projects/sprout/
counsel-etags-collect-cands: Wrong type argument: stringp, nil
error in process filter: Wrong type argument: markerp, nil [2 times]
Failed to create tags file.
3c42153 tested on windows (Chen Bin)
On this windows machine the last update also causes the generation of the tags file to fail (As on linux, but slightly different message).
counsel-etags-scan-dir called => e:/projects/workspace/projects/sprout/ t
You need install ctags first.
counsel-etags-get-scan-command called => find-pg=c:\\cygwin64\\bin\\find.exe ctags-pg=nil cmd=
counsel-etags-scan-dir-internal called => src-dir=e:/projects/workspace/projects/sprout/ force=t find-pg=c:\\cygwin64\\bin\\find.exe ctags-pg=nil default-directory=e:/projects/workspace/projects/sprout/ cmd=
at e:/projects/workspace/projects/sprout/
counsel-etags-find-tag-api called => sample nil nil
error in process filter: Wrong type argument: markerp, nil [2 times]
Failed to create tags file.
If the TAGS file already exists it still fails to open the file from the results, but the error message has changed again. (Counsel-etags still shows the duplicated paths in the results list.)
counsel-etags-find-tag-api called => getName nil e:/workspace/p2render/
counsel-etags-collect-cands called tagname=getName fuzz=nil dir=e:/workspace/p2render/
tags-file=e:/workspace/p2render/TAGS
counsel-etags-cache[tags-file]=nil
force-tags-file=e:/workspace/p2render/TAGS tags-file=e:/workspace/p2render/TAGS
tagname=getName
Note: file is write protected
counsel-etags-open-file-api: Search failed: "getName"
Does c:\cygwin64\bin\ctags.exe
exist? Have you installed ctags? Or maybe reinstall ctags?
What's the result of (file-executable-p "c:\\\\cygwin64\\\\bin\\\\\ctags.exe")
?
Actually, ctags was not installed under cygwin, but I had a binary lying around somewhere else. After installing cygwin ctags an regenerating the tags file it works! Sorry for the confusion, but I didn't understand what was going on, because it just stopped working some day.
Thanks for helping me out. I find counsel-etags very helpful in navigating code bases and use it regularly!
Now I noticed a few other things but they might be more related to ctags in general then etags-counsel in particular.
Yeah, I should warn user when ctags is not installed.
ctags can support any language because in essence it's just regular expression, check its documentation and my ctags setup on README.
I was also a good C++ developer so I understand your concern.
I intentionally to make the initial tag search more generic because it's actually more efficent.
If you get multliple canidates, press !keyword1\|keyword2
to filter out results (when filtering, it's actually case sensitive regular expression but space means .*
).
That's actually faster because you don't need worry about case and which part of tag name you input. For example, to manually search "MyFunctionName", you can input "yfun"
I could solve problem 1 & 2 simply by manually copying a windows build of universal ctags into the cygwin directory!
That's actually faster because you don't need worry about case and which part of tag name you input. For example, to manually search "MyFunctionName", you can input "yun"
Fair enough, I can see how that can be useful. However, I generally use find-tag-at-point, and in that specific case I would argue that the most helpful action would be to exclude tags that cannot reasonably be the thing at point (e.g. function vs. class). If it is a matter of implementation efficiency that would slow down every other aspect I can see why you made that decision, though. If CPU time is not the issue, it might even be cool to try to narrow it down further by looking at the signature
Maybe it's good idea that find-tag-at-point
should initiate case sensitive search.
I'm concerned that any "smarter" algorithm makes counsel-etags
slower and less generic.
On the other hand, I agreed user should have freedom to extend the program.
What about giving you a callback function to filter the candidates with original context (the file name and line number where to start search the tag) as parameter?
Maybe it's good idea that
find-tag-at-point
should initiate case sensitive search. I would like that.I'm concerned that any "smarter" algorithm makes
counsel-etags
slower and less generic. Makes sense to me.What about giving you a callback function to filter the candidates with original context (the file name and line number where to start search the tag) as parameter? Sounds good. But on the other hand I must be the worst elisp programmer using emacs so I'm not sure what I would do with it. As it is, counsel-etags is a very helpful tool for me. Thanks for sharing it.
need some use cases:
js2-mode
, this.fn1
, if current font face js2-object-property-access
, try to get parent node name, if parent is this
, at least we could exclude candidates like fn1={abce}
.In many languages one could try to differentiate between variables and functions based on trailing brackets. E.g. a = a();
85ef653 add smart rules to filter out noise (Chen Bin)
I added plugin system. Now only support javascript. But I'm open to new rule for C++.
Ah, cool. My lisp is very bad but I might give it a try some time.
Recently counsel-etags-find-tag-at-point started suggesting and open bogus files. (This happens on windows, I haven't had the chance to try on linux yet.)
Here is an example of a search result suggested by counsel-etags:
e:/projects/workspace/projects/sprout/E:\projects\workspace\projects\sprout\source\core\scene\material\matte\matte_material.cpp:14:material::Sample const& Material::sample(...)
I guess the interesting thing is that the first part of the path is duplicated with different slashes. Selecting such a result will open an empty buffer.
The entry in the TAGS file starts with
E:\projects\workspace\projects\sprout\source\core\scene\material\matte\matte_material.cpp,607
So I don't know where that e:/projects/workspace/projects/sprout/ prefix is coming from.