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

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

1235

Comments

  • NEWS

    I've just released v1.6.1 of our spin2 extension. The changes are:

    Tab / Shift+Tab Feature Update

    Latest Update:

    • NEW: Fixes detection of in-line pasm by now treating end correctly and reverting to PUB/PRI tab use after the end statement
    • NEW: Adds support for asm and endasm FlexSpin in-line pasm keywords
    • NEW: adds 3 more tab stops for spin2 code in PUB and PRI (at 12, 14, at 16)
    • Adjusts the multiline selection behavior for TAB and Shift+TAB which is now treating each line individually.

    Thank you, Jay, your work is much appreciated! (Jay B. Harlow contributed the initial code for this tabbing feature)

    Known Issues:
    We haven't yet learned how to control the ending position of the edit cursor. So in many cases when using selection not an insert point the cursor may end up not being where you might expect it to be after pressing TAB or Shift+TAB. We are looking into how to solve this. Even tho' this problem exists the formatting ability this new service provides is well worth this minor headache. We will keep looking for a means to get this under control.

    What are we doing?

    This release updates the tabbing support. It is still disabled at first installation.
    In order to test it you must enable it, and restart VSCode. Then it will be present when editing any .spin2, or .pasm2 files.

    This feature is pretty much ready for use. Please let us know of any behavior you are not sure is correct or behavior that just doesn't feel right. Your feedback based on what you are experiencing will help us ensure this is working the way we all would like it to.

    Tab Implementation intent: Implementation Tabbing Notes

    When you find things (or wish for new behaviors) let me know here: Repo Issues Page

    About this extension

    You can always review the Spin2 Extension ChangeLog from within VSCode or at github for more details.

    Reminder: The Spin2 extension is 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. Once installed it will automatically notify you of new update availability whenever I publish new updates.

    If you are already using this extension and for some reason, it did not update for you automatically, in VSCode go to your extensions view (SHIFT+CMD+X), and type in spin2. On the left, the info panel for the extension should appear and will indicate that an update has happened or needs to happen. Update it if needed.

    NOTE You may want to double-check that all older versions are removed from your .vscode/extensions folder after installing any 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 issues page

    I also point out a number of 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.

    What's next? on the horizon: (1) Implementation of Insert, Overtype and Align modes, (2) A backport of this Syntax/Semantic highlighting along with this new tabbing support to a new Spin VSCode extension for our P1

    Enjoy!

    Stephen

  • I've just noticed that the terminal window of VSC has problems when there is too much output from the Propeller. The output just stops and I think there is a buffer overflow.

    At first I thought "oh no, my program crashes" but actually it doesn't. I added lighting up an LED at the end of the program so I can see it runs until the very end although the output stops.

    Is there a way to increase the buffer size? I had to switch from Powershell to GIT bash because of the problems with loadp2.exe arguments. I think I have to convince Chip to add some options to PNut so that it can be used to download the program and display the debug output. It's fast and it would be very cool being able to use the graphical debug features together with VSC and FlexC.

  • Stephen MoracoStephen Moraco Posts: 248
    edited 2022-11-30 10:37

    @ManAtWork Hmmm, interesting, and at the same time, I'm sorry to hear. I have never (1) looked to see if the buffer size can be expanded and (2) used the terminal in this way (for showing debug output). It's fun to know that you can. You might guess (by observing things that I work on) that I frequently have a need to log debug output from very long P2 code runs and then review the logs later for errant behaviors. I do this by connecting one of my Raspberry Pi's to the P2 serial port and running a python script that can show debug terminal windows and write all output to a log file.

    If you have an RPi then the Debug script can be found in RPi P2D2 Support project repo. Look in the DebugView folder. Run the script with the --help option to get a list of command line options. I'll try to get some good how-to-use information put in the README in that folder over the next couple of days.

    There is also a lot of RPi setup information at my P2 RPi IoT gateway project repository. More specifically, the RPi Setup page.

    I know you weren't looking for an RPi solution I just mention it because it's my go-to means of capturing logs at full speed for hours upon hours from the P2.

    -Stephen

  • @ManAtWork said:
    I've just noticed that the terminal window of VSC has problems when there is too much output from the Propeller. The output just stops and I think there is a buffer overflow.

    At first I thought "oh no, my program crashes" but actually it doesn't. I added lighting up an LED at the end of the program so I can see it runs until the very end although the output stops.

    This is a known issue with loadp2, as it were.

  • Yes, this does kinda fall into the "while I was at it" category... ;-)

    NEWS

    I've just released v1.7.0 of our spin2 extension. Welcome full P1 support! (oh, and a new Insert Mode à la Propeller Tool)

    Fun Update! The first release of two **NEW features and more.**

    Latest Update:

    • NEW P1 support for .spin files (full syntax and semantic highlighting of the P1 language: spin/pasm)
    • NEW Add InsertMode support: [Insert|Overwrite|Align]
    • More changes to tabbing behavior, we're gradually dialing it in
    • P2 Syntax/Semantic highlighting changes - adds support for:
      ● New Spin2 'GETCRC(dataptr,crcpoly,bytecount) method
      ● New Spin2 'STRCOPY(destination,source,maxsize)' method
      ● DEBUG display BITMAP now validates 'SPARSE color'
      ● GRAY, in addition to GREY, now recognized as a color in DEBUG displays

    Thank you, Jay, your work is much appreciated! (Jay B. Harlow contributed the initial code for this tabbing feature)

    Known Issues:
    We haven't yet learned how to control the ending position of the edit cursor. So in many cases when using selection not an insert point the cursor may end up not being where you might expect it to be after pressing TAB or Shift+TAB. We are looking into how to solve this. Even tho' this problem exists the formatting ability this new service provides is well worth this minor headache. We will keep looking for a means to get this under control.

    Possible Conflicts with other VSCode Extensions

    Note1: This extension now replaces the Spin by Entomy vscode extension. While either can be used, our version provides more comprehensive Syntax highlighting (as the former has not been maintained) and this extension adds full Semantic Highlighting, Outlining, and Tab support with InsertModes. The older Spin extension can now be uninstalled with no loss of functionality.

    Note2: I'll be submitting pull requests to the Overtype extension maintainer to add code for avoiding interference with our .spin/.spin2 InsertMode feature but in the meantime please ensure that the Overtype by Adma Maras and/or Overtype by DrMerfy extensions are disabled or uninstalled as they can interfere with our extensions' behavior.

    What are we doing?

    This release updates the tabbing support. It is still disabled at first installation.
    In order to test it you must enable it, and restart VSCode. Then it will be present when editing any .spin2, or .pasm2 files.

    This feature is pretty much ready for use. Please let us know of any behavior you are not sure is correct or behavior that just doesn't feel right. Your feedback based on what you are experiencing will help us ensure this is working the way we all would like it to.

    Tab Implementation intent: Implementation Tabbing Notes

    New Insert Mode operation: Insert Modes for Spin and Spin2

    When you find things (or wish for new behaviors) let me know here: Repo Issues Page

    About this extension

    You can always review the Spin2 Extension ChangeLog from within VSCode or at github for more details.

    Reminder: The Spin2 extension is 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. Once installed it will automatically notify you of new update availability whenever I publish new updates.

    If you are already using this extension and for some reason, it did not update for you automatically, in VSCode go to your extensions view (SHIFT+CMD+X), and type in spin2. On the left, the info panel for the extension should appear and will indicate that an update has happened or needs to happen. Update it if needed.

    NOTE You may want to double-check that all older versions are removed from your .vscode/extensions folder after installing any 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 issues page

    I also point out a number of 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.

    What's next? on the horizon: (1) Finishing certification of this Spin VSCode extension for our P1 against all of the P1 Obex, and (2) fixing things seen in a couple of Spin2 code sets that are not being highlighted correctly.

    Enjoy!

    Stephen

  • NEWS

    I've just released v1.7.1 of our spin2 extension.

    (for those of you that realized the new tabbing didn't seem to work, this is the fix you've been waiting for... sigh. ;-)

    Update to keyboard mapping: All key mapping is now reenabled and Align mode is now fully functional

    • Fixed: Backspace and Delete now working correctly in Align Mode
    • Fixed: Oops, now all key mapping is working. (When clause was set to enable for spin and spin2 but killed everything instead)
    • [F11] key is now assigned as an alternate in case you don't have an [Insert] key (or Fn+Enter is not working)

    - Known Issues w/v1.7.1

    • We haven't yet learned how to control the ending position of the edit cursor. So in many cases when using selection, not an insert point, the cursor may end up not being where you might expect it to be after pressing TAB or Shift+TAB. We are looking into how to solve this. Even tho' this problem exists the formatting ability this new service provides is well worth this minor headache. We will keep looking for a means to get this under control.

    This time, you might actually get to enjoy using the new tabbing and align mode!

    -Stephen

  • Stephen MoracoStephen Moraco Posts: 248
    edited 2022-12-08 07:06

    NEWS

    I've just released v1.7.2 of our spin2 extension.

    Spin/Pasm for P1 and P2 - Highlighting Update

    Update Spin highlighting (syntax and/or semantic parser fixes)

    • Spin: Recognize label or data declaration on the DAT line
    • Spin: Recognize non-float decimal numbers with exponents

    Update Spin2 highlighting (syntax and/or semantic parser fixes)

    • Spin2: Recognize label or data declaration on DAT line
    • Spin2: Recognize non-float decimal numbers with exponents
    • Spin2: Recognize debug_main and debug_coginit compile time directives
    • Spin2: Recognize event names in pasm2 correctly
    • Spin2: Fix cases where debug used without parenthesis causes the extension to crash
    • Spin2: Recognize coginit constants (some pasm2 cases were being missed)
    • Spin2: Add recognition of LutColors directive in debug statements with run-time terminal assignment
    • Spin2: Recognize modcz operand constants

    - Known Issues w/v1.7.2

    • We haven't yet learned how to control the ending position of the edit cursor. So in many cases when using selection, not an insert point, the cursor may end up not being where you might expect it to be after pressing TAB or Shift+TAB. We are looking into how to solve this. Even tho' this problem exists the formatting ability this new service provides is well worth this minor headache. We will keep looking for a means to get this under control.
    • You can always review the Spin2 Extension ChangeLog from within VSCode or at github for more details.

    What's next? on the horizon: (1) Finishing certification of this Spin VSCode extension for our P1 against all of the P1 Obex

    Oh, and why does this take so long? Here's a hint: ;-)

    • Files shipped with PNut: 1 Folder containing 39 files to check
    • P2 Obex (My copy needs to be updated, but): 64 Folders containing 154 .spin2 files with unique content
    • P1 Obex: 816 Folders containing 2244 .spin files with unique content
    • My repo of files I regression test with 2 Folders containing 44 files to check

    When I do get these All checked (yes, it's by hand all visual) I do have a fairly good sense that things are recognized pretty well. As you can imagine, this set contains quite a range of coding styles and techniques.

    Enjoy!

    -Stephen

  • @"Stephen Moraco" said:
    ... I frequently have a need to log debug output from very long P2 code runs and then review the logs later for errant behaviors. I do this by connecting one of my Raspberry Pi's to the P2 serial port and running a python script that can show debug terminal windows and write all output to a log file.
    ...
    I know you weren't looking for an RPi solution I just mention it because it's my go-to means of capturing logs at full speed for hours upon hours from the P2.

    Hmm, I have several reasons why I'd like to avoid another computer on my desktop.

    But the good news is that I managed to consecutively start flexspin, loadP2 and pnut in -debug mode so that I can compile and download a program and finally see the debug output. I had to remove the "-t" option from the downloadP2 task so that the loadP2 command doesn't block the serial port after downloading. There are some problems, though:

    • pnut opens a relatively narrow debug window at the top of the screen. It doesn't refresh after resizing and it doesn't remember it's size and position until the next invokation. So I have no chance of making it larger before everything scrolls out of scope.
    • It takes some time for pnut to be ready to poll and display the debug output after the P2 has booted so the first lines (cog init..) are lost.
  • @ManAtWork I dont know how this fits into your setup, but could you add an instance of Eric’s video driver and print debug messages to that? It is pretty much ready to go as soon as the P2 boots.

  • @JRoark you mean the VGA driver? I have a full custom board where nearly all pins are connected to special IOs. My final application will also probably use all cogs. So I'd prefer debugging over the COM port.

    My ultimate goal is to use the graphical debug features in C or mixed language projects that were originally designed by Chip for Spin2. It would be nice to display signals in realtime with the scope display instead of having to browse through long hexdump log files.

  • @Stephen Moraco,

    When configuring the Spin2 extension in VSC, creating the tasks.json file within each project source code folder, seems redundant. Can I just create the tasks.json file at User level? I never change this file, so it should work (other than topFile, which I don't generally use).

    Is there something that I'm missing?

    dgately

  • @"Stephen Moraco"

    Howdy.
    I installed the VSC but have questions as to the procedure for the jason file. As well it it telling me that I do not have a debugger. The quick byte is broken. I looked at your video but did not see anything re the debugger, the jason and how to add flexprop?
    When you get time can you help.
    Thanks

  • @pilot0315 and @dgately let me get back into context with this, then I'll post an answer for you. (Later today or tomorrow)

  • @"Stephen Moraco"

    No hurry. Thanks

  • Stephen MoracoStephen Moraco Posts: 248
    edited 2022-12-18 02:03

    NEWS

    I've just released v1.7.6 of our spin2 extension, which fully supports both P1 and P2.

    I haven't been announcing each of the past tiny updates. But now we have a few. Here's the recap:

    v1.7.7
    Minor tabbing update

    • BUGIFX: end and endasm are now positioned using the In-line Pasm tab stops
    • BUGIFX: Corrected delete (left/Right) behavior in Align edit mode
    • BUGIFX: Cursor now positions as expected after TAB / SHIFT+TAB (this didn't work before)

    v1.7.5
    Minor highlighting update

    • Add offset color for local vs. global pasm labels
    • Detect and Flag invalid local pasm label syntax version: pasm1 vs. pasm2
    • Correct backspace behavior (no longer removes more than one character)

    v1.7.4
    Minor highlighting update

    • Constant declarations are now identified correctly
    • Spin builtin methods are now identified so other themes can render them better

    Thank you, Jay, your work is much appreciated! (Jay B. Harlow contributed the initial code for this tabbing feature)

    Possible Conflicts with other VSCode Extensions

    Note1: This extension now replaces the Spin by Entomy vscode extension. While either can be used, our version provides more comprehensive Syntax highlighting (as the former has not been maintained) and this extension adds full Semantic Highlighting, Outlining, and Tab support with InsertModes. The older Spin extension can now be uninstalled with no loss of functionality.

    Note2: I'll be submitting pull requests to the Overtype extension maintainer to add code for avoiding interference with our .spin/.spin2 InsertMode feature but in the meantime please ensure that the Overtype by Adma Maras and/or Overtype by DrMerfy extensions are disabled or uninstalled as they can interfere with our extensions' behavior.

    What are we doing?

    This release updates the tabbing support. It is still disabled at first installation.
    In order to test it you must enable it, and restart VSCode. Then it will be present when editing any .spin2, or .pasm2 files.

    Please let us know of any behavior you are not sure is correct or behavior that just doesn't feel right. Your feedback based on what you are experiencing will help us ensure this is working the way we all would like it to.

    Tab Implementation intent: Implementation Tabbing Notes

    New Insert Mode operation: Insert Modes for Spin and Spin2

    When you find things (or wish for new behaviors) let me know here: Repo Issues Page

    About this extension

    You can always review the Spin2 Extension ChangeLog from within VSCode or at github for more details.

    Reminder: The Spin2 extension is 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. Once installed it will automatically notify you of new update availability whenever I publish new updates.

    If you are already using this extension and for some reason, it did not update for you automatically, in VSCode go to your extensions view (SHIFT+CMD+X), and type in spin2. On the left, the info panel for the extension should appear and will indicate that an update has happened or needs to happen. Update it if needed.

    NOTE You may want to double-check that all older versions are removed from your .vscode/extensions folder after installing any 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 issues page

    I also point out a number of 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.

    What's next? on the horizon: (1) Finishing certification of this Spin VSCode extension for our P1 against all of the P1 Obex, and (2) fixing things seen in a couple of Spin2 code sets that are not being highlighted correctly.

    Enjoy!

    Stephen

  • @dgately when reading January 2020 (version 1.42) we see that tasks can be specified at workspace level (a single project) or user level (all projects/workspaces for user)

    Tasks declared in tasks.json are now supported at the User Settings level. If you have a build script that you use across many projects, or if you don't want your tasks in a project folder, you can add your tasks in the user tasks.json file. Run the Tasks: Open User Tasks command to create user level tasks and these tasks will be available across all folders and workspaces. Only the shell and process task types are supported here.

    This means that we should be able to declare paths to tools in our global settings and then our user tasks can then know where the tools are installed.

    As I'm figuring this all out I'm tracking what I know in my VSCode extension repository page VSCode Tasks. I'm going to work on this approach (global settings and user tasks) to see how it all pans out. As I get it working I'll document it on my repo page. When I update it in any significant way I'll then post a notice here to go look.

    This is what I'm working on for the next couple of days... so more soon.

  • @pilot0315 said:
    I installed the VSC but have questions as to the procedure for the jason file. As well it is telling me that I do not have a debugger. I looked at your video but did not see anything re the debugger, the jason and how to add flexprop?

    Regarding the debugger that's a problem I haven't heard of that will probably be solved by seeing screenshots or I can zoom with you again and we can figure it out together.

    We are all learning this together but to give those of us who are coming to this more recently I keep a repo page detailing how and why we set the tasks for VScode. The page VSCode Tasks at my repo tracks this detail for Windows, Macs, and Raspberry Pi (as well as other Linux variants.) The tasks as listed provide examples for invoking PNut and Flexprop.

    Please review the VSCode Tasks page for more detail on installing Flexprop and the .json files you'll need on the platform you are using.

    As I said I'm just now getting back into this in order to update what we know with the information provided by others (e.g., post by @VBBSim #102) in this thread as well as practicing with user tasks and global settings which should give us a "fewer task files" approach in addition to the current one-task-file-per-project approach which is documented at my page and works well.

  • Thanks I will check it out and let you know if I need more "vscode for dummies" help. :)

  • Stephen MoracoStephen Moraco Posts: 248
    edited 2022-12-20 07:27

    @dgately I have posted the first documentation for using a single tasks list for all projects.
    See TASKS-User.md

    EDIT: At this point, I've tested macOS and RaspiOS and both are working well. Next, I'll move on to testing/certifying Windows.

    I'd like, also, to merge PNut and FlexSpin tasks so we can have them both available on a windows machine.

    So, more to do but I thought you'd like to see what I have tested, so far, and how the documentation is shaping up.

    @"Ken Gracey" Once this is completed, we will want to update the QuickByte to use this new technique as it is much easier for our users.

  • Stephen MoracoStephen Moraco Posts: 248
    edited 2022-12-21 01:07

    NEWS:

    Ok, we are ready to do things differently!

    VSCode Build/download/flash UPDATEs:
    With this change we have:

    • Moved to a central user-tasks definition for all P2 tasks
    • Merged FlexProp and PNut task lists into one
    • Included Program Flash tasks
    • Adjusted terminal window use: Compile and Download/Flash now share the same terminal window
    • Recorded Path to FlexSpin as Environment Variable(Windows only) so tasks can find the flash support binary
    • Moved the tasks: Compile tasks are in Tasks: run build task while download/flash are in Tasks: run test task

    The new Spin2 VSCode Extension TASKS-User.md page describes the full setup steps for Windows, macOS, and RaspiOS (Linux variants)

    You may know that I run VSCode from my macOS desktop and use it to remote into my Raspberry Pi's. In this environment, this change really helped as these new user tasks and key bindings are automatically copied to the remote machine every time I connect keeping them up-to-date from my central copy. Very nice!

    While I don't remote into my windows machine I do use the VSCode Settings Sync extension on all my machines with VSCode installed. With this enabled when I move to my Windows Laptop it too has now received my central copy of the user tasks and key bindings.

    Here's a summary of the build environments I run with and have tested:

    • P2 hardware USB attached to Mac, FlexProp installed, VSCode to edit compile, and download/flash
    • P2 hardware USB attached to Raspberry Pi (or other linux), FlexProp installed, VSCode to edit compile, and download/flash
    • P2 hardware USB attached to Raspberry Pi (or other linux), FlexProp installed, remote into RPi via SSH with VSCode, compile and download/flash
    • P2 hardware USB attached to Windows Machine, FlexProp and PNut installed, VSCode to edit compile, and download/flash

    We'll shortly be making updates to the quickbytes page to reflect this change in set up.

    @dgately thanks for suggesting that we could be doing things in a more central fashion. That prompted me to get this tested and documented. @VBBSim thanks for testing out the flash mechanisms.

    Future changes I'm contemplating: (1) adding a setting to our extension allowing one to change a PNut debug-enabled setting which would be used when building with PNut, and (2) moving to a Task Provider built into our extension which would recognize the tools installed and the OS and then provide only the tasks appropriate for the OS with the tools installed.

    Enjoy!

    -Stephen

  • dgatelydgately Posts: 1,569
    edited 2022-12-21 02:20

    @"Stephen Moraco" said:
    @dgately I have posted the first documentation for using a single tasks list for all projects.
    See TASKS-User.md

    EDIT: At this point, I've tested macOS and RaspiOS and both are working well. Next, I'll move on to testing/certifying Windows.

    Thanks Stephen!

    VSCode is getting better & better for Propeller programing!

    I'll check the new docs!

    dgately

  • @"Stephen Moraco" said:
    NEWS:

    • Recorded Path to FlexSpin as Environment Variable(Windows only) so tasks can find the flash support binary

    On macOS, its also best to make sure your path to tool binaries (compilers, flexspin, etc.) are exported. Since I install flexprop into my home directory, I just export flexprop's bin path this way, by editing (in Terminal App) the ~/.profile file to add the following:

    export PATH=~/flexprop/bin:$PATH
    

    You may need to restart your terminal or use "source" on the file to make sure these exports become available...

    $ source ~/.profile
    

    You can test that these paths are in your Mac's environment variable. like this:

    printenv | grep flexprop
    It will print out your entire $PATH environment variable, if flexprop's bin directory is indeed within!

    dgately

  • @dgately Thanks for pointing this out. You should see, in my instructions on all platforms, my putting the tools in the path so they can be run by hand. I don't think I missed any. But if I did, let me know and I'll fix it.

    Stephen

  • @"Stephen Moraco" said:
    @dgately Thanks for pointing this out. You should see, in my instructions on all platforms, my putting the tools in the path so they can be run by hand. I don't think I missed any. But if I did, let me know and I'll fix it.

    I see... Since I always build flexprop after pulling source from GitHub (to get the latest updates), there's no need to move the previous flexprop release aside...

    $ cd ~/source/flexprop
    $ git pull
    $ make clean
    $ make install
    

    Gives me a fresh build of flexprop at: ~/flexprop...

  • There may be an error in the "Adding the P2 Tasks" section of the doc: "VSCode - User-wide defined Tasks"...

    I could be wrong, but I think the tasks.json file must start with "{' and end with "}"... Copying the example as-is results in an error, "end of file expected" in vscode.

    {
      "version": "2.0.0",
      "tasks": [
      ... 
      ]
    }
    
  • Moved to a central user-tasks definition for all P2 tasks

    Good point. But the settings.json and the extension for the top level file should stay local. I have some projects with a *.spin2 top level file and some others with a *.c main.

  • @dgately said:
    There may be an error in the "Adding the P2 Tasks" section of the doc: "VSCode - User-wide defined Tasks"...

    I could be wrong, but I think the tasks.json file must start with "{' and end with "}"... Copying the example as-is results in an error, "end of file expected" in vscode.

    Yes, you are correct, good find! Thank you. (I've corrected the page.)

    The point that really needs to be made is if you don't have any user tasks then pasting the whole example works fine. But if you have existing user tasks, you carefully need to copy just the task definitions from within the array and paste them into your own task list, making sure to separate the new from the old by adding another comma.

    Does this make sense?

  • @ManAtWork said:

    Moved to a central user-tasks definition for all P2 tasks

    ... the extension for the top level file should stay local. I have some projects with a *.spin2 top level file and some others with a *.c main.

    You are correct. I advocate that as well. The {project}/.vscode/settings.json file is what I show gets the identification of the top-level file. The central user tasks will pick up your project-local definition when you open a VSCode window to your project's folder/directory.

    Note: one has to pay attention to this. If for some reason you ended up with projects in subfolders only the top-most will be seen by VScode. You have to open a window with the .vscode folder at the root of the folder you open for VSCode to pick it up.

  • @"Stephen Moraco" said:
    The point that really needs to be made is if you don't have any user tasks then pasting the whole example works fine. But if you have existing user tasks, you carefully need to copy just the task definitions from within the array and paste them into your own task list, making sure to separate the new from the old by adding another comma.

    Does this make sense?

    Yes!

    Thanks

  • NEWS

    I've just released v1.8.3 of our spin2 extension, which fully supports both P1 and P2.

    I haven't been announcing each of the past updates. But now we have a few. Here's the recap:

    v1.8.3
    Spin/Pasm for P1 and P2 - Syntax/Semantic update

    Minor Syntax/Semantic recognizer update - Adds help for porting p1 code to p2

    • Syntax P1 & P2: Recognize nested {} and {{}} comments
    • Semantic P2: if () missing after a method name (mark it as unknown - RED -> error)

      • NOTE: we can't do this for "object method calls" until we have a full language server. (It's coming!)
    • Semantic P2: If () missing after a spin built-in method name (mark it as unknown - RED -> error)

    • Semantic P2: Flag P1 specific variables, mnemonics, methods as RED -> error so we know what needs conversion to P2

    v1.8.2, v1.8.1
    Spin/Pasm for P1 and P2 - Outlining update

    • Add global Pasm labels to outline

    Thank you, Jay, your work is much appreciated! (Jay B. Harlow contributed the initial code for this tabbing feature)

    What are we doing?

    This update is focused on making it easier to port P1 code to the P2. Now when you rename a .spin file to .spin2 and then edit it with VSCode the editor will show in bright red all of the P1-specific terms (constant names, method names, instruction mnemonics, local pasm labels, etc.) so you can quickly focus on the areas needing change.

    If you see any issues with this new feature please let us know by filing new issues at our code repo.

    Possible Conflicts with other VSCode Extensions

    Note: This extension now replaces the Spin by Entomy vscode extension. While either can be used, our version provides more comprehensive Syntax highlighting (as the former has not been maintained) and this extension adds full Semantic Highlighting, Outlining, and Tab support with InsertModes. The older Spin extension can now be uninstalled with no loss of functionality.

    Past Notes

    Release v1.50 and later provide our new tabbing support. It is disabled at first installation.
    In order to use the new tabbing you must enable it, and restart VSCode. Then it will be present when editing any .spin2, or .spin files.

    Please let us know of any behavior you are not sure is correct or behavior that just doesn't feel right. Your feedback based on what you are experiencing will help us ensure this is working the way we all would like it to.

    Tab Implementation intent: Implementation Tabbing Notes

    New Insert Mode operation: Insert Modes for Spin and Spin2

    When you find things (or wish for new behaviors) let me know here: Repo Issues Page

    About this extension

    You can always review the Spin2 Extension ChangeLog from within VSCode or at github for more details.

    Reminder: The Spin2 extension is 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. Once installed it will automatically notify you of new update availability whenever I publish new updates.

    If you are already using this extension and for some reason, it did not update for you automatically, in VSCode go to your extensions view (SHIFT+CMD+X), and type in spin2. On the left, the info panel for the extension should appear and will indicate that an update has happened or needs to happen. Update it if needed.

    NOTE You may want to double-check that all older versions are removed from your .vscode/extensions folder after installing any 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 issues page

    I also point out a number of 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.

    What's next? on the horizon (yes, I'm still working on these...): (1) Finishing certification of this Spin VSCode extension for our P1 against all of the P1 Obex, and (2) fixing things seen in a couple of Spin2 code sets that are not being highlighted correctly.

    Enjoy!

    Stephen

Sign In or Register to comment.