mpickering / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Demote no access to the persisted file to debug messages #51

Closed fendor closed 5 years ago

fendor commented 5 years ago

It is not really an error as it may happen if the file you want to lint had been closed before the lint can be applied.

fendor commented 5 years ago

@jneira with these changes, you should no longer see messages such as lintCmd: no access to the persisted file.!

mpickering commented 5 years ago

It could be argued that it's still an error if file was requested before it was inserted into the VFS and it's certainly an error to request a file which was never inserted into the VFS?

fendor commented 5 years ago

That is true. Unforutantely, we can not tell apart the cases right? Closing a file, removes it from the VFS, the lintCmd is stalled by runActionWithContext. So, opening a file then realizing you dont need it, closing it again, will show the "error" message to the user, although it is perfectly fine.

lukel97 commented 5 years ago

Should these pending requests not end up being cancelled whenever the file is closed?

fendor commented 5 years ago

@bubba They are not, because the following might happen: Open file in Editor, it gets added to the VFS -> request lint diagnostics. Submit this to the scheduler. Scheduler schedules it and executes runActionWithContext which builds the context of the FilePath that we want diagnostics for. This might take a while since also dependency builds may be triggered. Now the file in the editor is closed and the file is removed from the VFS. However, we have no way of aborting building the dependencies, e.g. runActionWithContext is never aborted. After runActionWithContext initialises the context, the plugin hlint is executed to get the diagnostics which tries to access the temp file, but fails since the virtual file has already been removed.

lukel97 commented 5 years ago

@fendor makes sense, these are all in IdeGhcM. But I thought we already had some logic to cancel requests that were in flight, at least whenever LSP sends a cancelRequest notification. Could this be called for any requests operating on a certain file that the VFS is told to close?

https://github.com/mpickering/haskell-ide-engine/blob/dcf81a11d27171aae2197c7a9d903e106aa28b07/src/Haskell/Ide/Engine/Scheduler.hs#L205-L210

This could be made an issue or sorted out after this though

fendor commented 5 years ago

@bubba Does cancelRequest cancel actions that are already happening? Because that is the "problem" the action is already being executed, just stuck in runActionWithContext.

lukel97 commented 5 years ago

@fendor Just actions that are queued from what I can tell

jneira commented 5 years ago

Well, as far i can test the alerts are gone from vscode and i can see them in hie.log. Thanks @fendor!