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

Is it possible to ignore specific syntax errors? #939

Closed
yiruzu opened this issue Dec 16, 2024 · 4 comments
Closed

Is it possible to ignore specific syntax errors? #939

yiruzu opened this issue Dec 16, 2024 · 4 comments

Comments

@yiruzu
Copy link

yiruzu commented Dec 16, 2024

I’m trying to use the ? optional chaining operator, but since it’s not supported by default, StyLua treats it as a syntax error: unexpected token ?``

I’ve tried using -- stylua: ignore, but it seems this only bypasses formatting and not syntax validation.
Is there a way to make StyLua ignore specific syntax errors like this?

@JohnnyMorganz
Copy link
Owner

Unfortunately this is not possible right now. We need to have a successfully parsing syntax tree to perform formatting. Right now this is mainly for safety to verify we don't mess anything up. The --stylua: ignore comment is found based off the syntax tree.

Is this syntax from a particular project? e.g., I have in my backlog to see what it takes to support GMod Lua (#930) and FiveM Lua (#855)

@yiruzu
Copy link
Author

yiruzu commented Dec 20, 2024

Yes, this is for FiveM Lua. Just to make sure I understood correctly, supporting it is already on your to-do list, right?

@JohnnyMorganz
Copy link
Owner

Correct, can't promise when, but i do want to try it out sometime

@JohnnyMorganz
Copy link
Owner

Will close this issue, #855 tracks FiveM syntax support

@JohnnyMorganz JohnnyMorganz closed this as not planned Won't fix, can't repro, duplicate, stale Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants