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

Ide rebuild can create invalid JS with outdated cache #3323

Open
kritzcreek opened this issue Apr 26, 2018 · 1 comment
Open

Ide rebuild can create invalid JS with outdated cache #3323

kritzcreek opened this issue Apr 26, 2018 · 1 comment

Comments

@kritzcreek
Copy link
Member

  1. Compile and load these 2 modules into the ide server:
module A where

fn :: Int -> String
fn x = show x
module B where

import A (fn)

bFn :: String
bFn = fn 1
  1. Change module A.fn to
fn :: String -> String
fn s = s <> "hi!"
  1. Recompile A without letting the server know (start it with the --editor-mode flag and recompile module A from the cmdline with purs compile src/A.purs)

  2. Make a change to module B and fast-rebuild through ide, it does not show any errors, and it continues to generate code for B that assumes the old signature of A.fn is still valid, but instead the code fails at runtime.

This is a known issue, and I do not have a satisfying solution for the problem at hand. It basically boils down to cache invalidation between the FS and the ide servers internal state. Empirically file watching misses changes, and doesn't interact well with adding and removing files and avoiding it by polling creates too much overhead.

@i-am-the-slime
Copy link
Contributor

i-am-the-slime commented Jun 14, 2021

When I rename a module a few times I always get outdated suggestions/completions from the previous module names.
image
I'm also worried about this leaking memory.

Since 3.16.0 there have been hooks in the LSP for when files are added/removed: "Events for file operations (create, rename, delete)". Could we use these to signal to the IDE server when something needs invalidating?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants