vscode-tree-view icon indicating copy to clipboard operation
vscode-tree-view copied to clipboard

Support for ABB robot programming language RAPID

Open swejmansson opened this issue 6 years ago • 26 comments

Have have been programming/editing robot programs for many years. Used ABB RobotStudio for online editing, for offline i have used UltraEdit and Notepad++. Now I started using Visual Studio Code for programming Arduino and other small controllers. Found some plugins for RAPID and tried it out. Works great, or at least almost..... It is possible to drag a backup(folder) into VSCode and then use the Explorer to navigate down to the .mod-file. File opens and highlighting etc is working fine. image

In UltaEdit it is possible to view a "function list", this list show all procedures and it is possible to go direcly to that part/Procedure: image

Would it be possible to achieve this with "File Tree View"?

The functions that are use are: PROC, LOCAL PROC, TRAP, FUNC and RECORD

swejmansson avatar Dec 05 '18 15:12 swejmansson

Thanks for opening the ticket, I would be glad to add support for it, could you just provide me with a reference documentation or snippets that I can use for testing out the implementation?

DaGhostman avatar Dec 07 '18 09:12 DaGhostman

To save some time I have recorded a short clip. I´m explaining some stuff regarding RAPID structure and also show what I have managed to do with another extension(Code Map). https://youtu.be/6deoocggj3g

The zip contains some sample files you can use to do tests. When you have questions, just shoot :-D BackupFolderExample.zip

To config Code Map I added this to the settings: ` // Regex-based definition of the mapping rules for ABB RAPID syntax. "codemap.mod": [ { "pattern": "MODULE (.)", "clear": "", "suffix": "", "icon": "class" }, { "pattern": "LOCAL PROC (.)[()]", "clear": "", "suffix": "", "icon": "level2" }, { "pattern": "PROC (.)[()]", "clear": "", "suffix": "", "icon": "level1" }, { "pattern": " TRAP (.)", "clear": "", "suffix": "", "icon": "function" }, { "pattern": "FUNC (.)[()]", "clear": "", "suffix": "", "icon": "function" }, { "pattern": " RECORD (.)", "clear": "", "suffix": "", "icon": "function" } ],

"codemap.sys": [ { "pattern": "MODULE (.)", "clear": "", "suffix": "", "icon": "property" }, { "pattern": "LOCAL PROC (.)[()]", "clear": "", "suffix": "", "icon": "property" }, { "pattern": "PROC (.)[()]", "clear": "", "suffix": "", "icon": "property" }, { "pattern": " TRAP (.)", "clear": "", "suffix": "", "icon": "property" }, { "pattern": "FUNC (.)[()]", "clear": "", "suffix": "", "icon": "property" }, { "pattern": " RECORD (.)", "clear": "", "suffix": "", "icon": "property" } ],

"codemap.cfg": [ { "pattern": "(.*)[:]", "clear": "", "suffix": "", "icon": "property" } ], `

swejmansson avatar Dec 10 '18 13:12 swejmansson

Thank you very much for the detailed info. I am confident that I will have more time around the end of the week so I can work on the extension as recently work has piled up.

DaGhostman avatar Dec 19 '18 14:12 DaGhostman

Guess you are busy :smile: Let me know if you want me to specify anything to make it easier for you :+1:

swejmansson avatar Jan 23 '19 13:01 swejmansson

I am absolutely sorry for the delay, I am extremely busy in the past couple of months ... I haven't forgotten about the request and will try to make it asap 😔

DaGhostman avatar Jan 23 '19 16:01 DaGhostman

No problem, take your time, I have a temporary solution, no hurry

swejmansson avatar Feb 27 '19 15:02 swejmansson

Hey sorry for the delay, but I think it might be worth it :slightly_smiling_face: I have managed to workout an MVP support which I will probably try to release by the end of the week.

Here is a small video with how it looks like atm, please feel free to share any feedback you might have I will happily consider/discuss any suggestions

DaGhostman avatar Apr 10 '19 14:04 DaGhostman

I'm not in a hurry, stay cool :-D Looking good! Looks like it does what i should, don't have any feedback right now. When you have released I will try it out.

swejmansson avatar Apr 12 '19 08:04 swejmansson

I did a few small tweaks & fixes, could you install this preview version of the extension and check it out if it makes sense. Namely the handling of LOCAL FUNC and TRAP are what I am concerned about, but since I have no knowledge about RAPID I don't think I will be able to take a good informed decision

If you have time that is

DaGhostman avatar Apr 15 '19 11:04 DaGhostman

Looking forward to try it out but ended up in a strange problem.... TREE extension will not show up in explorer if I install a version higher than 2.3.1. I have tried several versions but it just wont show up? Have disabled all other extension. Tried to start VScode as administrator, no luck. Am I doing something wrong? Any ideas what to try? Try another computer/installation? Make a reinstall of VScode?

With 2.3.1(OK): image

With 2.4.0(NOK): image

With 2.6.0(NOK): image

(After update/install of new version restart was done)

swejmansson avatar Apr 15 '19 13:04 swejmansson

Note that there is an < > icon on the ~right~ left, that is the icon for the extension. Although as part of the RC there is a configuration which you can use to move it back to the explorer view.

Look for "treeview.location" in settings editor - sidebar is the new icon on the activity bar, and explorer is the behavior you had previously under explorer

DaGhostman avatar Apr 15 '19 13:04 DaGhostman

You got me on track and moved it back :smile:

Running the RC: image

But nothing will show up :thinking: : image

Refresh wont help...

swejmansson avatar Apr 15 '19 14:04 swejmansson

Because I am an idiot :laughing: you will need to add rapid to your vscode config to enable the functionality, "treeview.allowedProviders" is the key, and in order to enable just rapid add ["rapid"] or alternatively to enable all set the value to []

DaGhostman avatar Apr 15 '19 14:04 DaGhostman

We take turns being an idiot, fine for me :laughing: I have the RC active: image

Have added "treeview.allowedProviders" but can´t get it to work with rapid. Changed the file type of settings.json from jsonc to json, then tree is updated. Added jsonc to "treeview.allowedProviders" but it will not update tree. Same case as with rapid :thinking:

From my tests..... (I have restarted vscode every time i have made changes to settings.json)

Tree updating with json: image

Not updating with jsonc: image

Not updating rapid: image

If removing json it obviously wont update json: image

swejmansson avatar Apr 17 '19 09:04 swejmansson

:thinking: Could you try this RC to see if it works now, cuz I have the slight suspicion I might've build against the wrong branch. and I have removed the need for allowedProvidres configuration, so regardless of what you have in there you should see the tree displayed.

DaGhostman avatar Apr 23 '19 14:04 DaGhostman

Still not working, really strange :thinking: I have RC2 installed: image

Still no tree when opening a .mod recognized as rapid: image

Looks like the "allowedProviders" is not functional any more, if i remove json it will still show in tree: image

I have tried to disable all other extensions, no luck. Can it be a conflict with other extensions?: image

Also tried to run vscode as admin, no luck.....

swejmansson avatar Apr 24 '19 09:04 swejmansson

it is pretty strange I can't reproduce the case. I am using the code sample you have provided, but it seems to be working correctly on my side with both RCs.

Looks like the "allowedProviders" is not functional any more, if i remove json it will still show in tree

This is because there is a check if the file is dirty, in order to prevent attempting to parse a file which is in invalid state while you type. The tree should update once you save the changes.

have tried to disable all other extensions, no luck. Can it be a conflict with other extensions?:

I've had this previously occur, but I can't recall for which language. Although then in the new view it was saying something like "No provider registered" or smth.

I've managed to reproduce the case, when I changed the file language from rapid to something else, then the view was not updated, but when I clicked on the refresh action it rendered properly. Another thing that you can try is opening another file and cycling between the files to see if it gets things going or not (although there is a slight chance it should've happened already when you switched to settings.json and back)

DaGhostman avatar Apr 24 '19 10:04 DaGhostman

I will try to see if I can get the issue to reproduce on my end so I could fix it

DaGhostman avatar Apr 24 '19 10:04 DaGhostman

I have tried opening the sample files and also "real" rapid files. No luck. Also switch between them, restarted vscode. Let me know when you have come up with something to try.

swejmansson avatar Apr 24 '19 13:04 swejmansson

Any news? Something I should test for you?

swejmansson avatar May 28 '19 14:05 swejmansson

Sorry, I didn't have enough time, I will try to investigate today to see if I could come up with something

DaGhostman avatar Jul 15 '19 16:07 DaGhostman

Hey I was looking for a way to get in touch, can you proved any feedback if the abb support is working prooerly?

DaGhostman avatar Jul 21 '19 12:07 DaGhostman

Hey, sorry for not answering! Got back to work from vacation and now have some time to continue. Migrated my computer from win7 to win10 and installed VScode. Have tested the latest published version(2.7.0) and also the previous RCs you sent in this issue thread. No luck.... Uninstalled VSCode and recorded a movie showing re-installation and opening the example rapid file, also example .json and a .js file. Tree view is not working for rapid but for the others...

Have a look HERE

Had a look in the rapid.js which is more or less mumbo jumbo for me but I noticed "return langId === "rapid";" is written "rapid" with lower case. Noticed there are two extensions for Rapid. One of them shows "rapid" in down right corner and the other "RAPID". None of them work....

swejmansson avatar Sep 02 '19 14:09 swejmansson

Hey, no worries, thanks for your feedback, I am reopening the issue and will give it another shot, maybe I missed something along the way, I will keep you updated as much as I can with any progress I manage to make on this one :+1:. :beer: because you have a ton of patience :)

DaGhostman avatar Sep 02 '19 14:09 DaGhostman

Sounds great! No problem for me to wait 😄 Pretty sure you will find that last missing thing, let me know when you have something for me and I will try it 👍

swejmansson avatar Sep 02 '19 14:09 swejmansson

Have have been programming/editing robot programs for many years. Used ABB RobotStudio for online editing, for offline i have used UltraEdit and Notepad++. Now I started using Visual Studio Code for programming Arduino and other small controllers. Found some plugins for RAPID and tried it out. Works great, or at least almost..... It is possible to drag a backup(folder) into VSCode and then use the Explorer to navigate down to the .mod-file. File opens and highlighting etc is working fine. image

In UltaEdit it is possible to view a "function list", this list show all procedures and it is possible to go direcly to that part/Procedure: image

Would it be possible to achieve this with "File Tree View"?

The functions that are use are: PROC, LOCAL PROC, TRAP, FUNC and RECORD

BilalArslanTr avatar Mar 08 '24 23:03 BilalArslanTr