Under Review
over 1 year ago

feature request: allow to spedify type checking level in the monkey.jungle file

I dislike that typechecking has to be enabled/disabled globally 

- For my existing projects I really don't want to (/I won't) go back and fix thousands of type check warnings

- If I start a new project I might use type checking

I propose to add a new keyword to the monkey.jungle file which adds a new keyword:

typechecking = [none | gradual | informative | strict]

Having this would enable you to choose on a per project basis if you want type checking on or not for that project.

  • "The VSCode plugin than needs to be made smarter. This isn't a problem of the build tool (monkeyc), but the thing calling it"

    I agree 100% but I was just stating how things are. Having said that I would love if it could change.

    "-c 3.2.6 \ this isn't needed per se"

    I agree it's not needed bc Eclipse sets it but VS Code doesn't IIRC. (Eclipse has that option in the build dialog and Vs Code doesn't.) It's basically a leftover option that does nothing afaict. (Otherwise why wouldn't it be present in the VS Code plugin.)

    " -d fenix6xpro \ # could be in monkey.jungle"

    Well the default could be in monkey.jungle, but ofc it would always need to be overridden from the command line (and the Eclipse build dialog and/or VS Code build command "quick pick list"), since you want to be able to select a device on demand. Of course when the VS Code plugin exports an IQ field it needs to build for all devices in the manifest, so it def needs to be a command line option.

    Garmin has changed things to do with the default build device (when building from the UI) a few times. It worked a certain way in Eclipse which required lots of clicks every time. IIRC, previously in the VS Code plugin, pressing F5 (Run) would only prompt you for a device if this was your first time building during the current session. Subsequent runs would use the initial device, but then if you wanted to change devices you'd have to do an explicit build, then a run. Now it seems they've changed it so you're asked every time.

    It sure would be great if you could just specify a default in monkey.jungle (or somewhere), as you pointed out.

    But then again, you can actually do this in the VS Code plugin options (at the user, workspace or folder level). Just so happens that won't help anyone who uses the command line :/. (Which sucks bc I love automating things via scripts and makefiles. But then again if you're going to automate things via scripts or makefiles, you have the latitude to set up any configuration you want. It just won't be a standard Garmin config.)

    This may also be a limitation related to Garmin wanting to put config in the standard VS Code plugin settings, as opposed to its own proprietary file, like monkey.jungle.

    "When you do this, your CLI experience becomes super shiney and your VScode plugin needs to deal with less options, only supplying them if you REALLY want to go the other way than defined in the monkey.jungle file."

    I agree.

  • The VSCode plugin than needs to be made smarter. This isn't a problem of the build tool (monkeyc), but the thing calling it. It is similar to me using a Makefile and always supplying -l 2 even if the project implements says it needs to be 3. I need to make my Makefile smarter to deal with it, so does the vscode plugin.

    CLI options which are submitted via the VScode plugin are CLI options and not configuration of the project you are working on. It might be a configuration option of your editor. But we are not talking editor here, we are talking about support in a .jungle file.

    The cool thing about the jungle file is that you can use it regardless of how someone invokes monkeyc  Makefile, vscode, etc, they all get the same type checking if they act a bit clever and not supply it as an arg.

    I mean, now we have to do this:

    monkeyc -w -l 1 \
      -o bin/fenix6xpro-xxx.debug.prg \
      -d fenix6xpro \
      -c 3.2.6 \
      -y /home/ciq/.Garmin/ConnectIQ/developer.der \
      -f /home/ciq/src/monkey.jungle


    That's a whole lot of typing for what could be this:

    monkeyc \
      -w \ # could be in monkey.jungle
      -l 1 \ # could be in monkey.jungle
      -o bin/fenix6xpro-xxx.debug.prg \
      -d fenix6xpro \ # could be in monkey.jungle
      -c 3.2.6 \ this isn't needed per se
      -y /path/to/key.der \
      -f $(pwd)/monkey.jungle # should be a default
      
    # So it becomes:
    monkeyc -o bin/fenix6xpro-xxxx.debug.prg \
            -y /path/to/key.der

    When you do this, your CLI experience becomes super shiney and your VScode plugin needs to deal with less options, only supplying them if you REALLY want to go the other way than defined in the monkey.jungle file.

  • "The CLI args SHOULD always have precedence over the configuration. 

    Order of importance should be: CLI args, ENV settings, Config files, Defaults"

    Well the problem with that -- in this case -- is the the Type Check option in the VS Code Monkey C plugin options literally adds the type check args (e.g. "-L 2") to the compiler command line invocation. And any command line args which are manually specified via Monkey C plugin options get added *after* args which are auto-added via the type check option, and they have *lower* precedence. (The compiler respects the first instance of the type check args on the command line.)

    So the existing behavior sorta contradicts that guideline, at least when you launch the compiler through the VS Code plugin. (Do command line args specified through the plugin config count as "actual command line args" or do they count as "config files"? Or both?)

    The other issue is that the existing config framework (outside of jungles) sort of assumes that you're launching the compiler through the VS Code or Eclipse plugin, and not manually from the terminal. If you just launch the compiler in the terminal "by hand", then you don't get any of the Monkey C plugin config.

  • > Obviously if you enter a specification in monkey.jungle it should take precedence over command line options. 

    That is far from obvious, eg

    $ sudo /usr/sbin/sshd -p 23 -d

    Starts sshd on port 23 in debug mode, while the configuration says port 22 not in debug mode. The CLI args SHOULD always have precedence over the configuration. 

    Order of importance should be: CLI args, ENV settings, Config files, Defaults

  • The request is for vscode.

    Obviously if you enter a specification in monkey.jungle it should take precedence over command line options. 

    I had in my mind to not specify the keyword in the jungle when it was not needed but an alternative if you always want the option specified could be to have a "default'" value so the options would become:

    typechecking = [default | none | gradual | informative | strict]