rune icon indicating copy to clipboard operation
rune copied to clipboard

Rework vscode extension

Open SWW13 opened this issue 3 years ago • 1 comments

Following the suggestion in #407 this is a complete rework of the vscode extension based on the rust-analyzer extension code.

This should at least fix the usage over ssh connection and other non-local as the deprecated globalStoragePath is no longer used. It also looks like the current extension is not working at all, at least for me. I won't investigate why.

In case someone wants to test the new extension (and the fixed rune-languageserver), I pre-built the binary (linux only) and the extension:

SWW13 avatar Aug 10 '22 15:08 SWW13

I won't investigate why.

Goooood call!

Once I've given it a run over to make sure everything works as intended on my end as well I expect to merge this straight up. Thank you for doing this!

udoprog avatar Aug 10 '22 18:08 udoprog

This looks good and runs perfectly for me :tada:

For anyone else:

yarn install
yarn package

Then open vscode with editors/code and run the Run Extension task. You should be getting a developer window.

The only thing I was lacking was a launch configuration, so I took a basic one from the yo code project I set up. With it you can run the extension in a development host (and yarn watch in the background to reload) which greatly simplifies development. I'm also not very familiar with yarn so there was some confusion on my part where I used it and npm interchangeably which vscode extension development didn't like.

I also relaxed the vscode requirement from 1.70.0 to 1.66 which is the same as rust-analyzer uses (I currently use 1.69 which gave me a headache), since that is where most of the code comes from it should be compatible.

One nit that I'd like to fix before this plugin is uploaded is that file icons uses the extension icon, which aren't designed to be icons and look kinda ugly. But this is not a blocker for merging.

image

Thank you for the work!

udoprog avatar Aug 11 '22 11:08 udoprog

If you copied over the vscode launch configuration from yo you should make sure it's for a type script project with yarn and webpack enabled, otherwise the debugging isn't working as expected.

Also the Rune: Restart server command throws some errors and I don't know how to fix them, but it does restart the server - so better than nothing.

SWW13 avatar Aug 11 '22 12:08 SWW13

The file icon(s) are set in https://github.com/rune-rs/rune/blob/75e44cbbbefe00eab9771386bda8e8af34c3f033/editors/code/package.json#L42-L45 and can be removed.

SWW13 avatar Aug 11 '22 12:08 SWW13

Great! Someone artistically inclined will have to design rune icons. At least something which doesn't quite pop out as much as these yellow ones.

I think I picked the right yo configuration: yarn and webpack. Despite the "type": "npm" in the tasks.json it seems like vscode auto-detects the flavor by the lock file that is present. I got a warning when multiple different kinds of lockfiles were used in the same project.

udoprog avatar Aug 11 '22 12:08 udoprog

Also the Rune: Restart server command throws some errors and I don't know how to fix them, but it does restart the server - so better than nothing.

What's the error? Might be that the languageserver itself doesn't understand how to perform an orderly shutdown yet.

udoprog avatar Aug 11 '22 12:08 udoprog

Despite the "type": "npm" in the tasks.json [...]

Same for me, should be fine I guess.

What's the error? Might be that the languageserver itself doesn't understand how to perform an orderly shutdown yet.

[Error - 14:14:08] Stopping server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097

Probably due to the heavy adoption from the rust-analyzer code our extension does to much things different and the dispose of object got out of the expected order.

SWW13 avatar Aug 11 '22 12:08 SWW13