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

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

Stephen MoracoStephen Moraco Posts: 253
edited 2023-02-15 21:40 in Propeller 1

NEWS

Version v1.8.6 is the current release version but as of earlier version v1.7.0, this extension fully supports P1 as well as P2 spin/pasm development.

Features:

  • Full support for both P1 (spin/pasm) and P2 (spin2/pasm2) languages
  • Syntax and Semantic Highlighting for both Spin and Pasm
  • Syntax and Semantic Highlighting for both Spin2 and Pasm2 including all Streamer and Smart-pin Symbols as well as all debug() statements with parameter validation for all display types
  • Custom tabbing Tab-stop support per section à la Parallax Propeller Tool
  • Tab Sets You can choose between Propeller Tool, IronSheep, and User1 (adjust in settings to make your favorite set)
  • File navigation from Outline View
  • Edit Mode support à la Parallax Propeller Tool [Insert, Overtype and Align]
  • Works with your favorite VSCode themes
  • Offers companion Theme (Two themes: Syntax+Semantic, and Syntax only - mostly used during semantic highlighting development)

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?

The tabbing support is disabled at the first installation.
In order to use it you must enable it, and restart VSCode. Then it will be present when editing any, spin, .pasm, .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

Comments

  • Stephen MoracoStephen Moraco Posts: 253
    edited 2023-02-15 21:56

    I use this environment for all of my P2 work. It's way too useful as an editing/IDE so we activated the P1 support nearly as robustly as the P2 support. (I say nearly as the are many more P1 files in the P1 Obex so I've many more files to verify, yet.)

    While the following is set up for P2 development using Flexspin, this is an excellent pattern for running your own favorite native compilers.

    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 setup.

    @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

Sign In or Register to comment.