Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompatHighlighter.sysFishVer auto modal dialog with Fish 4.0b1 #29

Closed
melomac opened this issue Dec 23, 2024 · 3 comments
Closed

CompatHighlighter.sysFishVer auto modal dialog with Fish 4.0b1 #29

melomac opened this issue Dec 23, 2024 · 3 comments

Comments

@melomac
Copy link
Contributor

melomac commented Dec 23, 2024

match = re.search(r'[0-9]+\.[0-9]+\.[0-9]+', out.strip())

Hi

Many thanks for sublime-fish module! It has been (and still is) the companion one can hope for since I am using Sublime Text and fish-shell, for more than a decade.

I'd like to inform you the code to parse the version wouldn't expect the recently introduced 4.0b1 version number:

Error in fish.sublime-settings: The 'auto' setting was unable to determine your fish version. Please report a bug using Preferences > Package Settings > Fish > Report a bug. Include your system information, and the output of 'fish --version' in your terminal. To work around this error, set 'compat_highlighter_fish_version' in the settings file.

Fish version: fish, version 4.0b1-13-g541f8b47b (built with brew install fish --HEAD)

# Currently, I can't imagine this happening. Prove me wrong!

Ahahah

Considering 4.0b1 means 4.0 in term of compatibility, it is probably safe to consider an alternative regular expression to match numbers and dots up to the eventual - separator, as I proposed in virtualfish project here, ex:

diff --git a/highlighter_compat.py b/highlighter_compat.py
index af2804f..c08cb1d 100644
--- a/highlighter_compat.py
+++ b/highlighter_compat.py
@@ -78,7 +78,7 @@ class CompatHighlighter(sublime_plugin.ViewEventListener, BaseHighlighter):
       if out:
         # For builds from source, version string may be e.g. "fish, version 3.0.2-1588-g70fc2611"
         # Hence, we just search() for the match anywhere in the string
-        match = re.search(r'[0-9]+\.[0-9]+\.[0-9]+', out.strip())
+        match = re.search(r'.*version ([\d\.]+)', out.strip())
       else:
         CompatHighlighter.sysFishVer = 'not found' # Couldn't find executable
 
@@ -86,7 +86,7 @@ class CompatHighlighter(sublime_plugin.ViewEventListener, BaseHighlighter):
         sublime.error_message(err)
 
       if match:
-        CompatHighlighter.sysFishVer = match.group(0)
+        CompatHighlighter.sysFishVer = match.group(1)
       elif out:
         CompatHighlighter.sysFishVer = 'error' # This shouldn't happen!
 

But you might prefer something closer to this:

r'fish([0-9]+(?:\.[0-9]+(?:\.[0-9]+)?)?)',

I am going to give it a try and I'll be honored to humbly contribute to your project with such a simple PR.

Many thanks again for maintaining this project.

@Phidica
Copy link
Owner

Phidica commented Jan 1, 2025

Ahh! Yeah I never thought about the beta releases! Thanks for taking the initiative on preparing a PR 😁 I think we probably don't have to be too fussy about the format of the version number, so your simple suggested regex is fine. Cheers!

@Phidica Phidica closed this as completed Jan 1, 2025
@Phidica
Copy link
Owner

Phidica commented Jan 1, 2025

By the way, if you find any notable changes in fish 4.0b1 that aren't reflected in the syntax highlighting of this package, or in the compatibility highlighter, please open an issue to let me know. I read through the fish 4 changelog and nothing jumped out at me as relevant to this package, but I'm not really in a position to test it thoroughly myself right now

@melomac
Copy link
Contributor Author

melomac commented Jan 2, 2025

What a delightful way to start a fresh calendar revolution! Many thanks for maintaining the project 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants