-
-
Notifications
You must be signed in to change notification settings - Fork 84
Add language overrides for delimiter maps #2012
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
Add language overrides for delimiter maps #2012
Conversation
I would be tempted to introduce a new delimiter type for WDYT @AndreasArvidsson |
See #1911 (comment) for a comment about some code from this PR. |
I think I need a bit more info on your suggestion |
the problem is that in lua, One thing we'd need to think about is that that would cause |
I agree, but we still need to make square actually work of course. |
Ok @fidgetingbits I think we're in agreement. Lmk if you need help figuring out how to put the above to practice |
Ya some guidance would be good, as much as I'd love to try to figure it out on my own. My typescript experience consists of what's in this PR. I suspect it would take me quite a long time to work out what to do. |
Ok I'll take this over when I get a minute |
af665ed
to
0c4dd37
Compare
0c4dd37
to
e82832f
Compare
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.
Ok @fidgetingbits I made some tweaks. Given some more recent discussions (#1812 (comment)), I don't think this is the long-term solution, but:
- It's not too much code,
- It's not too bad an abstraction, and
- I need it for a tree-sitter upgrade I'm doing to handle strings in Python
Let me know if you're happy with my changes (see e82832f)
Also, @AndreasArvidsson would be good to get a second 👀 as I've made some changes here and we've discussed syntactic vs text pairs a lot
Looks reasonable to me |
Added lua test looks good to me. Your changes look good too, reads cleaner. |
This is me breaking out some functionality that was part of PR #1911 since that PR has lots of work to be done and it may still benefit other languages that get in sooner. I've applied the suggested changes from pokey in that PR's code review.
I've also added a placeholder map for lua which uses
[[ ]]
for multiline support as noted in PR #1962, however I realized as I went to add it that it's not as simple as the way I did it for nix because I can't just reuse the existingsingleQuote
entry since lua actually uses single quotes. So this may actually be a bit harder, and reminds me of this discussion. So before I go randomly hacking stuff I'm curious what you think the best approach here is.These are the comments I had left in the Nix PR about these changes:
I called returning delimiterToText as getSimpleDelimiterMap to kind of mirror complexDelimiterMap.
I'm not sure is if you still want a delimiterMap.ts standalone file, and then a getSimpleDelimiterMap.ts only for that function. Now delimiterToText isn't referenced anywhere else, so seemed maybe okay to keep them together.
I also thought about adding getComplexDelimiterMap(), but atm because complexDelimiterMap only ever uses the keys from the delimiterToText it won't change even if the language has different values, so seemed unnecessary. These are all things I could guess at your preferences, but may as well ask instead.
I also noticed leftToRightMap in that file isn't actually used anywhere so can be deleted I think, but also not sure about doing that as part of a totally unrelated code change, to keep commits clean.
Checklist