Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ABB robot programming language RAPID #97

Open
swejmansson opened this issue Dec 5, 2018 · 26 comments · Fixed by #103
Open

Support for ABB robot programming language RAPID #97

swejmansson opened this issue Dec 5, 2018 · 26 comments · Fixed by #103
Assignees
Labels

Comments

@swejmansson
Copy link

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

@DaGhostman
Copy link
Owner

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?

@swejmansson
Copy link
Author

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"
}
],
`

@DaGhostman
Copy link
Owner

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.

@swejmansson
Copy link
Author

Guess you are busy 😄
Let me know if you want me to specify anything to make it easier for you 👍

@DaGhostman
Copy link
Owner

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 😔

@swejmansson
Copy link
Author

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

@DaGhostman
Copy link
Owner

DaGhostman commented Apr 10, 2019

Hey sorry for the delay, but I think it might be worth it 🙂 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 DaGhostman self-assigned this Apr 10, 2019
@swejmansson
Copy link
Author

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.

@DaGhostman
Copy link
Owner

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

@swejmansson
Copy link
Author

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)

@DaGhostman
Copy link
Owner

DaGhostman commented Apr 15, 2019

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

@swejmansson
Copy link
Author

You got me on track and moved it back 😄

Running the RC:
image

But nothing will show up 🤔 :
image

Refresh wont help...

@DaGhostman
Copy link
Owner

Because I am an idiot 😆 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 []

@swejmansson
Copy link
Author

We take turns being an idiot, fine for me 😆
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 🤔

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

@DaGhostman
Copy link
Owner

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

@swejmansson
Copy link
Author

Still not working, really strange 🤔
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.....

@DaGhostman
Copy link
Owner

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
Copy link
Owner

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

@swejmansson
Copy link
Author

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
Copy link
Author

Any news? Something I should test for you?

@DaGhostman
Copy link
Owner

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

@DaGhostman
Copy link
Owner

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

@swejmansson
Copy link
Author

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

@DaGhostman DaGhostman reopened this Sep 2, 2019
@DaGhostman
Copy link
Owner

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 👍. 🍺 because you have a ton of patience :)

@swejmansson
Copy link
Author

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 👍

@BilalArslanTr
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants