Phidica / sublime-fish

A robust Sublime Text syntax package for fish
MIT License
35 stars 2 forks source link

Prevent error message if no valid fish binary available #27

Closed kenblu24 closed 1 month ago

kenblu24 commented 2 months ago

This error message shows up when starting Sublime with a fish file loaded.

---------------------------
Sublime Text
---------------------------
Error: Couldn't find fish_indent executable. Specify a nonstandard install location in Preferences > Package Settings > Fish > Settings.
---------------------------
OK   
---------------------------

I'm on Windows and only have fish installed in WSL, so I can't specify a fish install 😢 I think it'd be nice to get an option to disable this message or explicitly disable auto-indenting, as I'd still love to have the syntax highlighting from this package.

Phidica commented 1 month ago

The auto-indenting can be disabled by setting "indent_on_save": false in the Fish package settings. In fact, it should be off by default. Did you perhaps turn it on and forget about it?

The indenter can also be called by running a build system, if you might have some other plugin that's automatically trying to run build systems on your files when they load...? Just a guess in case the above doesn't fix it.

kenblu24 commented 1 month ago

Apologies for the delay in response...

I have successfully replicated this behavior on a fresh portable install of sublime for Windows. I presume Sublime has no default behavior to build anything on launch, so this should rule out the build system theory?

Replication instructions:

  1. Download and unzip portable Sublime for win-x64-portable (4169, latest as of today)
  2. Run sublime exe and install package manager
  3. Install fish package; wait for install
  4. Save a file as something.fish
  5. Close sublime and re-open. Popup appears.

I've also set the package settings to {"indent_on_save": false,} on this install just in case, and the behavior persists.

I'll have access to a fresh linux box soon™️ but I doubt that's the issue anyways

kenblu24 commented 1 month ago

"compat_highlighter_fish_version": "3", also fails to prevent the error

I believe this is due to the following code

    # Only first instance will set this
    if CompatHighlighter.sysFishVer is None:
      out,err = getFishOutput(['fish', '--version'], self.view.settings())

which I presume is called on plugin startup regardless of settings.

Phidica commented 1 month ago

Thanks a lot for your analysis on this! It helped me with getting down to the cause of the problem. This will be fixed with the release of 3.4.1.

One thing I don't understand though is why your initial report says "Couldn't find fish_indent", because this problem was definitely in the compat highlighter and it only calls regular fish. If that fish_indent error recurs, please re-open this issue and provide the details to reproduce it.