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

Open
yiruzu opened this issue Dec 16, 2024 · 3 comments
Open

Is it possible to ignore specific syntax errors? #939

yiruzu opened this issue Dec 16, 2024 · 3 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

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