Shop Learn
Visual Studio Code editor for P1 & P2 (spin & pasm) - Page 4 — Parallax Forums

Visual Studio Code editor for P1 & P2 (spin & pasm)

124»

Comments

  • Nice! Opened up VSC and it prompted me to retrieve the new extension.

  • Cluso99Cluso99 Posts: 17,711

    Stephen,
    Looking forward to trying it out :)

  • Stephen MoracoStephen Moraco Posts: 142
    edited 2021-03-13 23:08

    Wondering what I've been doing as I'm releasing these versions of the extension? Well, it's a bunch of work... so we can have a really great highlighter!

    • Pulled all code examples from the SPIN2 Document and am making sure they all parse and highlight correctly.
    • Pull all .spin2 files from the P2 obex and make sure they all parse and highlight correctly.
    • Pull the .spin2 files distributed with PNut and make sure they all parse and highlight correctly.
    • and... of course, I run against all of my .spin2 code as well.

    As I accumulate a large enough batch of changes I push a new release. Pretty simple.

    So, each time you update to the next version, please take a moment to revel in the improvements.

    (Yep, I'm staying busy ;-)

  • NEWS

    Published new version today that now avoids hunting for symbols within strings.
    This should also fix the debug() statements in spin2. I haven't yet checked-out debug() statement correctness in pasm, "it might work?!" ;-)

    As always review the changelog when you update to the new extension.

    Enjoy! (getting ever closer to first official release)

  • I'm still not entirely clear on how we're going to get the debug tools into VSC. I understand that Roy is translating them to a portable code base. But, we'll still be compiling code with FlexSpin. Would FlexSpin add in the debug tools, or are you counting on running PNut command-line from VSC, and getting the debug tools to run independently of Prop Tool?

    Ken Gracey

  • @"Ken Gracey" said:
    I'm still not entirely clear on how we're going to get the debug tools into VSC. I understand that Roy is translating them to a portable code base. But, we'll still be compiling code with FlexSpin. Would FlexSpin add in the debug tools, or are you counting on running PNut command-line from VSC, and getting the debug tools to run independently of Prop Tool?

    Ken Gracey

    I'm not sure either, but an intrepid worker managed to build an entire assembler tool that runs under VSC and according to instructions in the source code would be able to assemble all of the favorite older ones. My big sticking point with that one is actually installing it and making it work. But before our friend started building these capable extensions, and perhaps about the time we got started with VSC, instructions were floating around how to make FlexSpin or its relatives work that way.

    Even though we are discussing the P2 design, the ideas also surfaced for the P1, and I'm wondering still if command line tools exist for the P1.

    Mascot away.

    Oh wow, there is a parade of angry koalas marching on an airport.

  • Cluso99Cluso99 Posts: 17,711

    @"Buck Rogers" said:

    @"Ken Gracey" said:
    I'm still not entirely clear on how we're going to get the debug tools into VSC. I understand that Roy is translating them to a portable code base. But, we'll still be compiling code with FlexSpin. Would FlexSpin add in the debug tools, or are you counting on running PNut command-line from VSC, and getting the debug tools to run independently of Prop Tool?

    Ken Gracey

    I'm not sure either, but an intrepid worker managed to build an entire assembler tool that runs under VSC and according to instructions in the source code would be able to assemble all of the favorite older ones. My big sticking point with that one is actually installing it and making it work. But before our friend started building these capable extensions, and perhaps about the time we got started with VSC, instructions were floating around how to make FlexSpin or its relatives work that way.

    Even though we are discussing the P2 design, the ideas also surfaced for the P1, and I'm wondering still if command line tools exist for the P1.

    Mascot away.

    Oh wow, there is a parade of angry koalas marching on an airport.

    For P1 these are the command line compilers that I know of

    • FlexSpin
    • OpenSpin
    • Propellant
    • bst
    • homespun
  • AJLAJL Posts: 377

    @"Buck Rogers" said:

    Oh wow, there is a parade of angry koalas marching on an airport.

    Angry koalas don't march

    This

  • @AJL said:

    @"Buck Rogers" said:

    Oh wow, there is a parade of angry koalas marching on an airport.

    Angry koalas don't march

    This

    Ever see an early QUANTAS add? It featured a koala annoyed at the impending arrival of a tourist or two.

  • Stephen MoracoStephen Moraco Posts: 142
    edited 2021-03-19 01:03

    NEWS

    I've just released v1.0.0 of our spin2 extension. This marks my having proven the mechanism against all library files in the P2 Obex and against the .spin2 files shipped with PNut v35i. There are only a couple of exceptions that are noted in the ChangeLog.

    Please review the Spin2 Extension ChangeLog from within VSCode or at github.

    In this release offers a powerful new feature that shows variables not defined in the current file.

    NOTE You may want to double-check the all older versions are removed from your .vscode/extensions folder after installing this new version.

    If you find code that you believe is not highlighting correctly (yes, we will likely find some for a while yet...) then please file an issue at my github repository

    Regards,
    Stephen

  • VSCode Build/download UPDATEs

    I've posted an update describing how to build/download from Raspberry Pi's. See: Tasks.md - Raspberry Pi

    ( @ersmith thank you! Your build instructions for building on Linux worked flawlessly on the Raspberry Pi. )

    Regards,
    Stephen

  • NEWS:

    As heard in the Zoom live session yesterday, I released v1.0.1 which is a minor update adding recognition and coloring for the built-in RECV method pointer.

    VSCode Build/download UPDATEs:

    I've updated the Spin2 VSCode Extension Tasks.md page to reflect our changeover from using paths to tools - to now setting the environment of each machine so paths in the tools.json files are no longer needed. There's a new section in the doc informing how to make the PATH changes needed for each of our OSes.

    I'll be pushing one more update later today add the building with PNut section to the document.

    We'll shortly be making similar updates to the quickbytes page as well.

    Regards,
    Stephen

  • ... and PNut tasks example is now up as promised!

    Regards,
    Stephen

  • cgraceycgracey Posts: 13,587

    @"Stephen Moraco" said:
    ... and PNut tasks example is now up as promised!

    Regards,
    Stephen

    Thanks, Stephen.

  • dgatelydgately Posts: 1,449
    edited 2021-04-01 19:32

    Stephen,

    I probably missed an explanation, but I'm not understanding why the setup of the tasks.json file contains hard-coded source file names and the need to create a new tasks.json for every project.

    In my tasks.json (which I've set up as a user task, rather than within a specific workspace), I refer to the source and binary files with this:

    "${fileBasename}"                          <== source file .spin2, etc...
    "'${fileBasenameNoExtension}.binary'"      <== file to load to the P2
    

    I assumed this would work, and have had success. Will I eventually find a failure with this setup?

    BTW: I'm using the instructions at: https://github.com/ironsheep/P2-vscode-extensions/blob/main/TASKS.md

    dgately

  • @dgately said:
    I probably missed an explanation, but I'm not understanding why the setup of the tasks.json file contains hard-coded source file names and the need to create a new tasks.json for every project.

    In my tasks.json (which I've set up as a user task, rather than within a specific workspace), I refer to the source and binary files with this:

    "${fileBasename}"                          <== source file .spin2, etc...
    "'${fileBasenameNoExtension}.binary'"      <== file to load to the P2
    

    I assumed this would work, and have had success. Will I eventually find a failure with this setup?

    Ok, I'll need to update the explanations then. Here's what's happening.

    The ${fileBasename} and ${fileBasenameNoExtension} are values that describe the currently showing tab. If you have multiple editor windows open and then press cmd/ctrl-shift-B to compile a file, when you use these symbols, the file that is compiled is the one in the tab you are currently viewing.

    Hmmm... not easy to describe, let me try an example. Let's say I have test1.spin2 and test.sh open in two tabs. I happen to be editing test.sh and I press cmd/ctrl-shift-B then our compiler will be told to compile the test.sh file, which is likely not what we want. So we have to be careful when we ask for a build.

    This becomes more problematic when we want to compile and download to the P2. How many of us have accidentally compiled and tried to download a file that is not our top-level file. So we have a new need. We want to reduce this failure opportunity so we hard code the name of the top-level file. In my Tasks.md file I currently have this hardcoded in the file. The point of this hardcode is to remove the requirement to have the top-level file open in an editor and top-most when I press cmd/ctrl-shift-D or cmd/ctrl-shift-F (which is what I have associated with program flash.)

    In my latest experiments, my name of the top-level file is moved out of the tasks.json to the settings.json file (which sits alongside the tasks.json file.) This means we no longer have to modify our tasks.json file per project. A similar issue is enabling the debug or no debug compilation mode of the PNut compiler. We need a means to specify this outside of our tasks.json file as well. This is what I'm currently trying to solve.

    Does this help?

    Regards,
    Stephen

  • Stephen MoracoStephen Moraco Posts: 142
    edited 2021-04-06 20:51

    VSCode Build/download UPDATEs:

    I've updated the Spin2 VSCode Extension Tasks.md page. More specifically the section on building and downloading from the Raspberry Pi.

    The new content shows us how to make a one-time modification to the configuration of the RPi so the RPi can recognize our Parallax PropPlug when it is plugged in. This has to be done as the Parallax FTDI chips used have a custom VID:PID pair so our configuration update enables the FTDI driver to see the PropPlug and expose it as /dev/ttyUSB{n} - where first one is /dev/ttyUSB0.

    Next updates
    I'm currently working on two sets of changes to our tasks.json file.

    • Move the top-level filename to settings.json and refer to it using a variable name expression in the tasks.json file
    • Figure out how to specify build with/without debug (maybe also in settings) and use this in the tasks.json file when our compiler is PNut.

    Regards,
    Stephen

  • dgatelydgately Posts: 1,449

    @"Stephen Moraco" said:

    @dgately said:
    I probably missed an explanation, but I'm not understanding why the setup of the tasks.json file contains hard-coded source file names and the need to create a new tasks.json for every project.

    In my tasks.json (which I've set up as a user task, rather than within a specific workspace), I refer to the source and binary files with this:

    "${fileBasename}"                          <== source file .spin2, etc...
    "'${fileBasenameNoExtension}.binary'"      <== file to load to the P2
    

    I assumed this would work, and have had success. Will I eventually find a failure with this setup?

    Ok, I'll need to update the explanations then. Here's what's happening.

    The ${fileBasename} and ${fileBasenameNoExtension} are values that describe the currently showing tab. If you have multiple editor windows open and then press cmd/ctrl-shift-B to compile a file, when you use these symbols, the file that is compiled is the one in the tab you are currently viewing.
    In my latest experiments, my name of the top-level file is moved out of the tasks.json to the settings.json file (which sits alongside the tasks.json file.) This means we no longer have to modify our tasks.json file per project. A similar issue is enabling the debug or no debug compilation mode of the PNut compiler. We need a means to specify this outside of our tasks.json file as well. This is what I'm currently trying to solve.

    Does this help?

    Using flexprop, the same issue is at hand (it compiles & tries to download the currently open tab's file), so I'm used to that scenario. I've trained myself to open the correct tab before compile/load :smiley: One way to ensure that it compiles the top-most file of your project is to name the top file with the same name as the enclosing directory (with ".spin2", of course) and have the tasks.json file use ${workspaceFolderBasename}.spin2... Or something similar. I guess I just didn't like having to re-create a new tasks.json file for every project (I'm lazy & forgetful).

    Thanks,
    dgately

  • Stephen MoracoStephen Moraco Posts: 142
    edited 2021-04-28 21:53

    VSCode BUild/Download/Flash Updates:

    I've updated the Spin2 VSCode Extension Tasks.md page.

    The new content addresses:

    • Identifies how to configure paths to your tools so that we no longer use explicit paths to our tools referenced within our tasks.json file.
    • Using a settings.json file within each P2 Project folder which sits alongside the tasks.json file that allows us to specify the name of our top-level file in one place but use that name in each of our CompileTopP2, DownloadP2, and FlashP2 tasks.

    Ken will be updating our QuickBytes soon so these new techniques will from here on out be our standard way of doing things.

    Next Updates:
    Next up I'm working to identify a convenient means to specify compile with/without Debug to PNut in our tasks.

    Please let me know if you've identified something useful you'd like us to add or change in our tasks.json file.

    Regards,
    Stephen

  • @"Stephen Moraco" said:
    VSCode BUild/Download/Flash Updates:
    Please let me know if you've identified something useful you'd like us to add or change in our tasks.json file.

    Regards,
    Stephen

    Thank you for this important contribution, Stephen.

    Ken Gracey

Sign In or Register to comment.