Open michaelblyons opened 3 years ago
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.
A possibly useful reference: https://hyperpolyglot.org/unix-shells
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
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.