bash-language-server icon indicating copy to clipboard operation
bash-language-server copied to clipboard

Shellcheck'ing is performed in spite of it being disabled

Open 64kramsystem opened this issue 2 years ago • 5 comments

Code editor

Visual Studio Code

Platform

Unix (Ubuntu x64)

Version

v1.35.0

What steps will reproduce the bug?

  • Create a shell script that causes a Shellcheck warning
  • Disable shellcheck, by setting bashIde.shellcheckPath an empty string
  • Warnings are still raised (even after restarts etc.)

How often does it reproduce? Is there a required condition?

100% of the times

What is the expected behavior?

No warnings should be raised.

What do you see instead?

Warning (in my test, Source command could not be analyzed: non-constant source not supported.)

Additional information

No response

64kramsystem avatar Mar 07 '23 16:03 64kramsystem

It's not a shellcheck warning. It's from bashIde. See #738 for more details.

misaki-web avatar Mar 16 '23 01:03 misaki-web

Thank you so much for reaching out!

Note that the warning “Source command could not be analyzed” isn’t related to ShellCheck, it informs the user that jump to definition and documentation across files wouldn’t work as we failed to analyse the source command. But we do use ShellCheck directives to help you fix the issue.

But this message seems confusing to multiple people, so I've made it configurable and disabled by default. See https://github.com/bash-lsp/bash-language-server/pull/794 – this was released as vscode extension 1.36 and bash-language-server version 4.8.4.

Please let us know if you have other problems or suggestions for new features.

skovhus avatar Mar 24 '23 21:03 skovhus

Note that the warning “Source command could not be analyzed” isn’t related to ShellCheck

Thanks! After looking at the related issue, I did figure out the problem.

I think that the core problem still persists. In my view, the problem is not the warning itself, rather, the fact that since there is no obvious hint to the fact that the issue is raised by the extension rather than by Shellcheck (to me, the color is a really weak indicator), it's extremely confusing to figure out why setting the conventional -x -P SCRIPTDIR options don't solve the warning (I personally find the solution of adding the directive source=relative_path/the_script_name acceptable, it's just that I couldn't figure out why it was necessary).

If the warning is disabled by default, it won't be obvious why jump to function won't work, in the cases where the source directive is not defined (I think I've restarted VSC, and found the new extension version, with the "Enable Source Error Diagnostics" option disabled).

I think that rather than displaying the solution (or maybe, in addition to that), the warning message could be extended with a text making clear that this is not a Shellcheck problem (and possibly, that configuring Shellcheck won't work), or entire replaced with such text and a wiki link (in case the message gets too long) or similar.

64kramsystem avatar Mar 24 '23 23:03 64kramsystem

Unfortunately vscode doesn’t make it easy to differentiate between diagnostics from different extensions. I haven’t found a general solution to this. If you have some examples of extensions that make their original really clear, then please send them my way. 🙏

I think that rather than displaying the solution (or maybe, in addition to that), the warning message could be extended with a text making clear that this is not a Shellcheck problem (and possibly, that configuring Shellcheck won't work), or entire replaced with such text and a wiki link (in case the message gets too long) or similar.

Any suggestion on how to change the message is more than welcome. The wiki link is not a bad idea, a bit more to maintain and keep around for backwards compatibility (note that the language server is used in most editors with a lot of different versions).

skovhus avatar Mar 25 '23 07:03 skovhus

Unfortunately vscode doesn’t make it easy to differentiate between diagnostics from different extensions. I haven’t found a general solution to this. If you have some examples of extensions that make their original really clear, then please send them my way. pray

Thanks for looking into it! Yikes, I thought it was trivial :flushed: I have no idea :sob:

64kramsystem avatar May 05 '23 10:05 64kramsystem