yaml-language-server
yaml-language-server copied to clipboard
Deno (javascript/typescript runtime) support
Is your enhancement related to a problem? Please describe.
This enhancement is not related to a problem, but from curiosity. I expect quicker performance using Deno instead of Node.js especially regarding regular expressions.
Describe the solution you would like
The following patch seems to work:
diff --git a/bin/yaml-language-server b/bin/yaml-language-server
index d1dbeee..33f0c01 100755
--- a/bin/yaml-language-server
+++ b/bin/yaml-language-server
@@ -1,3 +1,3 @@
-#!/usr/bin/env node
+#!/usr/bin/env -S deno run --unstable --compat --allow-env --allow-read
require('../out/server/src/server.js');
Which is then used by existing vim-lsp and vim-lsp-settings plumbing.
Perhaps in an alternate bin/yaml-language-server-deno script? But then there would be an issue with clients having to be configured to point to that. EDIT: Some sort of configurable abstraction on top would resolve that.
It works, I'm able to briefly retrieve hovers with vim-lsp client. However yaml-language-server consistently exits after 4 seconds, maybe a timeout on retrieval of the schema store as I didn't grant Deno net permissions (a guess).
EDIT: --allow-net didn't work.
Nothing obvious in log, just:
Tue 18 Oct 2022 01:24:18 PM MDT:["s:on_exit",2,"yaml-language-server","exited",1]
From what I gather this --unstable configuration of Deno is argued to be experimental and not ready for production environments.
Describe alternatives you have considered
First I used yarn to retrieve yaml-language-server and dependencies, then used the Deno runtime.
An alternative would be to try the experimental npm support in Deno? This is all new to me I don't have any background experience with JavaScript to be frank. Just putting this out there in case anyone else may be interested.
I am not sure if there is enough user interest to support Deno at the moment. Keeping this request to see further interest.