rhaiscript / lsp

Language server for Rhai.
Apache License 2.0
43 stars 4 forks source link

Rhai Panel #7

Closed tamasfe closed 2 years ago

tamasfe commented 2 years ago

Show a dedicated VSCode activity panel for Rhai.

Things to display:

tamasfe commented 2 years ago

The syntax tree has been implemented:

https://user-images.githubusercontent.com/25967296/136081912-75d30280-4467-486a-9f39-e8bd37f99e29.mp4

tamasfe commented 2 years ago

I cannot find a legitimate use-case right now, other than the syntax tree, which is useful only for development.

schungx commented 2 years ago

How do I install the lsp server to try this out?

tamasfe commented 2 years ago

https://github.com/rhaiscript/lsp#contributing These should be enough from the master branch, tell me if something doesn't work.

schungx commented 2 years ago

Unfortunately my primary machine is Windows... do you have a workflow for building it on Windows?

tamasfe commented 2 years ago

Unfortunately I don't have access to windows atm, the commands should be the same though.

You'll need to have nodejs installed.

From that step the setup is pretty much:

npm install --global yarn
npm install --global vsce

Then in the editors/vscode directory:

yarn install
vsce package --no-yarn
code --install-extension --force rhai-0.0.0.vsix

The last command just installs the .vsix extension file in vscode, there are other methods to do that if that fails.

As for the language server, it's just a cargo binary cargo install --path crates/lsp --debug.

But yeah, I haven't tested any of this, I'll get a windows vm at some point in the next days.

schungx commented 2 years ago

Do I have to turn off the Rhai syntax highlighting extension first?

tamasfe commented 2 years ago

Do I have to turn off the Rhai syntax highlighting extension first?

The syntax highlight will conflict but the rest should be fine.

schungx commented 2 years ago

I see that you keep a grammer file there for syntax highlighting. That should work as well as my own, probably even better as I based mine on a JavaScript grammer.

tamasfe commented 2 years ago

Yes, I wanted to incorporate type hints let a: Type into yours but it ended up being easier to write a new one with that in mind. It's partially based on typescript's syntax rules.