-
Notifications
You must be signed in to change notification settings - Fork 34
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 parser support for backslash continuation #1180
✨ Add parser support for backslash continuation #1180
Conversation
amazing work! i'll look over this when i get more time.
i believe that is not an us issue. we don't colorize brackets. do you have some other extensions? |
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.
the completion is computed correctly but VS Code doesn't display them.
Old information from when I was trouble shooting
i think this happens because VS Code uses text in the `replace` range to filter through the options, which does not match any of the `label` of the completion items. e.g., the `replace` range is `[(8, 0); (9, 3))`, so the source text VS Code uses to filter options is `ad\huh`. the `label` of the completion item is `advancement`, which does not match the source text, so no completion item is shown. one way i can think of to fix this is to add `filterText` like `ad\vancement` to the completion items so VS Code can filter the options properly (and if we can construct those `filterText` might as well set the `newText` to them so the user gets to keep their insane word-breaking line continuity). another way i can think of to fix it is to just set the `filterText` to an empty string so no filtering is done by the client, and we could do filtering on server side given that we have more information.
nvm, tried to hard code some filterText
values and none of these work. i even tried to make filterText
exactly the text in the replace
range and it still doesn't work
in microsoft/vscode there's this comment explaining how filtering works. my understanding was mostly correct, except that VS Code does not support ranges that span multiple lines as the "prefix". a hacky workaround i can think of would be to make the replace
range in textEdit
stop at the end of the first line, then use additionalTextEdits
to delete the following lines.
- also add unit tests for method
- concatenates lines together when we hit a trailing backslash - `terminators` param is used differently for `argument`/`command` parser - difference is `command` parser adds in a space terminator ` ` in addition to newline terminators `\n` and `\r` - also add unit tests :]
- add space char ` ` as a terminator to improve performance (needed to pass test)
- we want these to result in errors, but they pass right now
5b41b76
to
059a825
Compare
Would it make sense to wrap For something like this, advancement ! \
aartsarst The |
i believe it already was wrapped around the however...
good catch. when looking into where exactly we should place the this made me wonder how Minecraft would parse something like this: # a comment \
say i will not say turns out it prints nothing, meaning the backslash continuation is the first thing that happens when Minecraft parses a the fix for this is fairly simple and actually lets me simplify some code/remove unnecessary test code. commits soonTM preview |
- will be used in next commit for new tests
- the main behaviors we want to test are: - comment detection - macro detection - splitting multiple lines into multiple commands/comments/macros accordingly
- output wrong thing right now, fixed next commit
- no terminators specified since this wrapper parser runs once at the start of mcfunction file parsing - need to remove backslash cont. parser from internal `command` parser for these tests to pass, so that's in this commit too - remove command parser specific tests around backslash continuation since its handled by mcfunction entry parser earlier anyway
- when you're debugging these, it's not unlikely you'd be in a test longer than 30s (the default timeout) - new default is 999999s (11.5 days)
- no child parsers should really directly use the new `concat` parser - remove tests specific to backslash continuation
- it never stops at specific terminators other than end of string since its called on entry now
1f0c88b
to
7f63ab2
Compare
fixed in |
- no more java-edition dependency - it was pretty easy idk why i didn't think of this before
- split to SpyglassMC#1189
apparently i have no idea how to cleanly do a merge commit RIP |
ed91f57
to
c16a08a
Compare
- it doesn't count as end of file iff there is any content after the newline after the backslash (including spaces), so catch that in an explicit case
f6c0638
to
0548d94
Compare
fe4db37
to
0548d94
Compare
- they have errors now, so we're gonna remove those in next commit
Summary
closes #1069
this PR adds backslash continuation for
command
andargument
parsers in mcfunctions.Preview
command
parserargument
parser (+ node range highlighting correctly)command
andargument
parser togethercommand
andargument
completers not working yetNext steps
(these should be ticketized)
[
/]
across lines)