Skip to content

Script type-checking randomly stops working until I rename the file [Backer] #1500

Open
@nhirschey

Description

@nhirschey

Describe the bug**

I've now run into this multiple times on different scripts, so filing a bug with logs. I'm writing fsdocs scripts. Things go great, but then at some point type checking stops working. I can type 1+1.0 and there are no red squigglies. Though line lens, code completion, and sending to fsi still works.

But ... if I get in this state and rename the file, such as changing a not working file name file.fsx to file1.fsx or fil.fsx, voila type checking comes back.

I do not have a simple reproducible example. But I did collect detailed logs and do a file diff to identify differences. The main difference seemed to be that the file that doesn't work sent semantic tokens before it recieved the fsharp/fileParsed notificatoin. The file that worked got the fsharp/fileParsed notification before it sent semantic tokens.

Here is a gist with logs from two versions of a script, where the only difference is one character in the file name: https://gist.github.com/nhirschey/e7e7894cf15de913f85dc03df2dfcedb

Comparison of the log files, showing where they differ:

Traces start out the same in both files, in this order

  • Sending request 'textDocument/documentSymbol
  • Sending notification 'textDocument/didClose'
  • Sending notification '$/cancelRequest'
  • [LSP Server] HandleClientMessage - Error {"Code": -32601, "Message": "Method not found", "Data": null, "$type": "Error"} when handling notification {"Version": "2.0", "Method": "$/cancelRequest", "Params": {"Value": [[[]]], "$type": "Some"}, "$type": "Notification"}
  • Received response 'textDocument/documentSymbol
  • Sending notification 'textDocument/didOpen
  • Sending request 'textDocument/codeAction
  • Sending request 'textDocument/documentSymbol
  • Received response 'textDocument/codeAction
  • Received response 'textDocument/documentSymbol

Now the traces diverge in both logs at line 1974. Numbers in brackets are line numbers

The file that does not typecheck.

  • [1974] Sending request 'textDocument/semanticTokens/full
  • [1982] Received response 'textDocument/semanticTokens/full
  • [6309] Received notification 'fsharp/fileParsed
  • [6315] Sending request 'fsharp/lineLens
  • [6323] Sending request 'fsharp/pipelineHint
  • [6329] Received notification 'textDocument/publishDiagnostics. The diagnostics are empty. They're missing the typecheck errors.

...lots more messages...

  • [7650] Sending request 'textDocument/codeAction. This sends a request for the line with the error, but the resulting diagnostics are empty

The file that correctly typechecks the file

  • [1974] Received notification 'fsharp/fileParsed'
  • [1980] Sending request 'fsharp/lineLens
  • [1988] Sending request 'fsharp/pipelineHint
  • [1994] Received notification 'textDocument/publishDiagnostics'. This contains correct typecheck error messages
  • [2036] Sending request 'textDocument/semanticTokens/full
  • [2044] Received response 'fsharp/lineLens

...lots more messages...

  • [7839] Sending request 'textDocument/codeAction. This sends a request for teh line with the error, and the diagnostics has the typecheck error.

Machine info

  • .NET SDK version: 5.0.200-preview.21079.7 (I also got it on 5.0.103)
  • Ionide version: 5.3.2

Version: 1.54.0-insider (user setup)
Commit: 192c817fd350bcbf3caecae22a45ec39bae78516
Date: 2021-02-19T05:14:28.632Z
Electron: 11.2.3
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19042

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugscriptsProblems with .fsx files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions