Change $layout.svelte to @layout.svelte and [param].svelte to {param}.svelte?
See original GitHub issueOk hear me out.
I think we closed https://github.com/sveltejs/kit/issues/894 prematurely; it does make sense to use a character that doesn’t require special handling, if possible. It’s awkward to type src/routes/$layout.svelte
on the command line — you get to the $
and either have to reach for the backslash, or curse your lack of forethought in not typing 'src
(single quote only, no doubles!) instead of src
.
Even if you don’t find yourself typing/tab-completing route filenames on the command line frequently, you might find yourself attempting to cmd-click on the filename in your editor’s integrated terminal (e.g. in the output from git diff
or tsc
or whatever) in order to edit the file. At least in VSCode, that doesn’t work for filenames containing $layout
, probably because something somewhere is replacing it with the layout
environment variable.
These problems go away with @
.
Related to the cmd-click problem: VSCode doesn’t recognise this as a file — if you hover it, it will only highlight the file up to the [
character:
This, on the other hand…
…works perfectly:
I should note that this behaviour appears to be specific to VSCode; iTerm reverses the treatment of [bar]
and {bar}
. But I think it’s probably more important that cmd-click works in integrated editor terminals, and VSCode is the most popular one of the bunch.
Aesthetically, @layout.svelte
and @error.svelte
seem fine, and I actually prefer {param}
to [param]
, not least because it’s more aligned with the syntax of Svelte itself.
Issue Analytics
- State:
- Created 2 years ago
- Comments:45 (40 by maintainers)
Top GitHub Comments
windows: pissing in the punchbowl since 1985
Honestly, I’m leaning more toward this being a “bug” with IDEs / terminals that provide clickable links. I no longer favor
~
tilde, happy little wave that it is.