vshymanskyy / ViperIDE

An innovative MicroPython IDE for Web and Mobile
https://viper-ide.org
MIT License
195 stars 8 forks source link

No micropython specific syntax highlights #4

Closed Josverl closed 1 week ago

Josverl commented 1 week ago

There is no awareness of what non standard modules exist in micropython, and it assumes the full cpython stdlib is available

vshymanskyy commented 1 week ago

How does it "assume" anything about cpython stdlib?

vshymanskyy commented 1 week ago

Also, please clarify what is wrong with MPY syntax.

Josverl commented 1 week ago

The codemirrors syntax highlighter is based on CPython, and there are quite a few subtle and more significant differences in what is / is not supported in Micropython. https://docs.micropython.org/en/latest/genrst/index.html

This is quite hard to get right even in full fledged IDEs such as VSCode, Pycharm and also in Thonny. but all have some level of support for type stubs , and that is where the micropython-stubs may be able to help. as another sample of some of the differences you could look at the validation tests for the stubs But if you want to keep things quick, clean and simple, there are no big problems waiting, perhaps just some end-user confusion.

It may be useful to add common Micropython keywords such as non standard modules and common GPIO Pin names to make life easier for your users. ref: https://codemirror.net/try/?example=Custom%20completions

So feel free to reach out if you are interested in integrating such functionality.

Lastly from the commend in the codemirror discussion - it appears that while codemirror does support custom linters, it does not do so for Python. So Custom completions is the best option available for codemirror.