haskell / haskell-ide-engine

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

Error on rename #506

Open arbitrary-dev opened 6 years ago

arbitrary-dev commented 6 years ago
2018-03-26T00:08:39.103327+03:00 ERROR languageclient::vim - Error handling message. Message: {"id":1,"jsonrpc":"2.0","method":"textDocument/rename","params":{"character":4,"cword":"comment","handle":true,"languageId":"haskell","line":8,"buftype":"","filename":"/Users/**/Comment.hs"}}. Error: Err(ErrorMessage { msg: "IdeError {ideCode = PluginError, ideMessage = \"rename: \\\"Couldn\'t get typechecked module for /Users/**/Comment.hs\\\"\", ideInfo = Null}" })

What kind of typechecked module HIE can't get?

alanz commented 6 years ago

This part

"filename":"/Users/**/Comment.hs"

looks strange to me. The filename is supposed to be a URI, and I don't know what the asterisks are doing in the middle.

Can you provide more detail on the project you are working on when this happens?

arbitrary-dev commented 6 years ago

Asterisks were added by me, it's a simple path to a local filesystem on my MacOS machine.

arbitrary-dev commented 6 years ago

The project is this one: https://github.com/yesodweb/yesod-scaffold/blob/sqlite/src/Handler/Comment.hs

johnsonwj commented 6 years ago

I can reproduce this issue on Windows:

Request

{
   "jsonrpc":"2.0",
   "id":99,
   "method":"textDocument/rename",
   "params":{
      "textDocument":{
         "uri":"file:///c%3A/Users/myself/Documents/GitHub/haskell-ide-engine/src/Haskell/Ide/Engine/Options.hs"
      },
      "position":{
         "line":18,
         "character":15
      },
      "newName":"globalOptsParserThingy"
   }
}

Response

{
   "error":{
      "code":-32603,
      "message":"IdeError {ideCode = PluginError, ideMessage = \"rename: \\\"Couldn't get typechecked module for c:\\\\Users\\\\myself\\\\Documents\\\\GitHub\\\\haskell-ide-engine\\\\src\\\\Haskell\\\\Ide\\\\Engine\\\\Options.hs\\\"\", ideInfo = Null}"
   },
   "jsonrpc":"2.0",
   "id":99
}

I am trying to dig into ghc-mod to find out what's going on!

wpcarro commented 6 years ago

I'm getting a similar error when trying to run lsp-rename. Looks like:

Error from the Language Server: rename: "Couldn't get typechecked module for <filepath>"

Where <filepath> is the full path of my current buffer.

pikajude commented 5 years ago

+1 from me, I get this when trying to apply the "Prefix with _" rule for unused vars in Atom

ghost commented 5 years ago
{-# LANGUAGE TemplateHaskell #-}

module Foo where

foo :: Int
foo = 12

Minimal reproduction. With TH commented out renaming works. If module Bar imports Foo - renaming won't work in it either.