VS Code + Mudlet scripts development

Post Reply
Dargoth
Posts: 5
Joined: Thu Oct 29, 2020 12:08 pm

VS Code + Mudlet scripts development

Post by Dargoth »

Hey,

I've been trying to improve my developer experience while coding scripts for Mudlet. Since my scripts are extracted to .lua files and I keep my .xml content as minimal as possible I can leverage IDE power to do so. I was using (as for my daily work) Intellij Idea, although LUA support there feels a bit messy, regardless of plugin you chose. Recently I've been doing a lot work with own DSL created in Xtext and Eclipse Theia as IDE. Theia is web IDE based on Monaco Editor, hugely inspired (base) by VS Code (to that extent that VS code extensions can be used in Theia). While developing language server extension I gave VS Code a test ride. Although in terms of Java development it's not as powerful as Intellij, I tried LUA there. Right on spot. With LUA language server extension works far better, better go to definition etc. So I started do write language server for mudlet... which proved a bit problematic cranky, but not impossible to have two language servers give proposals. I've added few Mudlet api functions definitions and was going to import rest of them. Then I thought... well this is futile... I've just copied .lua files used for doc generation (github . com/Mudlet/Mudlet/tree/development/src/mudlet-lua/lua) to my project without including them in loader.
vs1.png
vs1.png (38.15 KiB) Viewed 6457 times
vs2.png
vs2.png (11.94 KiB) Viewed 6457 times
If there is more interest in the topic I can try to actually set up some package + description for development using .lua files.
I have converter to automate process of XML extraction to .lua files, so if anyone is interested I can try to make it more generic.

User avatar
demonnic
Posts: 720
Joined: Sat Dec 05, 2009 3:19 pm

Re: VS Code + Mudlet scripts development

Post by demonnic »

I'm definitely interested in the extraction from xml portion. I've got muddlet creating the xml fine but never found the time to do the reverse particularly well.

Though I'd want to go as far as pulling triggers/aliases/etc into the json format eventually. I just have too many irons in too many fires.

Dargoth
Posts: 5
Joined: Thu Oct 29, 2020 12:08 pm

Re: VS Code + Mudlet scripts development

Post by Dargoth »

Little update on the matter, after some Discord discussion.

I've mentioned before VS Code Lua extension.

You can set Mudlet instalation dir (or in matter of fact any other dir with .lua files inside) as lib directory.

While Mudlet running get path:

```lua lfs.currentdir()```
And set this path in setting `Lua.workspace.library`
Capture.png
Capture.png (3.85 KiB) Viewed 6452 times
Not sure about Mac and Linux right now. You can always download .lua files that I've mentioned before and point to another directory that they will reside in.

I will try to automate docs retrieval from Wiki, since those files might be outdated. But oh, well, so far better than nothing ;)



Demonic, I will try to generify my app to extract .xml
Be aware that it extracts only scripts, aliases and triggers. Didn't have need to add keybindings and timers.

Dargoth
Posts: 5
Joined: Thu Oct 29, 2020 12:08 pm

Re: VS Code + Mudlet scripts development

Post by Dargoth »

Just head to https://github.com/Delwing/mudlet-docs
I've prepared package of` .lua` files with some basic instruction for VS Code.

Package is extracted directly from predefined pages in Mudlet Wiki. Geyser is not covered atm.

Post Reply