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

Syntax error checking in Pybricks Code editor (squggles) #695

Open
dlech opened this issue Aug 1, 2022 · 1 comment
Open

Syntax error checking in Pybricks Code editor (squggles) #695

dlech opened this issue Aug 1, 2022 · 1 comment
Labels
enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application

Comments

@dlech
Copy link
Member

dlech commented Aug 1, 2022

This is one of the bullet points from #173. Currently, Pybricks code just shows a toast notification if there are syntax errors.

image

This is triggered when you download and run a program. There is also a hidden feature to do a syntax check without downloading by pressing F2. (Related discussion: #685.)

Suggested new features:

  • Most modern errors will show red squiggles under the problem in the editor and offer more info on mouse hover.
  • There should be a UI to make syntax checking discoverable or it should be automatic.

Prior art:

Mu has a Check button:
image

Thoughts:

  • In VS Code, there is the concept of a problem matcher. I'm not sure how much this is integrated into the Monaco editor that we are using but we would need something like this to parse the output of mpy-cross into a form that could be understood by Monaco editor.
  • The MicroPython compiler doesn't always give great errors (example: [Bug] Wrong line number reporting of (red) Syntax error in code editor #354), so we could do better than parsing and displaying exactly what it says.
  • We could get syntax errors and suggestions from jedi but they would be for Python rather than for MicroPython, which could be confusing.
@dlech dlech added enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application labels Aug 1, 2022
@laurensvalk
Copy link
Member

Squiggles or some other automatic indication does seem better than a button in my opinion.

A "check" button to pass code suggests that code is "good", when there could still be all sorts of things wrong with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request software: pybricks-code Issues with https://code.pybricks.com application
Projects
None yet
Development

No branches or pull requests

2 participants