Skip to content

No hover type hint for variables #550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sym233 opened this issue Aug 12, 2022 · 12 comments
Closed

No hover type hint for variables #550

sym233 opened this issue Aug 12, 2022 · 12 comments

Comments

@sym233
Copy link

sym233 commented Aug 12, 2022

image
I think there should be a hint, e.g. greeting is string, but nothing poped up.

It can auto-complete external keyword as expected.
image

Rescript compiler works properly.
image

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

@cristianoc
Copy link
Collaborator

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.

@sym233
Copy link
Author

sym233 commented Aug 12, 2022

The file was saved.

I did other trials

Then the hover hint appears.

  • clone template again
  • yarn set version berry # swap to yarn 2, plug'n'play
  • yarn -v # 3.2.2
  • yarn # 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?

@cristianoc
Copy link
Collaborator

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.

@zth
Copy link
Collaborator

zth commented Aug 12, 2022

Can you try the pre-release version of the extension?

@sym233
Copy link
Author

sym233 commented Aug 12, 2022

Can you try the pre-release version of the extension?

nothing changes

@sym233
Copy link
Author

sym233 commented Aug 12, 2022

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'play
  • yarn -v # 3.2.2
  • yarn # 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.

@fhammerschmidt
Copy link
Member

Before we have a fix, can you try https://github.com/reason-seoul/yarn-plugin-rescript and check if the extension works with that?

@sym233
Copy link
Author

sym233 commented Aug 12, 2022

@fhammerschmidt it seems to have issue, too.
reason-seoul/yarn-plugin-rescript#14

@fhammerschmidt
Copy link
Member

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.

@sym233
Copy link
Author

sym233 commented Aug 12, 2022

@fhammerschmidt ah, that works

@fhammerschmidt
Copy link
Member

Just to clarify: It does not make sense for the extension to support yarn PnP yet, when even the compiler does not: rescript-lang/rescript#3276

As soon as you add some dependencies, you will have all kinds of issues.

@zth
Copy link
Collaborator

zth commented Feb 1, 2023

Closing this since there's nothing actionable for us here for now.

@zth zth closed this as completed Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants