Shop OBEX P1 Docs P2 Docs Learn Events
Question on "Configuring Visual Studio Code for Programming the P2" Quick Byte — Parallax Forums

Question on "Configuring Visual Studio Code for Programming the P2" Quick Byte

@"Ken Gracey" @"Stephen Moraco" @Cluso99 @ersmith

I followed the Quick Byte and was up and running in a matter of minutes. Kudos to everyone involved in this. I now have a new tool chain.

However, after I closed everything down, I went directly into the source code directory and right clicked on the .spin2 file and selected "Open with Code". This opened the .spin2 file in VSC, however it did not seem to load the tasks.json file from the .vscode directory [as I would have expected], because F10 complained of "No Build Task to Run Found". After playing around awhile I discovered that if I created a Workspace and added that directory to the Workspace everything worked as expected as long as I opened the Workspace first. So, am I missing something here or is this the way VSC is suppose to function.

Thanks again for your efforts!

Comments

  • Hey @CJMJ: happy to hear you were launched quickly. My first time through that process took 30 minutes.

    That JSON file needs to be in the same location as your code. The process I've used is like this:

    Open a folder where you want to edit code
    Terminal => Configure Tasks => Create Tasks.json from template => Others
    Copy your master JSON onto the bare template that showed up
    Change the TOP file to your top file (edit the name that's there)
    File => Save

    F10 compiles the project

    Now, I'm the last guy who knows much about anything related to coding, including the best way around VSC. So, maybe some of the experts will show up and tell us how this relates to creating a Workspace, or if it's the same thing.

    Ken Gracey

  • I think the process of right-clicking on a file and open with (....VSC) doesn't drag along the connected workspace and JSON folder/file that's there, because you're only opening a file and not a folder.

    Ken Gracey

  • Hi, excuse my ignorance, but could someone please explain the advantages which would make one migrate from PropTool to Visual Studio Code.

  • @macrobeak said:
    Hi, excuse my ignorance, but could someone please explain the advantages which would make one migrate from PropTool to Visual Studio Code.

    No ignorance from you; you're asking good questions. These are the reasons I can think of:

    • familiarity with VSC, a professional and very stable tool
    • lots of interesting extensions available in VSC marketplace, for free
    • programming the P2 on Mac or Linux (not Windows)
    • really good control over the color scheme and project management

    VSC is currently using FlexSpin. This is not the Parallax factory-provided compiler. However, we're making many efforts to make sure code compiles both for Propeller Tool and using FlexSpin. When it doesn't compile on FlexSpin, we post an issue on the FlexSpin GitHub or ask Eric on the forum thread, here.

    If you are happy with your current setup with Prop Tool, stay put.

    Ken Gracey

  • Cluso99Cluso99 Posts: 18,069

    I have never clicked on a file to open it in VSC. I think that comes from the fact I when I started using VSC I was mainly programming in python, and clicking a python source file xxx.py will actually run the python file, not open it in VSC. A dangerous habit to avoid to be sure.

    With PropTool, you can never hope to have the editing capabilities and highlighting that you have with VSC. Parallax, or for that matter most companies, do not have the resources available that VSC has. VSC already runs natively on the M1 Macs. VSC appears to be the editor currently used by the majority of programmers, so that's a pretty big plus IMHO.

  • VSC has a lot of momentum. One of its biggest achievement is the LSP - language server protocol. It’s the foundation of code completion and hinting etc that one is observing in modern IDEs/Editors. The best thing about it: it’s agnostic, so even I as Emacs User can use it. It’s one of the biggest productivity boosts of the last years for me. Which is why I one day hope we have it for SPIN/PASM as well :)

  • Cluso99Cluso99 Posts: 18,069

    @deets said:
    VSC has a lot of momentum. One of its biggest achievement is the LSP - language server protocol. It’s the foundation of code completion and hinting etc that one is observing in modern IDEs/Editors. The best thing about it: it’s agnostic, so even I as Emacs User can use it. It’s one of the biggest productivity boosts of the last years for me. Which is why I one day hope we have it for SPIN/PASM as well :)

    The last VSC update has gone too far IMHO. I can disable it, but I get these lightbulbs trying to recommend/do all sorts of things to my python code.
    However, the completion options are great, and I think I get some of these for spin too.

    Anyway, it’s a great editor and the syntax colouring is great, even without Stephens latest updates.

  • @deets said:
    VSC has a lot of momentum. One of its biggest achievement is the LSP - language server protocol. It’s the foundation of code completion and hinting etc that one is observing in modern IDEs/Editors. The best thing about it: it’s agnostic, so even I as Emacs User can use it. It’s one of the biggest productivity boosts of the last years for me. Which is why I one day hope we have it for SPIN/PASM as well :)

    As in Pnut/PASM?

    Ken Gracey

  • __deets____deets__ Posts: 203
    edited 2021-03-18 17:32

    @"Ken Gracey" I don’t use that and AFAIK PNut is Windows? I’m on Linux or Mac usually. Also some of us programmers tend to be a bit special when it comes to our editors.... we invest a lot, changing them is rare. Instead we tweak them to also have those cool features the other kids have.

    The beauty of LSP is that you implement that once for every editor and once for every language, but not for every editor times every language.

    See https://microsoft.github.io//language-server-protocol/

    BTW I tried to find out more about PNut, found https://www.parallax.com/propeller-2-graphical-debug-tools-in-spin2/ , and the PNut V35 link is dead for me. Maybe a website Migration issue?

  • Cluso99Cluso99 Posts: 18,069

    There’s a pnut thread and the link to the latest download is in the first post of that thread. pnut35j is the latest.

Sign In or Register to comment.