Settle on an extension
- Thoughts
- Command name might influence this (#41)
- With the explosion of extensions, how do we decide when an extension should not be overloaded
- A non-
.rsextension can signal syntax extensions exist like she-bang support or implicitmainand might help with tooling, like IDE support
- Ideas
-
.rs(do we make the syntax legal for all.rsfiles) -
.rsh(rust shell)
-
From reddit
chris-morgan
Point of curiosity: have you figured out why these other things have used an extension other than .rs?
epage
My guess is two parts
- it technically is a different format because a #! isn't valid rust (in most scripting languages, its a comment)
- file associations on windows
Longer term, a possible benefit is editor integration for editing the cargo fragment, etc.
Now whether these are worth it is a separate conversation.
chris-morgan
As for Windows file associations, although entry points for scripting languages have often taken a different file extension, they certainly haven’t always, and it’s perfectly normal to define multiple actions on a file type, e.g. batch files have two, one to execute (the default) and one to edit. I’m fairly confident that a lot more friction is caused than saved by using a different extension.
Editor integration for the Cargo fragment: let the editor look at the shebang or find such a Cargo fragment, it’s clearly marked syntactically. (I’ve had slightly imperfect TOML syntax highlighting inside such a fragment for some time locally, though it looks like it’s one of the things I haven’t got round to pushing back to the main rust.vim repository.)
Also from reddit
I want the default action for source files to be opening them in an editor. That's what you want (spitballing) 99% of the time. .crs files were an easy way to override that on a file-by-file basis. I did briefly consider doing something similar to the py launcher on Windows that checks for the presence of a hashbang, but then I realised having some .rs files open in an editor and some compile and execute was a terrible idea.
I don't think it mattered in the end, because I've literally never seen a .crs file in the wild. It was primarily just a case of "this might be handy, might as well".
Sticking to just .rs and file association is in the RFC as an unresolved question