-
Notifications
You must be signed in to change notification settings - Fork 33
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
Highlight (import, export module references) #1580
base: main
Are you sure you want to change the base?
Conversation
Could you rebase against our main branch? There seems to be a lot of other commits here. |
Oops. I'm redoing the pull request now. Or does it merge into pure history? |
Yeah, I noticed that, too. It's gonna take me a little while |
If you setup a remote of |
8c91794
to
ebac664
Compare
Thank you, that helped. |
lsp/syntaxes/civet.json
Outdated
} | ||
}, | ||
{ | ||
"match": "\\b(?<![\\.\\$])(break|by|case|catch|continue|else|finally|for|in|of|if|return|switch|then|throw|try|unless|when|while|until|loop|do|export|import|default|from|as|yield|async|await|with|(?<=for)\\s+own)(?!\\s*:)\\b", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but while I look at this, we have a bunch more for
keywords, such as each
and the reducers sum
etc.
ebac664
to
b1a4a4e
Compare
af413d6
to
29fd02c
Compare
29fd02c
to
78bd2f7
Compare
@edemaine I think it's ready. Can you check? Thank you for taking the time to check the code and suggesting ways to improve it |
|
||
{ | ||
"name": "string.unquoted.module-reference.civet", | ||
"match": "(?<=(^\\s*(import|export)|^)\\s*(type\\s+)?((\\w+\\s*,\\s*)?\\{(.|\\n)*\\}|\\w+|(\\*\\s+as\\s+\\w+))\\s+(from)\\s+)([^\\(\\{\\[\"';\\s=>][^\"';\\s=>]+|\".+?\"|'.+?')(?=[^()]|$)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\\{(.|\\n)*\\}
seems rather inclusive. Perhaps (.|\\n)
should be replaced by [^{}]
? Or at least *
should be *?
, like the quoted string regexes.
I also realize that, if you're just trying to match unquoted module references here, you don't actually need |\".+?\"|'.+?'
. (If you keep them, shouldn't +
be *
?)
The import path now has the same highlighting as the string literal (string.unquoted.module-reference.civet). Previously it could be colored with anything
Before pull
export a, b from x
toofrom x import {a, b}
I have been unable to determine the correct method for intercepting the block completion
so this part is not part of the import expression, which is semantically wrong. Any criticism is welcome, I'm inexperienced