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

Simple code hints in edit #396

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
7 participants
@Lignum
Contributor

Lignum commented Jul 30, 2017

With this PR, edit will show syntax errors and warnings when saving.

As of now, the only warning that exists is os.loadAPI being deprecated, though more can be easily added by adding a pattern to the tWarnings table (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 about sleep(0) calls and similar.

Lignum added some commits Jul 30, 2017

Hide cursor under error messages
... and remove error messages when a line is removed
Add warnings
Including an os.loadAPI deprecation warning
@lupus590

This comment has been minimized.

Contributor

lupus590 commented Jul 30, 2017

What is this like on non-advanced grey computers?

@Lignum

This comment has been minimized.

Contributor

Lignum commented Jul 30, 2017

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?

@MaoamZedong

This comment has been minimized.

MaoamZedong commented Jul 30, 2017

Why not pop up all warnings/errors when pressing Ctrl?

@Wilma456

This comment has been minimized.

Contributor

Wilma456 commented Jul 30, 2017

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.

@Lignum

This comment has been minimized.

Contributor

Lignum commented Jul 30, 2017

@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.

@xAnavrins

This comment has been minimized.

xAnavrins commented Aug 1, 2017

@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 😛

@SquidDev

This comment has been minimized.

Contributor

SquidDev commented Aug 1, 2017

@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 :).

@viluon

This comment has been minimized.

viluon commented Aug 10, 2017

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment