[ANN] vim-rescript 2.0.0 release

Hey everyone,

We just released vim-rescript@2.0.0 as a follow-up to our newest rescript-vscode release.

What’s new

  • Supports our new rescript npm package (alongside bs-platform based projects)
  • We also upstreamed the latest rescript-vscode server for coc usage

Please note that there are some small breaking changes!
Make sure to read our Changelog for all the upgrade steps after installation.

Installation

For vim-plug in your vimrc:

Plug 'rescript-lang/vim-rescript', {'tag': 'v2.0.0'}

Source your file and then run :PlugInstall to trigger the installation.


Please report any bugs / issues in our issue tracker.

Enjoy!

6 Likes

Not sure if it’s actually an issue or if there is something that I did wrong. After updating and updating coc configuration the server crashed. I tried running the server with node and got this

Error: Cannot find module 'vscode-jsonrpc/node'

I did npm install inside the server dir and the server started working. But I’m not sure if it’s actually working. It doesn’t crash but hover doesn’t work (hover not found), :RescriptTypeHint and :RescriptJumpToDefinition fails with Type Info failed with exit code '127'.
:RescriptInfo results in

ReScript version: 9.0.2                                                                                                                                                
Editor mode: legacy (using bsc / bsb instead of rescript)                                                                                                              
Detected Config File: ~/projects/tan/tan-website-uk/bsconfig.json                                                                                
Detected Project Root: xxx/bsconfig.json                                                                                             
Detected rescript_analysis_exe: ~/.config/nvim/plugged/vim-rescript/server/analysis_binaries/darwin-run.exe                                      
Detected rescript_bsc_exe: xxx/node_modules/bs-platform/darwin/bsc.exe                                                 
Detected rescript_bsb_exe: xxx/node_modules/bs-platform/darwin/bsb.exe                                                 
Bundled rescript server version: 1.1.1   

Okay thanks, we noticed some problems with module hoisting of vscode-jsonrpc (I KNEW this dependency is going to bite us when someone proposed to add just this small dependency for some additional functionality, lol)

Gonna release a patch today.

2 Likes

@alexeygolev Can you try this version?

Hope this works on your machine now!

@ryyppy Patch 2.0.1 works for me :+1:, while 2.0.0 didn’t.

I’m trying to make an ALE linter that I’d like to share with the community to complement CoC. For that I’m trying to use --stdio as suggested here Neovim LSP support · Issue #20 · rescript-lang/vim-rescript · GitHub but I am getting this error:

internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'vscode-jsonrpc/node'
Require stack:
- /home/joakin/.vim/plugged/vim-rescript/server/node_modules/vscode-languageserver-protocol/lib/node/main.js
- /home/joakin/.vim/plugged/vim-rescript/server/out/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/joakin/.vim/plugged/vim-rescript/server/node_modules/vscode-languageserver-protocol/lib/node/main.js:18:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/joakin/.vim/plugged/vim-rescript/server/node_modules/vscode-languageserver-protocol/lib/node/main.js',
    '/home/joakin/.vim/plugged/vim-rescript/server/out/server.js'
  ]
}

I’ve tried npm installing in the vim-rescript dir, but didn’t fix it. Is stdio supported in this version?

This is how I’m configuring the LSP command:

node ~/.vim/plugged/vim-rescript/server/out/server.js --stdio

Thanks a lot for all your efforts :open_hands:

Still fails for me with

Error: Cannot find module 'vscode-jsonrpc/node'

If I npm install manually inside the server dir the functionality is there so that’s good.

But installation still fails. While installing vim-plug seems to take some time when installing vim-rescript and it doesn’t seem to fail but unless I npm install manually it doesn’t work

i wonder what’s different between my, @joakin’s and your machine, since I literally committed the npm installed deps into version control, and I have no idea why it should behave differently…

Can you show the git diff in your working vim-rescript folder? (maybe let’s discuss this further in the PR?)

I tried 2.0.1 and I also get the same issue where I need to npm install in the server directory. It looks like before doing that, nothing works (syntax highlighting, commands). Everything is working fine after installing.

I use vim-plug and at first just did an update, then completely removed it with a fresh install, but both times I ran into the issue. My git diff after an npm install is

diff --git a/server/node_modules/.package-lock.json b/server/node_modules/.package-lock.json
index 9cf4343..af11c20 100644
--- a/server/node_modules/.package-lock.json
+++ b/server/node_modules/.package-lock.json
@@ -42,7 +42,6 @@
                        "dependencies": {
                                "anymatch": "~3.1.1",
                                "braces": "~3.0.2",
-                               "fsevents": "~2.3.1",
                                "glob-parent": "~5.1.0",
                                "is-binary-path": "~2.1.0",
                                "is-glob": "~4.0.1",
diff --git a/server/node_modules/vscode-languageserver/package.json b/server/node_modules/vscode-languageserver/package.json
index 701cc36..2610f88 100644
--- a/server/node_modules/vscode-languageserver/package.json
+++ b/server/node_modules/vscode-languageserver/package.json
@@ -32,8 +32,4 @@
                "test": "node ../node_modules/mocha/bin/_mocha",
                "preversion": "npm test"
        }
-
-,"_resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz"
-,"_integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw=="
-,"_from": "vscode-languageserver@7.0.0"
-}
\ No newline at end of file
+}
diff --git a/server/package-lock.json b/server/package-lock.json
index b3eef5d..4d24643 100644
--- a/server/package-lock.json
+++ b/server/package-lock.json
@@ -56,7 +56,6 @@
                        "dependencies": {
                                "anymatch": "~3.1.1",
                                "braces": "~3.0.2",
-                               "fsevents": "~2.3.1",
                                "glob-parent": "~5.1.0",
                                "is-binary-path": "~2.1.0",
                                "is-glob": "~4.0.1",

Git diff won’t be helpful unfortunately. Here are my findings

1 Like

Further discussions regarding fixing this issue can be found in the 2.0.1 PR.

1 Like

New bugfix release 2.0.1 is now ready.

vimrc

Plug 'rescript-lang/vim-rescript', {'tag': 'v2.0.1'}

After that, run :PlugInstall and :PlugUpdate and you should be set (hopefully).

If there’s any problems, please create an issue on our issue tracker.

2 Likes