VS Code showing multiple copies of ReScript file

When I try to jump between files in Code I often see multiple copies of the same file in the dropdown. Is anyone else experiencing this and know how to fix it?

2 Likes

This seems not specific to rescript plugin?

Thanks for the answer. That could very well be. I’ll keep watch on this issue and see if I can narrow it down.

Seems to be related to an old issue from 2018. Clearing the editor history fixed this for now. Thanks to Ehab Ibrahim :blush:

2 Likes

This problem actually won’t go away for us. I can clear the editor history in vscode and that will clear the recent list. But multiple copies of the recent files still show up again after working a bit.

This only happens in our ReScript project and it happens across machines (and for all devs). So it’s something to do with our ReScript project. Are we the only ones experiencing this?

i wonder how vscode maintains the history list. Do the duplicate entries only appear when you jump between files, or do they appear as you recompile the files? I feel like this is a filesystem related issue, but not sure.

I don’t think this is caused by our plugin.

1 Like

Thanks for the answer, you’re right that it could be related to the filesystem in some way. I still haven’t pinpointed a direct cause > effect chain. But will try to keep an eye on it again.

Right now I am wondering if anyone else has this problem? Or it’s only us in this one project. vscode doesn’t have this behaviour when we work in our other projects (which are TypeScript though).

I found a way to reproduce the error in our codebase. It happens whenever we use jump to definition. I tried to record an example video here. In the video ⌘+P is showing the latest files and ⌘+B is using jump to definition. Can anyone else reproduce this?

I just reproduced this on v1.2.1. I’m not sure why I haven’t noticed this before :thinking:

It doesn’t happen on a TypeScript project, so the ReScript extension is causing this somehow.

Thanks for the verification. Happy to hear that it’s not only a local problem :slight_smile: I have a few hours later this week and will try to see if I can grok a solution for this.

I can confirm that each time I jump to definition it adds a new entry in the history with a . where bsconfig.json is located (in this example, in the web folder):

2 Likes

I have the same issue, I thought it was a VSCode issue somehow :thinking:

1 Like

Looks like vscode is not happy with paths for the form ./something, and views each identical copy of those paths as distinct files.

See this PR https://github.com/rescript-lang/rescript-vscode/pull/358 for a fix.

4 Likes

You’re the best! I just tried the suggested solution and it works great. Thanks!

2 Likes

I’m still experiencing this problem. I don’t understand the release schedule for the VS Code extension. In VS Code it says it was last updated 1/26. How do I get the recent fixes?

We need to wait until the team releases a newer version of the VS Code extension with the included fix. Another option is to build the extension yourself.

FWIW I just made a PR with a GitHub-Action to package the whole extension after every master or PR build. Then you can easily grab the VSIX package file from the Actions page on the GitHub repo.

6 Likes

Wow very glad you did that.

A new version, including the recent work on highlighting and more, is coming soon!

5 Likes