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

Macro syntax highlighting #1122

Closed
Calverin opened this issue May 6, 2024 · 3 comments · Fixed by #1196
Closed

Macro syntax highlighting #1122

Calverin opened this issue May 6, 2024 · 3 comments · Fixed by #1196
Assignees
Labels
✨ feature New feature or request
Milestone

Comments

@Calverin
Copy link
Contributor

Calverin commented May 6, 2024

Support basic highlighting and error checking

@Calverin Calverin added the ✨ feature New feature or request label May 6, 2024
@Calverin Calverin self-assigned this May 6, 2024
@MulverineX MulverineX added this to the Release 4.0.0 milestone May 6, 2024
@Kesuaheli
Copy link

How would that be realisticly possible? Because a macro can contain spaces, you can not know how many arguments will be added at runtime.
One option would be to assume every macro adds one argument without spaces. But if someone than wants to add a multi-argument macro, they would most likely get errors.
Even then, there're weird cases where nobody knows what the command looks like at runtime.

$execute as @e[nbt!=$(foo)] lol I am an error $(bar) run say Hello World!

I don't know why someone would ever do this. (One can argue that it's probably right to mark this as wrong, lol)
But it will run fine if you pass in {"foo": "{CustomName:\"", "bar": "\"}]"}

The only way that I can think of which will work is to use some mcdoc syntax to specify which type/s this macro can have. (Whould be soo cool!)
But I think that's not what you had in mind.

@Calverin
Copy link
Contributor Author

Calverin commented May 6, 2024

The current plan is to keep things very simple, by highlighting macro lines a different color (already done), but keeping macro entries, e.g. "$(foo)" highlighted differently, and marking the command as an error if it's a macro command with none of those entries. If it's a $$ command it'll probably just be highlighted differently and ignore all error checking because there's not much you can do there

@Kesuaheli
Copy link

Ah I see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants