Description
Your environment
Output of haskell-language-server --probe-tools
or haskell-language-server-wrapper --probe-tools
:
$ haskell-language-server --probe-tools
bash: haskell-language-server: command not found
$ haskell-language-server-8.10.3 --probe-tools
haskell-language-server version: 0.8.0.0 (GHC: 8.10.3) (PATH: /home/enrico/.ghcup/bin/haskell-language-server-8.10.3~0.8.0) (GIT hash: eb58f13f7b8e4f9bc771af30ff9fd82dc4309ff5)
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: Not found
ghc: 8.10.3
Which lsp-client do you use:
Vim + YouCompleteMe
Describe your project (alternative: link to the project):
Contents of hie.yaml
:
Steps to reproduce
Put the following content in a file:
a = and $ map b $ c
where
b = undefined
c = undefined
wait for the following suggestion to come up
Use all Found: and $ map b $ c Why not: all b c [refact:Use all]
Try to apply that suggestion. An error will occur, and no substitution will take place.
Expected behaviour
The suggested fix should take place
Actual behaviour
Error.
I don't know how to fill in the following part of the form, considering I use haskell-language-server
via Vim+YouCompleteMe, but I've done it according to the suggestions from YCM's developers 😃
Include debug information
Execute in the root of your project the command haskell-language-server --debug .
and paste the logs here:
Debug output:
Module "/home/enrico/a" is loaded by Cradle: Cradle {cradleRootDir = "/home/enrico", cradleOptsProg = CradleAction: Default}
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 0.8.0.0, Git revision eb58f13f7b8e4f9bc771af30ff9fd82dc4309ff5 (dirty) x86_64 ghc-8.10.1
Current directory: /home/enrico
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/enrico
Cradle type: Default
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: Not found
ghc: 8.10.3
Consulting the cradle to get project GHC version...
Project GHC version: 8.10.3
haskell-language-server exe candidates: ["haskell-language-server-8.10.3","haskell-language-server-8.10","haskell-language-server"]
Launching haskell-language-server exe at:/home/enrico/.ghcup/bin/haskell-language-server-8.10.3
haskell-language-server version: 0.8.0.0 (GHC: 8.10.3) (PATH: /home/enrico/.ghcup/bin/haskell-language-server-8.10.3~0.8.0) (GIT hash: eb58f13f7b8e4f9bc771af30ff9fd82dc4309ff5)
Starting (haskell-language-server)LSP server...
with arguments: LspArguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
with plugins: [PluginId "brittany",PluginId "class",PluginId "eval",PluginId "floskell",PluginId "fourmolu",PluginId "ghcide",PluginId "hlint",PluginId "importLens",PluginId "moduleName",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "stylish-haskell",PluginId "tactic"]
in directory: /home/enrico
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Started LSP server in 0.00s
2021-02-08 18:52:41.539713757 [ThreadId 22] - Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-9151126101283422247) "file:///home/enrico"], clientSettings = hashed (Just (Object (fromList [])))}
2021-02-08 18:52:41.540883139 [ThreadId 22] - Configuration changed: Object (fromList [])
2021-02-08 18:52:41.541542671 [ThreadId 22] - Opened text document: file:///home/enrico/deleteme.hs
2021-02-08 18:52:41.542131743 [ThreadId 91] - hlint:getIdeas:file:NormalizedFilePath "/home/enrico/deleteme.hs"
2021-02-08 18:52:41.542622556 [ThreadId 99] - Consulting the cradle for "deleteme.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/enrico", cradleOptsProg = CradleAction: Default}
2021-02-08 18:52:41.631787286 [ThreadId 99] - Using interface files cache dir: ghcide
2021-02-08 18:52:41.631853313 [ThreadId 99] - Making new HscEnv[main]
2021-02-08 18:52:41.641501868 [ThreadId 145] - hlint:getIdeas:file:NormalizedFilePath "/home/enrico/deleteme.hs"
2021-02-08 18:52:43.937318625 [ThreadId 219] - finish: CodeAction (took 0.00s)
2021-02-08 18:52:45.105513531 [ThreadId 226] - finish: CodeAction:PackageExports (took 1.17s)
2021-02-08 18:52:45.105800693 [ThreadId 227] - finish: importLens (took 0.00s)
2021-02-08 18:52:45.106007778 [ThreadId 229] - finish: addPragma (took 0.00s)
2021-02-08 18:52:45.106226854 [ThreadId 231] - finish: retrie (took 0.00s)
2021-02-08 18:52:45.106497956 [ThreadId 233] - finish: tactic (took 0.00s)
2021-02-08 18:52:45.1067564 [ThreadId 238] - finish: tactic (took 0.00s)
2021-02-08 18:52:45.106896504 [ThreadId 239] - finish: tactic (took 0.00s)
2021-02-08 18:52:45.651142815 [ThreadId 244] - hlint:applyOneCmd:file=NormalizedFilePath "/home/enrico/deleteme.hs"
2021-02-08 18:52:45.651692951 [ThreadId 245] - hlint:getIdeas:file:NormalizedFilePath "/home/enrico/deleteme.hs"
2021-02-08 18:52:45.652084964 [ThreadId 245] - finish: applyHint (took 0.00s)
2021-02-08 18:52:45.652272702 [ThreadId 244] - applyHint:apply=[("/home/enrico/deleteme.hs:1:5-19: Warning: Use all\nFound:\n and $ map b $ c\nPerhaps:\n all b c\n",[Replace {rtype = Expr, pos = SrcSpan {startLine = 1, startCol = 5, endLine = 1, endCol = 20}, subts = [("p",SrcSpan {startLine = 1, startCol = 15, endLine = 1, endCol = 16}),("x",SrcSpan {startLine = 1, startCol = 19, endLine = 1, endCol = 20})], orig = "all p x"}])]
2021-02-08 18:52:45.661047495 [ThreadId 247] - finish: hlint (took 0.00s)
Missing file: /home/runner/.ghcup/ghc/8.10.3/lib/ghc-8.10.3/settings
Paste the logs from the lsp-client, e.g. for VS Code
LSP logs:
2021-02-08 18:52:41,387 - DEBUG - TX: Sending message: b'Content-Length: 1029\r\n\r\n{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"documentationFormat":["plaintext","markdown"]},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"contentFormat":["plaintext","markdown"]},"signatureHelp":{"signatureInformation":{"documentationFormat":["plaintext","markdown"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true}},"workspace":{"applyEdit":true,"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"workspaceEdit":{"documentChanges":true}}},"initializationOptions":{},"processId":675430,"rootPath":"/home/enrico","rootUri":"file:///home/enrico"}}'
2021-02-08 18:52:41,530 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","params":{"type":1,"message":"haskell-lsp:configuration parse error. RequestMessage {_jsonrpc = \\"2.0\\", _id = IdInt 1, _method = Initialize, _params = InitializeParams {_processId = Just 675430, _rootPath = Just \\"/home/enrico\\", _rootUri = Just (Uri {getUri = \\"file:///home/enrico\\"}), _initializationOptions = Just (Object (fromList [])), _capabilities = ClientCapabilities {_workspace = Just (WorkspaceClientCapabilities {_applyEdit = Just True, _workspaceEdit = Just (WorkspaceEditClientCapabilities {_documentChanges = Just True}), _didChangeConfiguration = Nothing, _didChangeWatchedFiles = Just (DidChangeWatchedFilesClientCapabilities {_dynamicRegistration = Just True}), _symbol = Just (SymbolClientCapabilities {_dynamicRegistration = Nothing, _symbolKind = Just (SymbolKindClientCapabilities {_valueSet = Just (List [SkFile,SkModule,SkNamespace,SkPackage,SkClass,SkMethod,SkProperty,SkField,SkConstructor,SkEnum,SkInterface,SkFunction,SkVariable,SkConstant,SkString,SkNumber,SkBoolean,SkArray,SkObject,SkKey,SkNull,SkEnumMember,SkStruct,SkEvent,SkOperator,SkTypeParameter])})}), _executeCommand = Nothing, _workspaceFolders = Nothing, _configuration = Nothing}), _textDocument = Just (TextDocumentClientCapabilities {_synchronization = Just (SynchronizationTextDocumentClientCapabilities {_dynamicRegistration = Nothing, _willSave = Nothing, _willSaveWaitUntil = Nothing, _didSave = Just True}), _completion = Just (CompletionClientCapabilities {_dynamicRegistration = Nothing, _completionItem = Just (CompletionItemClientCapabilities {_snippetSupport = Nothing, _commitCharactersSupport = Nothing, _documentationFormat = Just (List [MkPlainText,MkMarkdown]), _deprecatedSupport = Nothing, _preselectSupport = Nothing, _tagSupport = Nothing}), _completionItemKind = Just (CompletionItemKindClientCapabilities {_valueSet = Just (List [CiText,CiMethod,CiFunction,CiConstructor,CiField,CiVariable,CiClass,CiInterface,CiModule,CiProperty,CiUnit,CiValue,CiEnum,CiKeyword,CiSnippet,CiColor,CiFile,CiReference,CiFolder,CiEnumMember,CiConstant,CiStruct,CiEvent,CiOperator,CiTypeParameter])}), _contextSupport = Nothing}), _hover = Just (HoverClientCapabilities {_dynamicRegistration = Nothing, _contentFormat = Just (List [MkPlainText,MkMarkdown])}), _signatureHelp = Just (SignatureHelpClientCapabilities {_dynamicRegistration = Nothing, _signatureInformation = Just (SignatureInformationClientCapabilities {documentationFormat = Nothing})}), _references = Nothing, _documentHighlight = Nothing, _documentSymbol = Nothing, _formatting = Nothing, _rangeFormatting = Nothing, _onTypeFormatting = Nothing, _definition = Nothing, _typeDefinition = Nothing, _implementation = Nothing, _codeAction = Just (CodeActionClientCapabilities {_dynamicRegistration = Nothing, _codeActionLiteralSupport = Just (CodeActionLiteralSupport {_codeActionKind = CodeActionKindClientCapabilities {_valueSet = List [CodeActionUnknown \\"\\",CodeActionQuickFix,CodeActionRefactor,CodeActionRefactorExtract,CodeActionRefactorInline,CodeActionRefactorRewrite,CodeActionSource,CodeActionSourceOrganizeImports]}})}), _codeLens = Nothing, _documentLink = Nothing, _colorProvider = Nothing, _rename = Nothing, _publishDiagnostics = Nothing, _foldingRange = Nothing}), _window = Nothing, _experimental = Nothing}, _trace = Nothing, _workspaceFolders = Nothing}} \\"key \\\\\\"languageServerHaskell\\\\\\" not found\\""},"method":"window/logMessage"}'
2021-02-08 18:52:41,540 - DEBUG - RX: Received message: b'{"result":{"capabilities":{"typeDefinitionProvider":true,"foldingRangeProvider":false,"textDocumentSync":{"openClose":true,"change":2,"save":{}},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}},"implementationProvider":true,"documentRangeFormattingProvider":true,"documentHighlightProvider":true,"executeCommandProvider":{"commands":["675492:class:addMinimalMethodPlaceholders","675492:eval:evalCommand","675492:ghcide:typesignature.add","675492:hlint:applyOne","675492:hlint:applyAll","675492:importLens:ImportLensCommand","675492:moduleName:edit","675492:retrie:retrieCommand","675492:tactic:tacticsAutoCommand","675492:tactic:tacticsIntrosCommand","675492:tactic:tacticsDestructCommand","675492:tactic:tacticsHomomorphismCommand","675492:tactic:tacticsDestructLambdaCaseCommand","675492:tactic:tacticsHomomorphismLambdaCaseCommand"]},"renameProvider":false,"colorProvider":false,"definitionProvider":true,"hoverProvider":true,"codeActionProvider":true,"completionProvider":{"triggerCharacters":["."],"resolveProvider":false},"codeLensProvider":{},"documentSymbolProvider":true,"documentFormattingProvider":true}},"jsonrpc":"2.0","id":1}'
2021-02-08 18:52:41,540 - DEBUG - TX: Sending notification: b'Content-Length: 52\r\n\r\n{"jsonrpc":"2.0","method":"initialized","params":{}}'
2021-02-08 18:52:41,540 - DEBUG - TX: Sending notification: b'Content-Length: 86\r\n\r\n{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}'
2021-02-08 18:52:41,541 - DEBUG - TX: Sending notification: b'Content-Length: 230\r\n\r\n{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"haskell","text":"a = and $ map b $ c\\n where\\n b = undefined\\n c = undefined\\n","uri":"file:///home/enrico/deleteme.hs","version":1}}}'
2021-02-08 18:52:41,541 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","params":{"registrations":[{"registerOptions":{"watchers":[{"kind":5,"globPattern":"**/*.hs"},{"kind":5,"globPattern":"**/*.hs-boot"},{"kind":5,"globPattern":"**/*.lhs"},{"kind":5,"globPattern":"**/*.lhs-boot"}]},"method":"workspace/didChangeWatchedFiles","id":"globalFileWatches"}]},"method":"client/registerCapability","id":0}'
2021-02-08 18:52:42,733 - DEBUG - TX: Sending response: b'Content-Length: 38\r\n\r\n{"id":0,"jsonrpc":"2.0","result":null}'
2021-02-08 18:52:42,733 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","params":{"type":1,"message":"haskell-lsp:configuration parse error. NotificationMessage {_jsonrpc = \\"2.0\\", _method = WorkspaceDidChangeConfiguration, _params = DidChangeConfigurationParams {_settings = Object (fromList [])}} \\"key \\\\\\"languageServerHaskell\\\\\\" not found\\""},"method":"window/logMessage"}'
2021-02-08 18:52:42,733 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","params":{"type":3,"message":"No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for deleteme.hs.\\n Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).\\nYou should ignore this message, unless you see a \'Multi Cradle: No prefixes matched\' error."},"method":"window/showMessage"}'
2021-02-08 18:52:42,733 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","params":{"uri":"file:///home/enrico/deleteme.hs","diagnostics":[{"severity":3,"range":{"start":{"line":0,"character":4},"end":{"line":0,"character":19}},"code":"refact:Use all","source":"hlint","message":"Use all\\nFound:\\n and $ map b $ c\\nWhy not:\\n all b c\\n"},{"severity":3,"range":{"start":{"line":0,"character":16},"end":{"line":0,"character":17}},"code":"refact:Redundant $","source":"hlint","message":"Redundant $\\nFound:\\n map b $ c\\nWhy not:\\n map b c\\n"}]},"method":"textDocument/publishDiagnostics"}'
2021-02-08 18:52:43,936 - DEBUG - TX: Sending message: b'Content-Length: 430\r\n\r\n{"id":2,"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[{"code":"refact:Use all","message":"Use all\\nFound:\\n and $ map b $ c\\nWhy not:\\n all b c\\n","range":{"end":{"character":19,"line":0},"start":{"character":4,"line":0}},"severity":3,"source":"hlint"}]},"range":{"end":{"character":5,"line":0},"start":{"character":4,"line":0}},"textDocument":{"uri":"file:///home/enrico/deleteme.hs"}}}'
2021-02-08 18:52:45,111 - DEBUG - RX: Received message: b'{"result":[{"command":{"command":"675492:hlint:applyAll","arguments":["file:///home/enrico/deleteme.hs"],"title":"Apply all hints"},"kind":"quickfix","title":"Apply all hints"},{"command":{"command":"675492:hlint:applyOne","arguments":[{"hintTitle":"Use all","start_pos":{"line":0,"character":4},"file":"file:///home/enrico/deleteme.hs"}],"title":"Apply hint: Use all"},"kind":"quickfix","diagnostics":[{"severity":3,"range":{"start":{"line":0,"character":4},"end":{"line":0,"character":19}},"code":"refact:Use all","source":"hlint","message":"Use all\\nFound:\\n and $ map b $ c\\nWhy not:\\n all b c\\n"}],"title":"Apply hint: Use all"}],"jsonrpc":"2.0","id":2}'
2021-02-08 18:52:45,650 - DEBUG - TX: Sending message: b'Content-Length: 221\r\n\r\n{"id":3,"jsonrpc":"2.0","method":"workspace/executeCommand","params":{"arguments":[{"file":"file:///home/enrico/deleteme.hs","hintTitle":"Use all","start_pos":{"character":4,"line":0}}],"command":"675492:hlint:applyOne"}}'
2021-02-08 18:52:45,662 - DEBUG - RX: Received message: b'{"error":{"code":-32603,"message":"ExitFailure 1"},"jsonrpc":"2.0","id":3}'