-
Notifications
You must be signed in to change notification settings - Fork 193
Simple code hints in edit #396
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
base: master
Are you sure you want to change the base?
Conversation
... and remove error messages when a line is removed
Including an os.loadAPI deprecation warning
|
What is this like on non-advanced grey computers? |
|
Good question, the colours would probably work due to recent changes, but that doesn't matter since you can't click the hints... Therefore, I think it would make sense to just disable the feature entirely on normal computers. Since advanced computers generally grant you editing luxuries like syntax highlighting, that's kind of logical anyway, isn't it? |
|
Why not pop up all warnings/errors when pressing Ctrl? |
|
Edit is no IDE. I don't want warnings, when I edit a non LUA file. But a Opt-In with a setting would be OK. |
|
@Wilma456 You presumably wouldn't want syntax highlighting either. So I suppose it would make sense to disable syntax highlighting and code hints if the file that's being edited doesn't have a .lua extension. But that's for another PR. |
|
@Wilma456 Says the person who made edit save files with a .lua extension by default. This is really neat, and it may also reduce the amount of new posts in Ask a pro 😛 |
|
@xAnavrins I'm pretty sure that was Dan rather than Wilma. Wilma added a setting to turn it off. I'm not sure anything will reduce the number of Ask a Pro posts. We'd probably need to add a very advanced linter for that :). |
|
@SquidDev not to mention a large portion of CC users is stuck on older versions present in modpacks. It will take months, if not years, before such a change would show a large scale effect. Cool idea @Lignum! Although I don't really like the looks of it... Perhaps placing the warning/error below the affected line would look nicer? What I would definitely want to see is improved handling of whitespace, and perhaps even warnings on trailing whitespace, very long lines, broken indentation and the like. Making whitespace visible would help too, although that is, once again, a matter of another PR. |
With this PR, edit will show syntax errors and warnings when saving.

As of now, the only warning that exists is
os.loadAPIbeing deprecated, though more can be easily added by adding a pattern to thetWarningstable (it's a bit silly, but probably better than doing bytecode analysis in the long run).I'd imagine this would be useful for ComputerCraft's mainly beginner-level audience, who often struggle with syntax errors more than actual runtime errors. Additionally, we can use this to discourage certain coding practices, such as the use of
os.loadAPI, though I was also thinking aboutsleep(0)calls and similar.