Coder Social home page Coder Social logo

Comments (14)

redguardtoo avatar redguardtoo commented on June 12, 2024 1

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

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

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.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

3c42153 tested on windows (Chen Bin)

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

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"

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

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")?

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

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.

  1. Can *.inl files be included in the tags data base?
  2. I noticed that function declarations with line breaks are not properly represented in the TAGS file. They seem to cause truncated lines in the tags file. The attached file is quite short and has two examples of this.
    prop_intersection.hpp.txt
  3. The quality of the search results sometimes has problems. E.g. when looking up method sample() (lower case), I get many hits for classes called Sample (upper case). I cannot tell whether this always was the case and I just stumbled upon it now, or if it is a new problem.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

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"

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

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

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

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?

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

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.

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

need some use cases:

  • in 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}.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

In many languages one could try to differentiate between variables and functions based on trailing brackets. E.g. a = a();

from counsel-etags.

redguardtoo avatar redguardtoo commented on June 12, 2024

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++.

from counsel-etags.

Opioid avatar Opioid commented on June 12, 2024

Ah, cool. My lisp is very bad but I might give it a try some time.

from counsel-etags.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.