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

[RFC] Shells, there are so many #2638

Closed
michaelblyons opened this issue Nov 24, 2020 · 4 comments
Closed

[RFC] Shells, there are so many #2638

michaelblyons opened this issue Nov 24, 2020 · 4 comments
Labels
C: Syntax RFC T: feature major update for a syntax to support new language features

Comments

@michaelblyons
Copy link
Collaborator

The ShellScript package has basically evolved into Bash (and is now fairly explicit about being Bash). People are using the Bash-centric highlighting for their sh, Zsh, Fish, etc. files as well, and it sometimes leads to mishighlighting.

What should be done? Here are some broad options:

Leave it as-is

This has the nice feature of being simple. Anyone can make or install a third-party package that specifically matches their shell's syntax.

Add other shells here

Pros: ST ships with more stuff.
Cons: maintenance, update cycle, making the thing in the first place, duplication of work.

Add other shells here as inherited files

I imagine this as a POSIX.sublime-syntax that Bash and other shells can inject into or tinker with.

Pros: ST ships with more stuff. Less duplication of work than independent files.
Cons: maintenance, update cycle, now the Shells are interdependent and changes are harder to make without breaking something else.

@deathaxe
Copy link
Collaborator

We have inheritance. It should be quite simple to handle smaller differences like those between bash and zsh.

I don't have any overview about the shell specific details though. I am not quite sure which implementations in Bash were made tolerant to work with ZSH or other shell dialects.

I am not quite sure which ones are special for Bash only.

If we want to create different dialects, we should have a base syntax which contains common rules, which Bash, ZSH, ... can make use of by inerhitance. Not sure if POSIX.sublime-syntax would be the name of choise or something generic like Shell (Plain).sublime-syntax or Shell (Basic).sublime-syntax.

Not sure where to put the cryptic long Shell-Unix-Generic to in that context. It is a synonym for Bash atm and is used by Makefile.

In short: Can bash be renamed to "Shell (Basic)" with source.shell and creating a derived empty Bash.sublime-syntax as synonym or where to start?


I think we should handle simple to handle dialects in this repo to have them out of the box and keep them together. I am still a bit concerned about possible dependencies created by inheritance. If too many 3rd-party packages extend syntaxes of this repo it will become hard/impossible to make bigger changes (renaming contexts) without breaking them. Thus we should try to keep things together.

I am not sure about Fish though. With a bird's eye on its homepage syntax seems quite different. Not sure if that can be handled with overriding 2 or 3 contexts only.

Not aware of all the other's though.

@wbond
Copy link
Member

wbond commented Nov 24, 2020

A possibly useful reference: https://hyperpolyglot.org/unix-shells

@deathaxe deathaxe added T: feature major update for a syntax to support new language features RFC labels Aug 19, 2021
@deathaxe
Copy link
Collaborator

Probably useful to choose/find POSIX compatible common language features to be commonly supported by all shells.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html

@michaelblyons
Copy link
Collaborator Author

I think this is closed by #4024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Syntax RFC T: feature major update for a syntax to support new language features
Projects
None yet
Development

No branches or pull requests

3 participants