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

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

123457

Comments

  • Sounds great.
    Good luck!

  • BTW, is there a way to assign an F-key to the action "close all terminal windows"? I often forget to close them so I get "task downloadP2 is already active" or "no propeller found on any port". Clicking on all the trashcan icons in the terminal window list in the lower right corner is somehow inconvenient.

  • @ManAtWork said:
    BTW, is there a way to assign an F-key to the action "close all terminal windows"? I often forget to close them so I get "task downloadP2 is already active" or "no propeller found on any port". Clicking on all the trashcan icons in the terminal window list in the lower right corner is somehow inconvenient.

    I'll have to look...

  • Stephen MoracoStephen Moraco Posts: 303
    edited 2023-10-18 19:36

    NEWS

    Fun Demo in today's P2 Live Forum.... See you all there!

  • @"Stephen Moraco" , you said at the live forum than somthing is broken with my screen. Themes or syntax highlighting is turned off or somehting. I can't tell because I'm used to what I see and don't know anything different. You said, there was a lot of "white text". This an example screenshot.

    I know, the code looks ugly because of all the commented out debug()s. But should it look different?

  • @ManAtWork said:
    I know, the code looks ugly because of all the commented out debug()s. But should it look different?

    Yes, I believe it should look different.

    Check which theme you have selected. Code->Settings...->Theme->Color Theme:
    You should see:

    Light:
    Spin2 Ironsheep Light
    Spin2 Ironsheep Light for background Color
    Dark:
    Spin2 Ironsheep Dark
    Spin2 Ironsheep Dark for background Color
    Spin2 Ironsheep Syntax <--- this appears to be the one you have selected

    Choose "Spin2 Ironsheep Dark" to see if the Semantic coloring yields less white code

  • @ManAtWork said:
    BTW, is there a way to assign an F-key to the action "close all terminal windows"? I often forget to close them so I get "task downloadP2 is already active" or "no propeller found on any port". Clicking on all the trashcan icons in the terminal window list in the lower right corner is somehow inconvenient.

    OK, let's check your tasks file. You should see one or more sections similar to:

          "presentation": {
            "reveal": "always",
            "panel": "new"    <----
          }
    

    I believe you'll want to change the "panel": value (arrow above). See: VSCode docs Output behavior

    I'm thinking "shared" or "dedicated" may be a better choice.

    Please Let me know if this helps.

  • @"Stephen Moraco" said:
    Check which theme you have selected. Code->Settings...->Theme->Color Theme:
    ...
    Choose "Spin2 Ironsheep Dark" to see if the Semantic coloring yields less white code

    Yes, it was set to "Spin2 Ironsheep Syntax". After setting it to "Spin2 Ironsheep Dark" most of the white text turned purple. Unfortunatelly, this doesn't work well with my monitor (looks somewhat blurred) and hurts my eyes. I'll see if I can find some adjustment to increase the contrast a bit... If not I'll change it back to the old setting.

    I believe you'll want to change the "panel": value (arrow above).
    I'm thinking "shared" or "dedicated" may be a better choice.

    I tried both. It works for the compile tasks because the previous compile task is finished each time I restart it. So the terminal for that task is re-used. But it doesn't work for the downloadP2 task if it runs with the terminal option (-t). Of course, the terminal doesn't know if the P2 is finished outputting serial data or if more is to come. So I have to close the window manually. No matter if I chose "shared" or "dedicated" a dialog pops up

    Unfortunatelly, I can't simply choose "restart task" by hitting cursor right and return. I have to use the mouse to click on it or press tab multiple times. Maybe there's an easy way to close the terminal with some key-combination (cokebottle-Z or something) I just don't know, yet.

    BTW, the presentation yesterday was very interesting. Unfortunatelly, I was very tired so I fear I can't remember anything. So I'll keep asking clumsy questions. o:)
    Thanks for your help!

  • Stephen MoracoStephen Moraco Posts: 303
    edited 2023-10-23 01:29

    NEWS

    You might have seen the new features in our most recent P2 live forum!
    Now, you can be an early adopter and experience these features yourself!

    It's time to quickly evaluate the feature parity version of the new Language-Server-based VSCode Extension for P1 and P2 so I can get it released for all of us to use.

    I'm looking for a few volunteers who would want to evaluate the new extension against their code. The key here is that the code must compile with PNut or Propeller Tool.
    For this effort, I'm NOT looking into FlexSpin compatibility with this initial testing.

    My immediate focus is to ensure that there are no regressions relative to the way the current v1.9.16 Spin2 extension is working.
    I believe the parser is more robust as I've been reviewing all my regression test code, and it's looking quite good.

    Here's my ask:

    • You email me indicating interest and that you have time early this week to do this.
    • I'll reply with a .zip of the new extension and a link to a page with instructions (Today, Mon. or Tue.)
    • You follow the instructions to get your VSCode running the new Spin2 extension instead of the old one. (You can quickly revert this if you find a reason to.)
    • You visit many of your source files to see if they are not parsing correctly.
    • For each one that isn't, you send an email to me indicating what's not working, and I get it fixed before the live release

    Sound like you want to help? You can email me volunteering at: "stephen at ironsheep dot biz"

  • NEWS

    Finally, After more than a month of work...

    I've just released v2.1.0 of our spin2 extension. This is the first Language-server-based version of the extension.

    v2.1.0
    **Feature Updates for both P1 and P2 **

    • Files included by the current file are parsed, and references to the included objects are validated
    • Documentation from the included object files is shown for Hover Text and Signature help
    • Live parsing on file change, allowing changes in one editor window to affect another editor window (e.g., You have a top-level spin file open and an object spin file open in 2nd window. Changes in the object file can immediately affect the top-level file.)
    • Display of errors found during parse are listed for each file parsed (and with Error Lens, errors show on affected line)
    • When a file is parsed, and errors are found, the file entry in the left panel file browser turns light red to highlight that the file contains errors
    • Many improvements in parsing / highlighting for both P1 and P2
    • Our new parse error reporting makes it easier to port P1 code to our P2. Simply copy the P1 file and adjust the suffix to .spin2. At this point, all non-supported P1 code is highlighted, and errors are shown describing the issues found.

    If you see any issues with these new features please let us know by filing new issues at our code repo. (or email me directly.)

    This represents a whole lot of change. Please be sensitive to things being different. My goal in this extension is to do our best to parse the language implemented by PNut and Propeller Tool. If any warnings are not correct relative to what these two tools do, please let me know, and I'll work to quickly get the issue fixed!

    Possible Conflicts with other VSCode Extensions

    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. The older Spin extension can now be uninstalled with no loss of functionality.

    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.

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

    There are also three platform-specific tasks installation pages:

    What's next? Taking a short break, this was a lot of focused work... but then starting to add the features now enabled by our being Langauge Server based!

    Enjoy!

    Stephen

  • NEWS

    I've just released v2.2.0 and v2.2.1 of our spin2 extension. These are the first upgrades to our LSP based extension

    The v2.2.1 release is round 1 of 2, where I'm rapidly fixing issues found by more advanced testing. Round two will follow in a couple of days.

    v2.2.0
    Awaken Feature: Show Definitions of a Symbol for P1 & P2
    Peek at or go to the definition of variables/methods from where the variables/methods are being used.

    • Enables right-mouse commands "Go to Definition" and "Peek -> Peek Definition"
    • In spin, this works for method names, global variables, parameters, return values, method local variables, and pasm global labels.

    v2.2.1
    General bug fixes for P1 and P2

    • Repair filename validation in object includes - make checking the same as PNut/Propeller Tool
    • Ensure no parser Error/Warning/Information messages are returned when maxNumberOfReportedIssues is set to zero
    • Clean up issues with the new go-to definition feature (some cases were not recognized)
    • P1 repair hover detection for object#constant references
    • P2 add basic hover text for Streamer Constants
    • P1/P2 CON enhance parsing of operators used within RHS of assignment
    • P1/P2 enhance parsing when {comment} used within the line being parsed
    • P2 OBJ enhance parsing of object override values
    • P1/P2 PUB/PRI enhance parsing left-hand side of assignments

    If you see any issues with these new features please let us know by filing new issues at our code repo. (or email me directly.)

    This represents a whole lot of change. Please be sensitive to things being different. My goal in this extension is to do our best to parse the language implemented by PNut and Propeller Tool. If any warnings are not correct relative to what these two tools do, please let me know, and I'll work to quickly get the issue fixed!

  • Stephen MoracoStephen Moraco Posts: 303
    edited 2023-11-09 05:51

    NEWS

    I've just released v2.2.2 of our spin2 extension. This is more "dialing-in" of our LSP-based extension.

    The v2.2.2 release is round 2 of 2, where I'm rapidly fixing issues found by more advanced testing.

    v2.2.2
    General bug fixes for P2 only (round 2)

    • P2 Add DRAFT handling of line continuation "..." - (support only in OBJ section for now!)
    • P2 Repair DAT pasm symbol offset calculations so highlights are in the correct position
    • P2 Add new built-in keyword "with" to syntax highlighter

    General bug fixes for Both P1 and P2 (round 2)

    • P1 & P2 Adjusted parameter, return-value, and local variable name collision with global variable to produce error messages.
    • P1 & P2 Repair go to def'n for local variables (limit search scope to the current method)
    • P1 & P2 Repair go to def'n for local pasm labels (limit search scope to between the enclosing global pasm labels)
    • P1 & P2 Increase resolution on go to def'n - was line number only. It is now a line number with a character offset, so now it will position the cursor at the actual symbol within the line (e.g., good for go to enum declaration!)
    • P1 & P2 Repair DAT pasm parser so it doesn't leave pasm mode until the end of the DAT block
    • P1 & P2 Found and fixed a couple of crash causes

    If you see any issues with these new features, please let us know by filing new issues at our code repo. (or email me directly.)

    This move to a language server form caused a whole lot of change. Please be sensitive to things being different. My goal in this extension is to do our best to parse the language implemented by PNut and Propeller Tool. If any warnings are incorrect relative to what these two tools do, please let me know, and I'll work to fix the issue quickly!

  • hinvhinv Posts: 1,252

    For those of us that don't trust microsoft, will this work on vs-codium as well?

  • Yes. Need to futz with product.json to connect to the MS extension store though.

  • NEWS

    I've just released version 2.2.11 of our spin2 extension. This is more "dialing-in" of our LSP-based extension, and a new Code Folding feature has arrived!

    Users of VSCode get automatic updates so you all have these updates already!

    Here's a recap of what's new in v2.2.3 through v2.2.11

    v2.2.3 - v2.2.11
    General updates for P2

    • Add full v43 support: auto, byte(), word(), long(), and lstring() when v43 selected
    • When a version is specified {Spin2_v##}, then the version will also be emitted to the Generated Object Interface Documentation
    • Adds detection of and error generation for duplicate declarations within CON, VAR, and DAT sections
    • Add full code folding support
    • Add line-continuation support for CON, OBJ, PUB, and PRI sections
    • Top block (when block not specified, defaults to CON) is now highlighted correctly as CON

    If you see any issues with these new features, please let us know by filing new issues at our code repo. (or email me directly.)

    This move to a language server form caused a whole lot of change. Please be sensitive to things being different. My goal in this extension is to do our best to parse the language implemented by PNut and Propeller Tool. If any warnings are incorrect relative to what these two tools do, please let me know, and I'll work to fix the issue quickly!

  • RS_JimRS_Jim Posts: 1,756

    @"Stephen Moraco"
    Stephen,
    After 6 Months of in activity in programming and a move, I am ready to jump back in and would like to retry visual studio code.
    here is what i have now:
    Version: 1.74.3
    Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
    Date: 2023-01-09T16:57:40.428Z
    Electron: 19.1.8
    Chromium: 102.0.5005.167
    Node.js: 16.14.2
    V8: 10.2.154.15-electron.0
    OS: Linux x64 5.4.0-169-generic
    Sandboxed: No
    where do I go from here to get the latest and greatest and all of your wonderful updates?
    Jim

  • Stephen MoracoStephen Moraco Posts: 303
    edited 2024-01-09 04:23

    @RS_Jim said:
    where do I go from here to get the latest and greatest and all of your wonderful updates?

    Should be pretty simple. Make sure you have the latest VSCode updates installed, then go to the Extensions section and search for Spin2. Install it and select the "Spin2 IronSheep Light" or "Spin2 IronSheep Dark" for starters. (if you want light or dark editor backgrounds)

    Then, review various other setup options on my VSCode Environment page. I suggest more useful extensions you might want and I point out how to setup compiling based up the OS you are using, and more...

    My most recent updates have been focused on P2. My next batch of point updates will be targeted fixes to P1 parsing and highlighting

    Will you be doing mostly P2 or P1 or both?

  • RS_JimRS_Jim Posts: 1,756

    @"Stephen Moraco"
    Thanks for the reply. After I sent my post, I figured out how to do the extensions. I have the latest upgrade downloaded but I need to go study how to install it in my linux environment.
    Jim

  • RS_JimRS_Jim Posts: 1,756

    @"Stephen Moraco"
    Stephen,
    For the last several days, I have been trying to figure out how to create the PATH statement in Linux for my main machine and the RPi. Ken's document is only for the windows environment, not Linux. All of the references on line are obscure and I am struggling to figure them out any help would be appreciated
    Jim

  • Stephen MoracoStephen Moraco Posts: 303
    edited 2024-01-17 20:42

    @RS_Jim said:
    For the last several days, I have been trying to figure out how to create the PATH statement in Linux for my main machine and the RPi. Ken's document is only for the windows environment, not Linux. All of the references on line are obscure and I am struggling to figure them out any help would be appreciated

    it depends upon what OS you are running on each, but generally, the PATH is configured in the ~/.profile file in your login/home directory.

    I set up all of my Ubuntu, Debian, and Raspberry Pi OS the same. I have detailed setup instructions for RPi here: RPi Setup

    Does this help?

  • RS_JimRS_Jim Posts: 1,756

    Thanks Stephen,
    I started from scratch on my rpi 2b and built the upd/autorm files as specified in the above. Autorm works as advertised but upd gets me a 'file not found' error. I can enter the commands manually from the command line and they work as advertised but from the file,no. Seems like I have put some hidden character in the title.
    Jim

  • @RS_Jim said:
    ... upd gets me a 'file not found' error. I can enter the commands manually from the command line and they work as advertised but from the file,no. Seems like I have put some hidden character in the title.

    Could be one of two things. If, as you suggest, it's a character in the filename, then you can rename the file using 'mv {oldname} {newname}' and try again.
    Alternatively, it could be that you just need to make the file executable. Try 'chmod +x upd' and then try running it again.

    Does this help?

  • frank freedmanfrank freedman Posts: 1,977
    edited 2024-02-11 17:41

    edit: does not look like a VSC issue.

  • RS_JimRS_Jim Posts: 1,756

    @"Stephen Moraco"
    Blew away upd and repeated the steps this time it worked, thanks
    Jim

  • RS_JimRS_Jim Posts: 1,756

    @"Stephen Moraco"
    Good morning from Surprise AZ, USA
    I have been working to get Visual Studio Code up and running on my laptop and my rpi with some difficulty. On my main computer I have the the following results:

    PATH=/home/jim/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/flexprop/bin:/usr/Library/New_P2robot:
    
    *  Executing task: flexspin -2 -Wabs-paths -Wmax-errors=99 TX_robot_adc_3.spin2
    
    /bin/sh: line 1: flexspin: command not found
    
     *  The terminal process "/bin/sh '-c', 'flexspin -2 -Wabs-paths -Wmax-errors=99 TX_robot_adc_3.spin2'" failed to launch (exit code: 127).
     *  Press any key to close the terminal.
    

    flexspin is in the folder /flexprop/bin
    and the segment I am trying to compile is in Library/New_P2robot. Can you spot my error?
    thanks
    Jim

  • RS_JimRS_Jim Posts: 1,756

    Hi,
    Has anyone had success in installing vsc on a pi5? If so what steps did you take?
    Thanks
    Jim

  • dgatelydgately Posts: 1,623
    edited 2024-03-17 14:34

    @RS_Jim said:
    Has anyone had success in installing vsc on a pi5? If so what steps did you take?

    In the RPi5 Terminal, you can install it with the apt command:

    sudo apt update
    sudo apt upgrade -y
    sudo apt install code
    

    Source:
    https://code.visualstudio.com/docs/setup/raspberry-pi

    OR (even easier), use Recommended Software in the Preferences menu (if you are running Raspberry Pi OS):

    dgately

  • RS_JimRS_Jim Posts: 1,756

    @dgately.
    Thanks for the headsup on r pi preferences. There is a real treasure trove there.
    Jim

  • @"Stephen Moraco" ,

    I haven't revisited my P2 programs for almost a year now, but recently I wanted to do check on the code and after updating the extensions in VSC, I suddenly have lots of syntax errors, mostly on object methods, in a code that compiles ok. I tested in latest version of Spin Tools for comparison and it doesn't show any syntax errors there. I am using the latest version of flexspin as compiler. Did I miss some change I need to do with the new version of the Spin2 extension? Here's a screenshot for reference:

  • @jrullan said:

    I haven't revisited my P2 programs for almost a year now, ..... Did I miss some change I need to do with the new version of the Spin2 extension?

    Hopefully the new extension version is helping you with this issue: V2.2.15.
    I look forward to hearing.

    For those of you reading this. I was not able to identify the cause but was not able to recreate the issue with the v2.2.15 as I was working on it before release. I then reviewed all the code, found and fixed 3 more issues I was able to find, and then pushed the new release.

Sign In or Register to comment.