Shop Learn
Visual Studio Code supports P2 development on Windows, Mac, Linux (yes, RPi) - Page 3 — Parallax Forums

Visual Studio Code supports P2 development on Windows, Mac, Linux (yes, RPi)

13

Comments

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

  • Cluso99Cluso99 Posts: 17,780

    Stephen,
    Looking forward to trying it out :)

  • Stephen MoracoStephen Moraco Posts: 150
    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,780

    @"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: 385

    @"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: 150
    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,610

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

    Regards,
    Stephen

    Thanks, Stephen.

  • dgatelydgately Posts: 1,452
    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: 150
    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,452

    @"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: 150
    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

  • Spin2 VSCode extension Updated

    The new version v1.1.0 is a minor update to fix incorrect highlighting

    BUGFIX: correct highlighting of debug() functions in DAT section pasm code
    

    Enjoy!

  • Cluso99Cluso99 Posts: 17,780

    Stephen,
    Would you like to post a quick summary of the links of where to get everything to install the VSC spin extension and I will copy it to the first post of this thread?
    Or, would you like to split this off into a new thread (same name and change this thread to append (obsolete) and the first post can contain links back and forth?

  • @Cluso99 said:
    Stephen,
    Would you like to post a quick summary of the links of where to get everything to install the VSC spin extension and I will copy it to the first post of this thread?
    Or, would you like to split this off into a new thread (same name and change this thread to append (obsolete) and the first post can contain links back and forth?

    Partner,
    I'll support whatever our friend back there does do, (or yourself) but shouldn't a properly written Visual Studio Code extension update itself when needed?

    Mascot away.

    But what's with the crowd of bots searching the Mojave Desert? They are all looking for something dropped by a different bot.

  • Cluso99Cluso99 Posts: 17,780

    @"Buck Rogers" said:

    @Cluso99 said:
    Stephen,
    Would you like to post a quick summary of the links of where to get everything to install the VSC spin extension and I will copy it to the first post of this thread?
    Or, would you like to split this off into a new thread (same name and change this thread to append (obsolete) and the first post can contain links back and forth?

    Partner,
    I'll support whatever our friend back there does do, (or yourself) but shouldn't a properly written Visual Studio Code extension update itself when needed?

    That's what I had hoped too. Stephen did get this running.

    I hope it's not because of the compilation of the top level object because I would prefer to just make sure that the window/tab that I wanted to compile/download was the correct one. To help with this, in my batch file that I use at present, I delete the binary before I compile so that if the compilation fails there is no binary to download.

  • Stephen MoracoStephen Moraco Posts: 150
    edited 2021-05-26 02:01

    @Cluso99 said:
    Would you like to post a quick summary of the links of where to get everything to install the VSC spin extension and I will copy it to the first post of this thread?
    Or, would you like to split this off into a new thread (same name and change this thread to append (obsolete) and the first post can contain links back and forth?

    The Spin2 extension is currently in the VSCode marketplace. After one has a working install of VSCode then from within the VSCode Extensions panel search for Spin2. Install it and you are good to go. Additionally, as suggested, it will automatically notify you of new update availability whenever I publish new updates.

    I also point out 6 extensions that make this an even better Spin2/Pasm2 development environment. See: my VSCode repo extensions page

    There is more than just installing the extension as one needs to set up build and run facilities based on the compiler tools one is using and also based on the platform (Windows, Mac, RPi, Linux, etc.) To help us learn how to do this Ken posted a very useful VSCode P2 QuickByte. This is probably what we should link to.

    Also, I applaud your suggestion for the old/new thread idea!

    NOTE: this is a new extension since the Spin (for P1) extension was released. So if you want P1 and P2 support install them both. Eventually, as I wrap up current projects I'll backport this latest extension to the P1 but this is likely months away...

  • Cluso99Cluso99 Posts: 17,780

    @"Stephen Moraco"
    Just checked and VSC has been updating the spin2 via the marketplace. I'm on v1.1.0 2021-05-19 so that part is working just fine thankyou :smiley:

    I'll look into adding the compiler as per the quickbyte instructions.

    And I will pm @VonSzarvas to ask him to split the threads and rename.

  • Hello all,

    I've updated the Quick Byte on Parallax https://www.parallax.com/visual-studio/ to include some additional videos and explanations for the following improvements:

    • added the settings.json file setup to identify the top file (convenient)
    • updated the tasks.json file template to use relative paths (yay!)
    • added explanation of configuring Paths in Windows Environment
    • new videos to accompany this process

    I've also pointed people to @"Stephen Moraco" 's GitHub for RasPi, Mac and Linux (and appropriately thanked him for the progress we're making here!).

    Ken Gracey

  • Tried to get the "Align mode" from Propeller Tool into VSC. I started with an extension that implemented an insert/overtype toggle (since VSC itself only does insert, oddly enough), but ended up rewriting a good chunk of it, haha.

    It kindof works, even.

  • @Wuerfel_21 great work! Is this something you want to distribute or would you like me to see if it can be included in the spin2 support I already distribute? (With full credit given to you for your work of course!) PM me here or email me at stephen@ironsheep.biz to discuss details.

    I'm really liking what you've done. Thank you!

  • It should probably be a separate extension, since there's a stupi API limitation that allows only one extension to hook the type command at a time. However, context sensitive tabbing would probably go into the same extension, because otherwise it won't work.

    The current code is just here. As said, it's just a quick hack on top of an existing extension. https://github.com/Wuerfel21/vscode-overtype

Sign In or Register to comment.