redhat-developer / redhat-developer/yaml-language-server

Deno (javascript/typescript runtime) support

Open
#794 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bin/yaml-language-server and the existing vim-lsp and vim-lsp-settings plumbing. Run the server under Deno using the proposed permissions and investigate why it exits after retrieval; done means Deno support is configurable and the language server remains running for client requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
deno, node.js, typescript
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.