joedevivo / vscode-circuitpython

VSCode extension for Adafruit's CircuitPython
MIT License
119 stars 34 forks source link

[BUG] Some boards do not parse correctly #99

Open DeadSix27 opened 2 years ago

DeadSix27 commented 2 years ago

Took me a while to get into it but I figured out your RegEx is missing some different type of pin definitions..

For example my Metro ESP32 uses this format:

    { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) },
    { MP_OBJ_NEW_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },

Which your regex:

\s*{\s*MP_ROM_QSTR\(MP_QSTR_(?P<name>[^\)]*)\)\s*,\s*MP_ROM_PTR\((?P<value>[^\)]*)\).*

.. is not capturing..

thus an edit like this

\s*{\s*MP_(?:OBJ_NEW|ROM)_QSTR\(MP_QSTR_(?P<name>[^\)]*)\)\s*,\s*MP_ROM_PTR\((?P<value>[^\)]*)\).*

should do the trick, I use that on my local fork at least.