Closed texastoland closed 9 months ago
Are these the only two variations? It would be good to have an example of each variation so they can be validated.
I can see that { ...$rest }
seems correct and is called variable.other.nushell
but [...$rest]
isn't recognized properly and it's either string.bare.nushell
or keyword.control.nushell
depending on where you click on the text.
@glcraft Thoughts on this?
I can see that
{ ...$rest }
seems correct
They highlight identically for me. The first ..
is highlighted like match
then the rest like a bare identifier.
Not identical for me.
Now that I look closer, neither of them are recognized correctly but one is closer than the other.
You can see this menu with ctrl+shift+p Developer: Inspect Editor Tokens and Scope
It looks like our themes target different scopes. I confirmed they both change scopes inside the spread.
@texastoland Are you on the latest version of the extension v1.8.0?
I am. You should see the same behavior if you inspect the operator. Your theme is just highlighting fewer scopes.
The right fix looks adapting (and renaming) the ranges
regex to permit a third dot:
To: "\\.\\.[<.]?"
(|:
appears to be a mistake). There are other operator groups but they're surrounded by spaces. PR?
What theme are you using? I'd like to be able to see the difference.
Oh just checked my other themes but they're like yours. Screenshot using Tinacious Design.
That range fix may be helpful but I don't think it's the entire solution. I don't think we should be getting multiple primary textmate scopes as I move my cursor from left to right. I get these primary scopes.
Yup, I see it in Tinacious. You're right, tinacious is coloring more of the scopes.
[ ...$rest ] { ...$rest }
From my minimal example here's the (unfixed) scopes I see:
[] |
{} |
|
---|---|---|
.. |
keyword.control.nushell |
keyword.control.nushell |
meta.table.nushell |
meta.expression.braced.nushell |
|
source.nushell |
source.nushell |
|
.$rest |
string.bare.nushell |
variable.other.nushell meta.command.nushell |
meta.table.nushell |
meta.expression.braced.nushell |
|
source.nushell |
source.nushell |
It looks my patch would end up interpreting ...
as an operator inside a closure instead of spreading a record. The alternative would be to include
a new spread
expression in each of the table
and braced
groups:
ya, I think we should have a new spread_expression to accomodate this new syntax.
I'll PR tomorrow then and include a table with the new scopes 👌🏼
Deleted a previous comment because I was mistaken and amended my PR 🪚
Looking at the grammar file I assume it just hasn't been added yet. Minimal repro: