-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allowing osascript -l JavaScript
as a JavaScript shebang
#9337
Comments
This needs a change to the shebang capturing regex so that we also capture the arguments of the shebang: helix/helix-core/src/syntax.rs Line 2365 in eef46b1
|
Thank you for the context. It seems like an easy fix: removing the last Or maybe you’d prefer I submit the PR anyway and the conversation continues from there? |
It looks like that regex originally came from #1001. Seems like it's custom so I don't think it should be a problem to change it |
When I changed the regex it didn't seem to work yet. I assume a bit more work in another place is required too |
Some food for thought:
The current shebang strategy seems to be:
I don't see a way for a single regex to cover all of the above cases but I wonder if maybe instead, the shebang matching could have two phases: the exe-name match that operates exactly how it currently does, and then a second step that matches on the arguments: [[language]]
name = "javascript"
shebangs = ["node", { command = "osascript", arguments = ["-l Javascript"] }] |
JavaScript for Automation (JXA) is a companion/alternative to AppleScript available for default on macOS. One can use it in a script with the shebang:
#!/usr/bin/osascript -l JavaScript
Those are essentially JavaScript files and should be treated as such, but currently (if they don’t have an extension) I have to
:set-language
every time I open one.Following the file in the repo, I edited
languages.toml
to have:But files with that shebang are still not parsed as JavaScript. However, it works if the configuration is instead:
Which isn’t quite right, because files without the
-l JavaScript
are “regular” AppleScript, which Helix doesn’t seem to support at all (but that’s a different issue).So maybe a deeper change would be needed in Helix to support this use case? Is there a workaround I can use in the meantime?
The text was updated successfully, but these errors were encountered: