Skip to content
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

Fakeplayers incorrectly invalid with . and + #42

Open
RitikShah opened this issue Nov 10, 2020 · 2 comments · May be fixed by #54
Open

Fakeplayers incorrectly invalid with . and + #42

RitikShah opened this issue Nov 10, 2020 · 2 comments · May be fixed by #54
Assignees
Labels
bug Something isn't working

Comments

@RitikShah
Copy link

Bug report checklist:
[x] The language-mcfunction extension only provides syntax highlighting. Have you confirmed that your issue is with the syntax highlighting, and not other features such as squiggly underlines, warning indicators, and/or pop-ups?
[x] Ensure that you are able to reproduce the issue without any other datapack-related extensions enabled.
[x] Make sure you attach a screenshot to your bug report. Bug reports without a screenshot will be closed.

Describe the bug:
image
In this image, the fakeplayer, rx.EnderChest+ is marked as invalid when this is a completely valid fakeplayer name.
I've tested w/ DHP off and on, this seems like a syntax related issue

@Arcensoth Arcensoth self-assigned this Nov 11, 2020
@Arcensoth Arcensoth added the bug Something isn't working label Nov 11, 2020
@Arcensoth
Copy link
Owner

Arcensoth commented Nov 13, 2020

It looks like this token is being categorized as an NBT path. This is a recursive structure (with braces, etc) so it's not feasible to try and back-track after it see an invalid character at the very end.

The underlying issue is that fakeplayers are sometimes impossible to distinguish between other types of tokens. It's worth noting that the grammar does indeed check for a fakeplayer before an NBT path.

- include: "#command.token.fakeplayer"
- include: "#command.token.nbt_path"
- include: "#command.token.quoted_string"
- include: "#command.token.single_quoted_string"
- include: "#command.token.unquoted_string"
- include: "#command.token.unknown"

However, to avoid ambiguity, the version-agnostic grammar specifically requires one of the symbols #$% before it assumes something is a fakeplayer:

# various popular fakeplayer formats
# they'd get classified as unquoted strings anyway
fakeplayer: '([\#\$\%]{{unquoted_string_nc}})'

So you should be able to tell the highlighter directly by appending, say, $ to the front of your fakeplayers, if it suits you.

I'd say it's at least reasonable to expect an error to not be highlighted here, such as with an unquoted string. Not sure how to fix that quite yet though, since unquoted strings are a superset of NBT paths and must be processed afterwards.

@RitikShah
Copy link
Author

I think that's reasonable, a bit unfortunate ofc. I always use $'s except for load stuff so I don't mind having the blotch of red here.

@Arcensoth Arcensoth linked a pull request Sep 25, 2021 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants