AutoBuildMarlin icon indicating copy to clipboard operation
AutoBuildMarlin copied to clipboard

schema.js not passing Configuration.h

Open ellensp opened this issue 8 months ago • 0 comments

The error given is

workbench.desktop.main.js:sourcemap:1847 Activating extension 'marlinfirmware.auto-build' failed: Cannot read properties of undefined (reading 'length').

But if you enable debugging you can track it down to these lines in schema.js

          console.log("Handling else/end line", line_number);

          if (iselif || iselse || drctv == '#endif') {
          if (conditions.length == 0) {
            //raise Exception(f'no #if block at line {line_number}')
            // TODO: Revert the view back to plain text editing
          }

conditions.length is the length that is not set

How to reproduce:

Add this eg to Configuration.h

#if(MOTHERBOARD == BOARD_FYSETC_CHEETAH_V20)
  #define CUSTOM_MACHINE_NAME "Fysetc Cheetah V2.0"
#else
  #define CUSTOM_MACHINE_NAME "3D Printer"
#endif

Restart vscode and attempt to start ABM, it will not start as it fails to pass the Configuration.h

simply adding a space after the #if eg

#if (MOTHERBOARD == BOARD_FYSETC_CHEETAH_V20)
  #define CUSTOM_MACHINE_NAME "Fysetc Cheetah V2.0"
#else
  #define CUSTOM_MACHINE_NAME "3D Printer"
#endif

And restarting vscode and ABM starts as expected. But the user shouldn't have to do this....

ellensp avatar Jun 23 '24 19:06 ellensp