Skip to content
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

The module or file RescriptCore can't be found. #1056

Open
BIYUEHU opened this issue Nov 17, 2024 · 13 comments · Fixed by #1057
Open

The module or file RescriptCore can't be found. #1056

BIYUEHU opened this issue Nov 17, 2024 · 13 comments · Fixed by #1057

Comments

@BIYUEHU
Copy link

BIYUEHU commented Nov 17, 2024

Report details:

The module or file RescriptCore can't be found.
- If it's a third-party dependency:
  - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in bsconfig.json?
- Did you include the file's directory to the "sources" in bsconfig.json?
  • Extension version: v1.58.0
  • I created a basic project by create-rescript-app and already installed all packages.
  • There isn't non-english Characters at the project path: E:\repos\my-res

Part of Package.json:

  "dependencies": {
    "@rescript/core": "^1.3.0",
    "rescript": "^11.1.0"
  }

Visual Studio Code information:

Version: 1.85.2 (user setup)
Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681
Date: 2024-01-18T06:40:10.514Z(10 mos ago)
Electron: 25.9.7
ElectronBuildld:26354273
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
Os: Windows NT x64 10.0.22621

Screenboot:

QQ截图20241117160728

@nojaf
Copy link
Contributor

nojaf commented Nov 18, 2024

Hello, could you share your rescript.json?

@BIYUEHU
Copy link
Author

BIYUEHU commented Nov 18, 2024

Hello, could you share your rescript.json?

Sorry, I forgot. Here:

{
  "name": "rescript-project-template",
  "sources": {
    "dir": "src",
    "subdirs": true
  },
  "package-specs": {
    "module": "commonjs",
    "in-source": true
  },
  "suffix": ".res.js",
  "bs-dependencies": ["@rescript/core"],
  "bsc-flags": ["-open RescriptCore"]
}

Everything was generated automatically through create-rescript-app, and I didn't make any changes.

@nojaf
Copy link
Contributor

nojaf commented Nov 18, 2024

Ok, just wanted to check if you were not missing the entry in bs-dependencies.

Did npx rescript work for you? Running that again sometimes unblocks the IDE.

@fhammerschmidt
Copy link
Member

In your case probably pnpm exec rescript I guess. And it looks like you did not start a build or watcher yet.

@BIYUEHU
Copy link
Author

BIYUEHU commented Nov 18, 2024

In your case probably pnpm exec rescript I guess. And it looks like you did not start a build or watcher yet.

Ok, just wanted to check if you were not missing the entry in bs-dependencies.

Did npx rescript work for you? Running that again sometimes unblocks the IDE.

I'm sure I've executed rescript and there are no errors, only the VSC extension always reports this error at the top of the file:

QQ截图20241118231339

@fhammerschmidt
Copy link
Member

I just created a create-rescript-app basic project with pnpm and do not have this issue. I hope it's not windows-specific.

I guess you also tried to restart the language server from VSCode's command palette?

Other than that what does the OUTPUT tab say when you select "ReScript Language Server" from the dropdown menu?

@BIYUEHU
Copy link
Author

BIYUEHU commented Nov 18, 2024

I just created a create-rescript-app basic project with pnpm and do not have this issue. I hope it's not windows-specific.

I guess you also tried to restart the language server from VSCode's command palette?

Other than that what does the OUTPUT tab say when you select "ReScript Language Server" from the dropdown menu?

No further information beyond this:

QQ截图20241118234340

And my system version is Windows11 22H2.

@fhammerschmidt
Copy link
Member

I can reproduce the error in your output if I do
pnpm run res:clean
and do not trigger a build afterwards.

But as soon as I do
pnpm run res:dev

Everything works again. And to me it really just looks like the LSP got stuck and needs a restart. Btw. when you close all rescript tabs and open one again, it also gets restarted.

@BIYUEHU
Copy link
Author

BIYUEHU commented Nov 20, 2024

I can reproduce the error in your output if I do pnpm run res:clean and do not trigger a build afterwards.

But as soon as I do pnpm run res:dev

Everything works again. And to me it really just looks like the LSP got stuck and needs a restart. Btw. when you close all rescript tabs and open one again, it also gets restarted.

I've tried to clean rescript and restart VSC, but it has no effect.

After I closed Incremental Typechecking: Enabled at settings, the problem seems to be solved:

QQ截图20241120121317

Now I need to run res:dev all the time when developing rescript after there is type and syntax checking (LSP of the extension doesn't seem to be working), is this normal?

@fhammerschmidt
Copy link
Member

That's curious, maybe there is a Windows bug in path handling of incremental compilation. @zth

When incremental typechecking is off, it should still typecheck/compile after every save. Personally, I always have a watcher running in a separate terminal as this one can not get killed by the VSCode extension.

The LSP relies on a successful compile to gather type information, if you have an error in your code it might not be able to give you accurate type information.

@zth
Copy link
Collaborator

zth commented Nov 21, 2024

There might very well be some issue with windows and path handling for incremental typechecking, yes.

@fhammerschmidt
Copy link
Member

Not so fast, GitHub.

@BIYUEHU can you try setting your extension to the pre-release version 1.59.6 and see if incremental compilation works there?

@BIYUEHU
Copy link
Author

BIYUEHU commented Nov 22, 2024

Not so fast, GitHub.

@BIYUEHU can you try setting your extension to the pre-release version 1.59.6 and see if incremental compilation works there?

I tried.Type checking is working normally:

QQ截图20241122121319

But the first problem still exists:

QQ截图20241122121347

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

Successfully merging a pull request may close this issue.

4 participants