gediminasz / ctags-companion

A Visual Studio Code symbols provider based on Ctags
https://marketplace.visualstudio.com/items?itemName=gediminaszlatkus.ctags-companion
MIT License
25 stars 7 forks source link

Silence errors and/or do not run the extension (ctag commands) unless a tags file is present #43

Closed dawpud closed 10 months ago

dawpud commented 11 months ago

Hello, Currently, if I open a project that does not have a tags file generated and then try to "go to definition" or something similar, an error will pop up saying "Command failed: ... No such file or directory: tags", even if another extension provided symbols. Many of my projects do not use/require tags files, but I would like to keep this extension installed for the ones that do. Is there a way to either silence these errors if no tag file is found or not run this extension (i.e., do not register as a symbol provider, do not generate an outline, etc.) if there is no tag file present? The extension requires a tag file to be generated to fully work anyway.

I feel like selectively enabling the extension for workspaces that need it is a bit cumbersome, unless that is just the standard approach for situations like this.

Thank you!

gediminasz commented 11 months ago

Thanks for the feedback! I can see it being annoying and what you are suggesting makes sense. Can't think of a reason why it does not work like that in the first place. I will try to fix this in the next release.

In the meantime another thing you can try is changing the ctags-companion.documentSelector setting. For example, I use ctags only for Python, so I have this:

    "ctags-companion.documentSelector": [
        "python"
    ],

https://code.visualstudio.com/api/references/vscode-api#DocumentSelector

gediminasz commented 10 months ago

Published a new v2023.11.0 release with a change to errors now being logged to the Output tab rather than toast notifications.