nwolverson / purescript-language-server

MIT License
184 stars 42 forks source link

First jump to definition always fails #89

Closed andys8 closed 4 years ago

andys8 commented 4 years ago

Opening a new file and trigger jump to definition fails for the first request (returns no result), but works with the second request. This could also apply to other features than jump to definition.

See https://github.com/nwolverson/purescript-language-server/issues/88#issuecomment-687895790

andys8 commented 4 years ago

I think this might be the issue: https://github.com/nwolverson/purescript-language-server/blob/0fd2cdb17cea2c76efd13b2ea76482465bde2cce/src/LanguageServer/IdePurescript/Main.purs#L194-L197

  1. state is read as s
  2. updateModules is triggered to update list of active modules and modify the state ref
  3. s from before is passed to function handler, but modules were not updated
nwolverson commented 4 years ago

An issue has been observed on switching files similarly, goto definition does not work before triggering an update by editing/saving the file