Skip to content

Clicking evaluation code-lens accent fails, inserts backtrace #547

Closed
@patrickt

Description

@patrickt

Subject of the issue

I’ve been experimenting with newer LSP features, and when trying to use the >>> - style lens, I’ve encountered a failure. Clicking such a code lens inserts the following in to the document:

-- expectJust getLinkDeps
-- CallStack (from HasCallStack):
--   error, called at compiler/utils/Maybes.hs:57:27 in ghc:Maybes
--   expectJust, called at compiler/ghci/Linker.hs:708:28 in ghc:Linker

Your environment

  • Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools
haskell-language-server version: 0.5.1.0 (GHC: 8.10.1) (PATH: /Users/patrickt/.ghcup/bin/haskell-language-server-wrapper-0.5.1) (GIT hash: e3fe0e7546aa91e44cc56cfe8ec078a026cf533a)
Tool versions found on the $PATH
cabal:		3.4.0.0
stack:		2.3.3
ghc:		8.10.2
  • Which lsp-client do you use

  • Describe your project (alternative: link to the project)
    Link is here. The code-lens invocation is here. It’s a Cabal project, with a hie.yaml file, with debugging info enabled.

  • Contents of hie.yaml

cradle:
  cabal:
    - path: "./test"
      component: "test:possession-test"
    - path: "./app"
      component: "exe:possession"
    - path: "./src"
      component: "lib:possession"

Steps to reproduce

Download the linked project (commit ee0ea91a23c5c03bd1efe9707e727596a9380d02), and invoke the Evaluate code action.

Expected behaviour

Inserts NewGame.

Actual behaviour

Inserts the following:

-- expectJust getLinkDeps
-- CallStack (from HasCallStack):
--   error, called at compiler/utils/Maybes.hs:57:27 in ghc:Maybes
--   expectJust, called at compiler/ghci/Linker.hs:708:28 in ghc:Linker

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
(haskell-language-server)Ghcide setup tester in /Users/patrickt/src/possession.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Tool versions found on the $PATH
cabal:		3.4.0.0
stack:		2.3.3
ghc:		8.10.2


Step 1/4: Finding files to test in /Users/patrickt/src/possession
Found 34 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
[INFO] Consulting the cradle for "src/UI/MainMenu.hs"
[INFO] Using interface files cache dir: /Users/patrickt/.cache/ghcide/possession-0.1.0.0-inplace-a06ee7479fd034d60ab8c6b5738064f625816939
[INFO] Making new HscEnv[possession-0.1.0.0-inplace]
[INFO] Consulting the cradle for "app/Main.hs"
[INFO] Using interface files cache dir: /Users/patrickt/.cache/ghcide/main-f20c7af191d457ffbf8905101266b8fac3c781e7
[INFO] Using interface files cache dir: /Users/patrickt/.cache/ghcide/possession-0.1.0.0-inplace-4e9f453bda9128ba6938d3d1bbbb5df645925d27
[INFO] Making new HscEnv[main,possession-0.1.0.0-inplace]
[INFO] Consulting the cradle for "test/Test.hs"
[INFO] Using interface files cache dir: /Users/patrickt/.cache/ghcide/main-5bc591b49739dd9dce13dfb89cdaf6a358da551c
[INFO] Using interface files cache dir: /Users/patrickt/.cache/ghcide/main-5bc591b49739dd9dce13dfb89cdaf6a358da551c
[INFO] Using interface files cache dir: /Users/patrickt/.cache/ghcide/possession-0.1.0.0-inplace-2140611c9f37ac9b5e183ecb7df47a51c1f8693b
[INFO] Making new HscEnv[main,main,possession-0.1.0.0-inplace]
File:     /Users/patrickt/src/possession/test/Test.hs
Hidden:   no
Range:    3:0-3:4
Source:   typecheck
Severity: DsWarning
Message:  �[0;93mTop-level binding with no type signature: main :: IO ()�[0m
File:     /Users/patrickt/src/possession/src/UI/Sidebar.hs
Hidden:   no
Range:    29:0-29:18
Source:   typecheck
Severity: DsWarning
Message: 
  �[0;93mThe import of ‘UI.Resource’ is redundant
  except perhaps to import instances from ‘UI.Resource’
  To import instances alone, use: import UI.Resource()�[0m
File:     /Users/patrickt/src/possession/src/UI/App.hs
Hidden:   no
Range:    28:0-28:40
Source:   typecheck
Severity: DsWarning
Message: 
  �[0;93mThe qualified import of ‘UI.MainMenu’ is redundant
  except perhaps to import instances from ‘UI.MainMenu’
  To import instances alone, use: import UI.MainMenu()�[0m
[INFO] finish: User TypeCheck (took 1.17s)

Completed (34 files worked, 0 files failed)

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
[Trace - 07:01:27 PM] Sending request 'textDocument/codeAction - (40)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "range": {
    "start": {
      "line": 44,
      "character": 0
    },
    "end": {
      "line": 44,
      "character": 0
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 07:01:27 PM] Sending request 'textDocument/documentHighlight - (41)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "position": {
    "line": 44,
    "character": 0
  }
}


[Trace - 07:01:28 PM] Received response 'textDocument/documentHighlight - (41)' in 126ms.
Result: []


[Trace - 07:01:28 PM] Received response 'textDocument/codeAction - (40)' in 127ms.
Result: []


[Trace - 07:01:28 PM] Sending request 'textDocument/hover - (42)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "position": {
    "line": 44,
    "character": 0
  }
}


[Trace - 07:01:28 PM] Received response 'textDocument/hover - (42)' in 133ms.
Result: {
  "range": {
    "end": {
      "character": 63,
      "line": 81
    },
    "start": {
      "character": 0,
      "line": 0
    }
  },
  "contents": {
    "value": "",
    "kind": "markdown"
  }
}


[Trace - 07:01:29 PM] Sending request 'workspace/executeCommand - (43)'.
Params: {
  "command": "61463:eval:evalCommand",
  "arguments": [
    {
      "statements": [
        [
          "moveUp NewGame",
          44
        ]
      ],
      "editTarget": {
        "end": {
          "character": 0,
          "line": 45
        },
        "start": {
          "character": 0,
          "line": 45
        }
      },
      "module_": {
        "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
      }
    }
  ]
}


[Trace - 07:01:29 PM] Received request 'window/workDoneProgress/create - (5).
Params: {
  "token": 2
}


[Trace - 07:01:29 PM] Sending response 'window/workDoneProgress/create - (5)'. Processing request took 0ms
Params: {
  "jsonrpc": "2.0",
  "id": 5,
  "result": null
}


[Trace - 07:01:29 PM] Received notification '$/progress'.
Params: {
  "token": 2,
  "value": {
    "title": "Eval",
    "cancellable": true,
    "kind": "begin"
  }
}


[Trace - 07:01:30 PM] Received notification '$/progress'.
Params: {
  "token": 2,
  "value": {
    "kind": "end"
  }
}


[Trace - 07:01:30 PM] Received response 'workspace/executeCommand - (43)' in 543ms.
Result: null


[Trace - 07:01:30 PM] Sending notification 'textDocument/didChange'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs",
    "version": 3
  },
  "contentChanges": [
    {
      "range": {
        "start": {
          "line": 45,
          "character": 0
        },
        "end": {
          "line": 45,
          "character": 0
        }
      },
      "rangeLength": 0,
      "text": "-- expectJust getLinkDeps\n-- CallStack (from HasCallStack):\n--   error, called at compiler/utils/Maybes.hs:57:27 in ghc:Maybes\n--   expectJust, called at compiler/ghci/Linker.hs:708:28 in ghc:Linker\n"
    }
  ]
}


[Trace - 07:01:30 PM] Received request 'workspace/applyEdit - (6).
Params: {
  "edit": {
    "changes": {
      "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs": [
        {
          "newText": "-- expectJust getLinkDeps\n-- CallStack (from HasCallStack):\n--   error, called at compiler/utils/Maybes.hs:57:27 in ghc:Maybes\n--   expectJust, called at compiler/ghci/Linker.hs:708:28 in ghc:Linker\n",
          "range": {
            "end": {
              "character": 0,
              "line": 45
            },
            "start": {
              "character": 0,
              "line": 45
            }
          }
        }
      ]
    }
  }
}


[Trace - 07:01:30 PM] Sending response 'workspace/applyEdit - (6)'. Processing request took 6ms
Params: {
  "jsonrpc": "2.0",
  "id": 6,
  "result": {
    "applied": true
  }
}


[Trace - 07:01:30 PM] Sending request 'textDocument/codeAction - (44)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "range": {
    "start": {
      "line": 44,
      "character": 0
    },
    "end": {
      "line": 44,
      "character": 0
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 07:01:30 PM] Received response 'textDocument/codeAction - (44)' in 150ms.
Result: []


[Trace - 07:01:30 PM] Sending request 'textDocument/codeAction - (45)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "range": {
    "start": {
      "line": 44,
      "character": 0
    },
    "end": {
      "line": 44,
      "character": 0
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 07:01:30 PM] Sending request 'textDocument/documentHighlight - (46)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "position": {
    "line": 44,
    "character": 0
  }
}


[Trace - 07:01:30 PM] Received response 'textDocument/documentHighlight - (46)' in 131ms.
Result: []


[Trace - 07:01:30 PM] Received response 'textDocument/codeAction - (45)' in 131ms.
Result: []


[Trace - 07:01:30 PM] Sending request 'textDocument/codeLens - (47)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  }
}


[Trace - 07:01:31 PM] Sending request 'textDocument/hover - (48)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "position": {
    "line": 44,
    "character": 0
  }
}


[Trace - 07:01:31 PM] Received response 'textDocument/codeLens - (47)' in 344ms.
Result: [
  {
    "range": {
      "end": {
        "character": 14,
        "line": 44
      },
      "start": {
        "character": 0,
        "line": 44
      }
    },
    "command": {
      "title": "Refresh...",
      "arguments": [
        {
          "statements": [
            [
              "moveUp NewGame",
              44
            ]
          ],
          "editTarget": {
            "end": {
              "character": 0,
              "line": 49
            },
            "start": {
              "character": 0,
              "line": 45
            }
          },
          "module_": {
            "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
          }
        }
      ],
      "command": "61463:eval:evalCommand"
    }
  },
  {
    "range": {
      "end": {
        "character": 18,
        "line": 19
      },
      "start": {
        "character": 0,
        "line": 19
      }
    },
    "command": {
      "title": "import Data.Vector ( Vector )",
      "arguments": [
        {
          "changes": {
            "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs": [
              {
                "newText": "import Data.Vector ( Vector )",
                "range": {
                  "end": {
                    "character": 18,
                    "line": 19
                  },
                  "start": {
                    "character": 0,
                    "line": 19
                  }
                }
              }
            ]
          }
        }
      ],
      "command": "61463:importLens:ImportLensCommand"
    }
  },
  {
    "range": {
      "end": {
        "character": 13,
        "line": 21
      },
      "start": {
        "character": 0,
        "line": 21
      }
    },
    "command": {
      "title": "import Optics ( toLensVL )",
      "arguments": [
        {
          "changes": {
            "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs": [
              {
                "newText": "import Optics ( toLensVL )",
                "range": {
                  "end": {
                    "character": 13,
                    "line": 21
                  },
                  "start": {
                    "character": 0,
                    "line": 21
                  }
                }
              }
            ]
          }
        }
      ],
      "command": "61463:importLens:ImportLensCommand"
    }
  }
]


[Trace - 07:01:31 PM] Received response 'textDocument/hover - (48)' in 295ms.
Result: {
  "range": {
    "end": {
      "character": 63,
      "line": 85
    },
    "start": {
      "character": 0,
      "line": 0
    }
  },
  "contents": {
    "value": "",
    "kind": "markdown"
  }
}


[Trace - 07:01:31 PM] Sending request 'textDocument/codeAction - (49)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "range": {
    "start": {
      "line": 38,
      "character": 11
    },
    "end": {
      "line": 38,
      "character": 11
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 07:01:31 PM] Received response 'textDocument/codeAction - (49)' in 251ms.
Result: []


[Trace - 07:01:59 PM] Sending request 'textDocument/codeAction - (50)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "range": {
    "start": {
      "line": 38,
      "character": 11
    },
    "end": {
      "line": 38,
      "character": 11
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 07:01:59 PM] Received response 'textDocument/codeAction - (50)' in 127ms.
Result: []


[Trace - 07:01:59 PM] Sending request 'textDocument/hover - (51)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/patrickt/src/possession/src/UI/MainMenu.hs"
  },
  "position": {
    "line": 38,
    "character": 11
  }
}


[Trace - 07:01:59 PM] Received response 'textDocument/hover - (51)' in 127ms.
Result: {
  "range": {
    "end": {
      "character": 11,
      "line": 38
    },
    "start": {
      "character": 5,
      "line": 38
    }
  },
  "contents": {
    "value": "\n```haskell\nChoice\n```\n\n*Defined at /Users/patrickt/src/possession/src/UI/MainMenu.hs:39:1*\n\n\n\n",
    "kind": "markdown"
  }
}

Metadata

Metadata

Assignees

Labels

component: hls-eval-plugintype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions