Update, here's what I'm working on... (in between my RGB LED Matrix driver efforts)
- (1) Language syntax highlighting - our SPIN2/PASM2 languages together have some 800ish keywords... I'm only partway done adding them. I have created the definition for the autoclose behavior for this language and that's working well. Work in progress
- (2) Outline navigation of the current file does not work for SPIN/PASM. I've started to add it but my initial attempt is not yet working. I found an example project to start from. This will probably be one, maybe two, pages of code. This is not a large effort. (it's written in TypeScript). Work in progress
- (3) I've been playing with packaging the extensions. I finally know how to, and have successfully generated my first .vsix files. These are what get distributed to the marketplace, eventually, but for now, I'll just post them here when we have updates. Work in Progress
- (4) The theme needs to be updated once the syntax highlighting is working as that creates the names of objects that can be colored. Work in progress
- (5) We need to add the compile and download mechanism yet. Setting it up and testing - Work in Progress. I've worked in vscode environments where it watches for file saves and then automatically compiles. This seems like what we want, right? (with downloads only attempted when compile succeeds, of course.)
I just wanted to indicate that progress is being made. If any of you happen to have experience building vscode extensions or happen to know someone that does that would be willing to help, please contact me. I'd welcome the help! Of course, I'll keep pushing on this.
I'm planning on doing the next release for us all to play with when I get (1) further along and (4) sync'd to it.
After that, I'll push new updates when we fix things we've found and/or as (2) and (5) get completed.
I'm using what I have so far, daily! It is getting better... it's just taking time!
You may want to review what vscode extensions you have installed and then remove any earlier versions. (They are likely "spin1", "spin2", and "spin-theme" in your extensions directory.)
Please let me know what you think of this so far. This should work pretty well with your favorite theme. I have included the "Spin2 IronSheep" theme which is what I use during verification of the work. It's pretty colorful so I can tell quickly which parts are working. However, this is what I'm also using day-2-day so it functions well.
Once you have this installed, then please take the time to find it in your list of installed extensions. Once you find it, you'll see three tabs on that page, please review them as I'll change the content there with each new release. They are "Details", "Feature Contributions" and "Changelog". Details has operational notes for you while the Changelog has specifics about what's working, what's not, problems we already know of, etc. Also, you'll see a list of things we are next working on. See it is things you'll want to review each time, right?
Alright. Enjoy! Please let me know if you like the progress so far and where it's heading.
This new version v0.2.0 complete's the Pasm2 and Spin2 language definition as well as add all Streamer constants and SmartPin constants.
Let's exercise this and please let me know if you see things that could/should be improved.
I'm taking a break now since this is fully functional to get back to my RGB LED Matrix driver and hopefully scheduling PCB production.
Meanwhile, you can advise what you think the priority for my next efforts on this extension should be from amongst items that are shown in the ChangeLog "Unreleased" section.
Please tell me which are most important to you in how you use vscode! If I'm missing something important, please note that for me too!
Congratulations Stephen
works nicely, outline is a great feature too!
Windows installation notes
Unzip file
Unzip the zip file to extract "spin2-?.?.?.vsix" and copy/move it to your windows %userprofile% folder (ie C:\Users\<username>\ so mine is C:\Users\Ray\ )
Install vscode extension (manually)
Open a windows command prompt (Start | Windows System | Command Prompt) C:\Users\Ray>
enter "code --install-extension spin2-?.?.?.vsix" without the double-quotes (replace the '?' wildcards with the version number)
Close the command prompt window and we're done.
Here is the command prompt dialog (note the warning)
Microsoft Windows [Version 10.0.18363.1139]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\Ray>code --install-extension spin2-0.2.0.vsix
Installing extensions...
(node:7652) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Extension 'spin2-0.2.0.vsix' was successfully installed.
C:\Users\Ray>
Stephen,
Just noticed that some color formatting is being lost, possibly due to nested if statements. See the attached jonnymac serial driver from line 398 onwards.
Just noticed that some color formatting is being lost, possibly due to nested if statements. See the attached jonnymac serial driver from line 398 onwards.
Thanks for the heads up! I've also found a couple of things. Give me a couple of days and I'll roll in updates... And by all means, keep reporting anything any of you find!
Just noticed that some color formatting is being lost, possibly due to nested if statements. See the attached jonnymac serial driver from line 398 onwards.
Well, that's a challenging case!
The issue is that "\" is recognized as a start of a string with a contained \" (escaped double quote) so the end of the string is not matched. I'm looking to see if I can build a stronger definition of strings that wouldn't suffer this issue. We'll see.
Ok, I adjusted the string recognizer to not look for escape sequences for now. I'll review how the spin language supports escape sequences and then try to match it.
For now, this gets us past the issue. v0.2.1 attached!
@Cluso99 not sure if this will still reach you but I'm now using a P2 and a P1 with VSC and the FlexProp tools. I have a code highlighter (entomy.spin) extension that works for .spin files and I'm searching around the web and forums for a way to also link the .spin2 filetype. It's confusing so far. I don't think you do it in the extension itself. Any ideas on that? I read something about adding to a settings.json file entry but couldn't get to the details.
IIRC there is a link in the first post to how i did it although i built on top of another’s work. But what Stephen has done is much better. Just go back thru this thread. I don’t recall much anymore.
@Cluso99 - I found the place for that language association setting. Just stumbled onto it after a lot of online searching failed me. At the lower right of the screen there's a little area for notifications, tweeting, choosing encoding modes, etc. In there is a selector for language association. I now have .spin2 files matched up with .spin so the code highlighter extension works for both. Maybe others already know this but it took me a while to find it.
We have used a different set of selections for spin vs spin2 as the languages are different.
Thanks for posting what you’re finding
Have you tried Stephens addon? Works nicely. It would be good to extend this to add the compilation options/button. Stephen is a bit preoccupied with the LED panels currently.
I haven't tried Stephen's add-on. I just took the one that popped up from the market place in the software and it seems to highlight the keywords, code blocks and maybe a couple other things, which seemed to be what I wanted. I added my own compile/run shell files to the VSC tasks and it seems to do just what I want. I guess I don't know what I'm missing, if anything. Plus I added the .spin to .spin2 connection I mentioned above.
Here's the first part of the tasks.json file from my VSC workspace. You're probably familiar with that, or can find it. "RunSpin" is what shows up in the pop up menu of tasks when you're working, and assigning to a keystroke. "flexrun.sh" is my UNIX shell command to do the compiling and running from the command line, and it receives the filename without extension from that ${} parameter in here. Let me know of any other questions. Some of those other parameters in there don't seem important, or even to do anything in my testing.
The spin extension I have from the Marketplace is by Entomy. I don't see any others. The one you mentioned involves getting from github and installing I guess. I didn't want to get into that level of learning yet. I'm finding enough to learn just patching together miscellaneous stuff to get software going for my P2 board.
My post a couple back shows how to add .spin2 recognition to the .spin VSC extension, but I also found where that is in the settings files, too, if you need that method.
Now (minor annoyance, not problem) I'm looking for a way to add recognition of __asm { } to the C/C++ extension I have from Microsoft. I get squiggly line warnings of non-recognition even though the actual code is fine. I've been poking around VSC and the internet with no luck so far. The __asm { } thing is a feature of Eric's FlexProp and not known by Microsoft's extension of course. So it's up to a wanna be gearhead to patch things together. Fun, but ......
Here's the previous tip so you don't have to dig it out.
At the lower right of the screen there's a little area for notifications, tweeting, choosing encoding modes, etc. In there is a selector for language association. I now have .spin2 files matched up with .spin so the code highlighter extension works for both.
Otherwise you can (Cmd-P on Mac) search for "language specific settings" and get into this .json, which is where it put my additional association apparently.
In this posting: https://forums.parallax.com/discussion/comment/1513993/#Comment_1513993 I described a tasks.json that does not require a flexrun.sh type of script. You do have to edit it a bit to customize it for your system, but should work without adding any scripts to your flexprop directory.
Comments
- (1) Language syntax highlighting - our SPIN2/PASM2 languages together have some 800ish keywords... I'm only partway done adding them. I have created the definition for the autoclose behavior for this language and that's working well. Work in progress
- (2) Outline navigation of the current file does not work for SPIN/PASM. I've started to add it but my initial attempt is not yet working. I found an example project to start from. This will probably be one, maybe two, pages of code. This is not a large effort. (it's written in TypeScript). Work in progress
- (3) I've been playing with packaging the extensions. I finally know how to, and have successfully generated my first .vsix files. These are what get distributed to the marketplace, eventually, but for now, I'll just post them here when we have updates. Work in Progress
- (4) The theme needs to be updated once the syntax highlighting is working as that creates the names of objects that can be colored. Work in progress
- (5) We need to add the compile and download mechanism yet. Setting it up and testing - Work in Progress. I've worked in vscode environments where it watches for file saves and then automatically compiles. This seems like what we want, right? (with downloads only attempted when compile succeeds, of course.)
I just wanted to indicate that progress is being made. If any of you happen to have experience building vscode extensions or happen to know someone that does that would be willing to help, please contact me. I'd welcome the help! Of course, I'll keep pushing on this.
I'm planning on doing the next release for us all to play with when I get (1) further along and (4) sync'd to it.
After that, I'll push new updates when we fix things we've found and/or as (2) and (5) get completed.
I'm using what I have so far, daily! It is getting better... it's just taking time!
Regards,
Stephen
I'm attaching the latest vscode extension. It's a zip file. Download it and unzip it.
Then you can do a manual install by using the command-line shown in these INSTALL instructions
You may want to review what vscode extensions you have installed and then remove any earlier versions. (They are likely "spin1", "spin2", and "spin-theme" in your extensions directory.)
Please let me know what you think of this so far. This should work pretty well with your favorite theme. I have included the "Spin2 IronSheep" theme which is what I use during verification of the work. It's pretty colorful so I can tell quickly which parts are working. However, this is what I'm also using day-2-day so it functions well.
Once you have this installed, then please take the time to find it in your list of installed extensions. Once you find it, you'll see three tabs on that page, please review them as I'll change the content there with each new release. They are "Details", "Feature Contributions" and "Changelog". Details has operational notes for you while the Changelog has specifics about what's working, what's not, problems we already know of, etc. Also, you'll see a list of things we are next working on. See it is things you'll want to review each time, right?
Alright. Enjoy! Please let me know if you like the progress so far and where it's heading.
Regards,
Stephen
Ken Gracey
Enjoy!
I'll let you know how it goes but it will not be until mid-week as I have to concentrate on getting some other things done while fitting in with work.
This new version v0.2.0 complete's the Pasm2 and Spin2 language definition as well as add all Streamer constants and SmartPin constants.
Let's exercise this and please let me know if you see things that could/should be improved.
I'm taking a break now since this is fully functional to get back to my RGB LED Matrix driver and hopefully scheduling PCB production.
Meanwhile, you can advise what you think the priority for my next efforts on this extension should be from amongst items that are shown in the ChangeLog "Unreleased" section.
Please tell me which are most important to you in how you use vscode! If I'm missing something important, please note that for me too!
Regards,
Stephen
works nicely, outline is a great feature too!
Windows installation notes
Unzip file
Unzip the zip file to extract "spin2-?.?.?.vsix" and copy/move it to your windows %userprofile% folder (ie C:\Users\<username>\ so mine is C:\Users\Ray\ )
Install vscode extension (manually)
Open a windows command prompt (Start | Windows System | Command Prompt)
C:\Users\Ray>
enter "code --install-extension spin2-?.?.?.vsix" without the double-quotes (replace the '?' wildcards with the version number)
Close the command prompt window and we're done.
Here is the command prompt dialog (note the warning)
Just noticed that some color formatting is being lost, possibly due to nested if statements. See the attached jonnymac serial driver from line 398 onwards.
Thanks for the heads up! I've also found a couple of things. Give me a couple of days and I'll roll in updates... And by all means, keep reporting anything any of you find!
Well, that's a challenging case!
The issue is that "\" is recognized as a start of a string with a contained \" (escaped double quote) so the end of the string is not matched. I'm looking to see if I can build a stronger definition of strings that wouldn't suffer this issue. We'll see.
For now, this gets us past the issue. v0.2.1 attached!
Installed v0.2.1 today.
Noticed this problem - maybe another case of "\" ???
---
No mascot today.
Erco why is there a mountain lion studying your car?
I'll bet you are correct! Sigh...
This will be a couple of days. I'm trying to get my Hub75 driver into P2 Obex later this week. I'll look at this after.
Thanks for the testing, use, and heads up! Please keep reporting anything you find.
Enjoy!
and just this line
Thanks for posting what you’re finding
Have you tried Stephens addon? Works nicely. It would be good to extend this to add the compilation options/button. Stephen is a bit preoccupied with the LED panels currently.
I didn't realise it didn't do .spin files as I just tried.
Perhaps you could detail how you added the compile/run tasks here please
The spin extension I have from the Marketplace is by Entomy. I don't see any others. The one you mentioned involves getting from github and installing I guess. I didn't want to get into that level of learning yet. I'm finding enough to learn just patching together miscellaneous stuff to get software going for my P2 board.
My post a couple back shows how to add .spin2 recognition to the .spin VSC extension, but I also found where that is in the settings files, too, if you need that method.
Now (minor annoyance, not problem) I'm looking for a way to add recognition of __asm { } to the C/C++ extension I have from Microsoft. I get squiggly line warnings of non-recognition even though the actual code is fine. I've been poking around VSC and the internet with no luck so far. The __asm { } thing is a feature of Eric's FlexProp and not known by Microsoft's extension of course. So it's up to a wanna be gearhead to patch things together. Fun, but ......
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "RunSpin",
"type": "shell",
"command": "flexrun.sh ${fileBasenameNoExtension}",
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"problemMatcher": []
},
{
"label": "RunSpin2",
"type": "shell",
"command": "flexrun2.sh ${fileBasenameNoExtension}",
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"problemMatcher": []
},
At the lower right of the screen there's a little area for notifications, tweeting, choosing encoding modes, etc. In there is a selector for language association. I now have .spin2 files matched up with .spin so the code highlighter extension works for both.
Otherwise you can (Cmd-P on Mac) search for "language specific settings" and get into this .json, which is where it put my additional association apparently.
{
"workbench.colorTheme": "Default Light+",
"files.autoSave": "off",
"explorer.confirmDelete": false,
"files.associations": {
"*.spin2": "spin"
},
"[c]": {
"editor.wordBasedSuggestions": false,
"editor.suggest.insertMode": "replace",
"editor.semanticHighlighting.enabled": true
}
}
dgately