rescript-vscode
rescript-vscode copied to clipboard
No hover type hint for variables
I think there should be a hint, e.g. greeting is string, but nothing poped up.
It can auto-complete external keyword as expected.

Rescript compiler works properly.

I'm new to rescript and not sure I installed the extension properly. I use yarn 2 thus no node_modules in the working directory, and find executables in .yarn subdirectory.
vscode setting.json:
{
"rescript.settings.binaryPath": "[proj_name]\\.yarn\\unplugged\\rescript-npm-9.1.4-75c65d01e7\\node_modules\\rescript",
"rescript.settings.autoRunCodeAnalysis": true
}
bsconfig.json:
{
"name": "proj_name",
"sources": [
{
"dir": "src",
"subdirs": true
}
],
"package-specs": [
{
"module": "es6",
"in-source": true
}
],
"suffix": ".bs.js",
"bs-dependencies": []
}
package.json:
{
"name": "proj_name",
"packageManager": "[email protected]",
"devDependencies": {
"rescript": "^9.1.4"
},
"scripts": {
"re:build": "rescript",
"re:start": "rescript build -w"
}
}
System info: 版本: 1.70.1 (user setup) 提交: 6d9b74a70ca9c7733b29f0456fd8195364076dda 日期: 2022-08-10T06:08:33.642Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19044
extension version: v1.4.2
Make sure the file was saved before trying to hover. If it was saved, start with an empty project that only contains those 2 lines, se if the issue is still there.
The file was saved.
I did other trials
- clone https://github.com/rescript-lang/rescript-project-template
yarn# install, using yarn 1 here, withnode_modules- leave "rescript.settings.binaryPath" empty
Then the hover hint appears.
- clone template again
yarn set version berry# swap to yarn 2, plug'n'playyarn -v# 3.2.2yarn# install without node_modules- set "rescript.settings.binaryPath" to "D:\Github\rescript-project-template\.yarn\unplugged\rescript-npm-9.1.4-75c65d01e7\node_modules\rescript"
- click 'start build' in the popup Then no hover hint.
3rd round:
- clone template again
yarn# install deps using yarn 1 with node_modules- set "rescript.settings.binaryPath" to "D:\Github\rescript-project-template\node_modules\.bin" Then hover hint work for the template, but NOT for other projects managed by yarn 2
Maybe the extension is not compatible with yarn 2?
We have no windows devs, so these are always tricky. It would be good to at some point have someone who can build the extension from source on Windows and begin debugging these very basic cases.
Can you try the pre-release version of the extension?
Can you try the pre-release version of the extension?
nothing changes
I tested it in wsl with yarn 2. NO hover hint still.
- clone template again
yarn set version berry# swap to yarn 2, plug'n'playyarn -v# 3.2.2yarn# install without node_modules- set "rescript.settings.binaryPath" to "D:\Github\rescript-project-template.yarn\unplugged\rescript-npm-9.1.4-75c65d01e7\node_modules\rescript"
- click 'start build' in the popup Then no hover hint.
Before we have a fix, can you try https://github.com/reason-seoul/yarn-plugin-rescript and check if the extension works with that?
@fhammerschmidt it seems to have issue, too. https://github.com/reason-seoul/yarn-plugin-rescript/issues/14
Ok, I guess the plugin is not compatible with Windows (or your setup).
Alternatively:
Can you set nodeLinker to node-modules in your .yarnrc.yml?
See: https://yarnpkg.com/configuration/yarnrc#nodeLinker
Then the extension should work without setting the binary path manually. However it disables pnp.
@fhammerschmidt ah, that works
Just to clarify: It does not make sense for the extension to support yarn PnP yet, when even the compiler does not: https://github.com/rescript-lang/rescript-compiler/issues/3276
As soon as you add some dependencies, you will have all kinds of issues.
Closing this since there's nothing actionable for us here for now.