Skip to content

ironsheep/P2-vscode-langserv-extension

Repository files navigation

VSCode support for the Parallax Propeller v1 & v2 8-Core MCU's

Project Maintenance License Release GitHub issues

Spin2 Extension: Version Installs Downloads

VSCode support for the Propeller languages: Spin2 and Pasm2 for the Parallax Inc. Propeller 2 P2 or P2X8C4M64P along with Spin and Pasm support for the Propeller 1 P1 or P8X32A.

The P2 and P1 communities thrive in the P2 Forums and the P1 Forums

The P2 Forum Thread containing discussion of this VSCode support

The P1 Forum Thread containing discussion of this VSCode support

Features

  • Full language server based support for both P1 (spin/pasm) and P2 (spin2/pasm2) languages
  • Parse detected errors are reported for each document when referenced/opened. If "Error Lens" extension is installed these errors are shown on the offending line of code.
  • Show Hovers and Signature Help features for constants and methods within external objects now shows information from the external file in which they are defined
  • Spin Code Folding support
  • P2 Support:
    • P2: 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
    • P2: Show Hovers Feature Hovers show information about the symbol/object that's below the mouse cursor. In our case this is for both user written code and for Spin2 built-ins.
    • P2: Signature Help Feature As you are typing a method name show signature help for both user written methods and for Spin2 built-in methods.
  • P1 Support:
    • P1: Syntax and Semantic Highlighting for both Spin and Pasm
    • P1: Show Hovers Feature Hovers show information about the symbol/object that's below the mouse cursor. In our case this is for both user written code and for Spin built-ins.
    • P1: Signature Help Feature As you are typing a method name show signature help for both user written methods and for Spin built-in methods.
  • Object Public interface Documentation generation via keystroke [Ctrl+Alt+d] - Ctrl+Alt+( d )ocument.
    - Document opens on right side of editor
  • Object Hierarchy Report generation via keystroke [Ctrl+Alt+r] - Ctrl+Alt+( r )eport.
    - Report opens on right side of editor
  • Doc-Comment Generation for PUB and PRI methods via keystroke [Ctrl+Alt+c] - Ctrl+Alt+( c )omment.
    - Comment is inserted immediately below the PUB or PRI line.
  • Editor Screen Coloring support per section à la Parallax Propeller Tool
  • 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
  • File navigation from Object Hierarchy View
  • Edit Mode support à la Parallax Propeller Tool [Insert, Overtype and Align]
  • Provides rich companion themes for use with non-color backgrounds or with colored backgrounds as well as Syntax only theme (mostly used during semantic highlighting development

Up next

We are working on the next updates:

  • Improve Hover support (more doc details such as pasm code help)

These are not yet definate but I'm:

  • Looking into adding a setting to our extension allowing one to change a "PNut Enable Debug" setting which would be used when building with on windows with PNut
  • Looking into developing a Task Provider (to be 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.
  • Looking into customizable Spin code formatter with features like format on save.

Future directions

  • Task Provider - studies the current environment and offers to write the tasks for a given P2 project
  • Spin2/Pasm2 code formatter/beautifier - allows us to have standard formatting for code we share! (source code could be formatted on each file save)
  • Snippets for Spin2/Pasm2 (common code sequences which can be added easily to file being edited (e.g., smart pin setup code for given mode/use)
  • Possible Extension Package for P2 (would include all P2 specific extensions)

Installation

In VSCode search for the "spin2" extension and install it. It's that easy! After installation you will be notified to download and install a new version as new versions are released.

Note: This extension 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, Document generation, etc. The older Spin extension can now be uninstalled with no loss of functionality.

VSCode Environment

There are additional companion documents in this Repository:

  1. Configuring User Tasks - Windows which advises on how to automate your P2 Development when using VScode on Windows
  2. Configuring User Tasks - MacOS which advises on how to automate your P2 Development when using VScode on macOS
  3. Configuring User Tasks - Windows|MacOS|RPI which advises on how to automate your P2 Development when using VScode on any of the supported platforms
  4. Configure VSCode for background coloring by Spin Block how to set up coloring and some additional notes
  5. VSCode Extensions we find useful in our own P2 development
  6. Visual Examples - Tabbing a visual explaination of how our Tabbing feature works (For those of us, like me, who understand more easily when we see pictures.)
  7. Engineering Notes - Tabbing more detailed description of how our Tabbing feature works
  8. Spin2 Extension Details: Settings and Keyboard Mapping

Also, here are a couple of really useful VSCode sources:

  • VSCode can do that? Fun website showing specific things VSCode can do - review whats possible that may help you in your use of VSCode.
  • YouTube Channel: Code 2020 - A large list of short videos presenting all manner of useful VSCode tips.

Please go look at each of these once so you can know what's here when you need them!

Known Conflicts with other VSCode Extensions

We know the three extension so far which might interfere with our Spin2 extension. Here's what we've seem:

  1. If I haven't already, I'll be submitting pull requests to the Overtype extension maintainers 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.
  2. The Extension Document This v0.8.2 currently also occasionally intercepts the Ctrl+Alt+D keystroke which we use to generate documentation and our extension then doesn't get the request. I've filed an issue with that extensions' maintainer so maybe this will be fixed in the future. Meanwhile, you can either disable the Document This extension or when you see the warning pop up from the document this extension you can usually just click in your editor window again and then press Ctrl+Alt+d again and it will work after one or more tries.

Repository Notes

This repository contains a single subproject which is the vscode extension:

  • SPIN2/SPIN and PASM2/PASM syntax Highlighting and code navigation spin2 - Builds

If you like my work and/or this has helped you in some way then feel free to help me out for a couple of ☕'s or 🍕 slices or support my work by contributing at Patreon!

coffee    -OR-    PatreonPatreon.com/IronSheep


Credits

Ray [Cluso99] in our Propeller 2 Forums which started this effort for us.

Patrick (GitHub Entomy) for a spin1 extension which helped me get further along with this one.

Jay B. Harlow for contributing the initial elastic tabs feature.

George (GitHub DrMerfy) for the latest VSCode-Overtype extension which provided the foundation to which we could add the Align mode.

License

Licensed under the MIT License.

Follow these links for more information: