Some haskell language server features don't seem to be available on Neovim with Coc or are not working for me.
Is Working
Is Sorta Working
Not Working
I might also have set some stuff up on my side poorly so perhaps that is part of the problem here? Since this is so new, its hard for me to find people to confirm this stuff with.
haskell-language-server-wrapper --probe-tools
haskell-language-server version: 0.4.0.0 (GHC: 8.10.1) (PATH: /Users/carterweinberg/.ghcup/bin/haskell-language-server-wrapper-0.4.0) (GIT hash: 0a18edde24923251a148cbbc0ae993a6aac83b9c)
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: 2.3.1
ghc: 8.8.4
lsp-client
Neovim and Coc
hie.yaml ( I use the cabal file instead so show that here)I did find this error in my logs. It's sorta just a large blobby mess so I don't know what to make of it.
[Error - 8:54:31 PM] haskell-lsp:configuration parse error. RequestMessage {_jsonrpc = "2.0", _id = IdInt 0, _method = Initialize, _params = InitializeParams {_processId = Just 45519, _rootPath = Just "/Users/carterweinber g/servantExample", _rootUri = Just (Uri {getUri = "file:///Users/carterweinberg/servantExample"}), _initializationOptions = Just (Object (fromList [])), _capabilities = ClientCapabilities {_workspace = Just (WorkspaceClient Capabilities {_applyEdit = Just True, _workspaceEdit = Just (WorkspaceEditClientCapabilities {_documentChanges = Just True}), _didChangeConfiguration = Just (DidChangeConfigurationClientCapabilities {_dynamicRegistration = Just True}), _didChangeWatchedFiles = Just (DidChangeWatchedFilesClientCapabilities {_dynamicRegistration = Just True}), _symbol = Just (SymbolClientCapabilities {_dynamicRegistration = Just True, _symbolKind = Just (Symbol KindClientCapabilities {_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 = Just (ExecuteClientCapabilities {_dynamicRegistration = Just True}), _workspaceFolders = Just True, _configuration = J ust True}), _textDocument = Just (TextDocumentClientCapabilities {_synchronization = Just (SynchronizationTextDocumentClientCapabilities {_dynamicRegistration = Just True, _willSave = Just True, _willSaveWaitUntil = Just Tr ue, _didSave = Just True}), _completion = Just (CompletionClientCapabilities {_dynamicRegistration = Just True, _completionItem = Just (CompletionItemClientCapabilities {_snippetSupport = Just True, _commitCharactersSupport = Just True, _documentationFormat = Just (List [MkMarkdown,MkPlainText]), _deprecatedSupport = Just True, _preselectSupport = Just True, _tagSupport = Nothing}), _completionItemKind = Just (CompletionItemKindClientCapabili ties {_valueSet = Just (List [CiText,CiMethod,CiFunction,CiConstructor,CiField,CiVariable,CiClass,CiInterface,CiModule,CiProperty,CiUnit,CiValue,CiEnum,CiKeyword,CiSnippet,CiColor,CiFile,CiReference,CiFolder,CiEnumMember,Ci Constant,CiStruct,CiEvent,CiOperator,CiTypeParameter])}), _contextSupport = Just True}), _hover = Just (HoverClientCapabilities {_dynamicRegistration = Just True, _contentFormat = Just (List [MkMarkdown,MkPlainText])}), _si gnatureHelp = Just (SignatureHelpClientCapabilities {_dynamicRegistration = Just True, _signatureInformation = Just (SignatureInformationClientCapabilities {documentationFormat = Nothing})}), _references = Just (ReferencesC lientCapabilities {_dynamicRegistration = Just True}), _documentHighlight = Just (DocumentHighlightClientCapabilities {_dynamicRegistration = Just True}), _documentSymbol = Just (DocumentSymbolClientCapabilities {_dynamicRe gistration = Just True, _symbolKind = Just (DocumentSymbolKindClientCapabilities {_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])}), _hierarchicalDocumentSymbolSupport = Just True}), _formatting = Just (Formatting ClientCapabilities {_dynamicRegistration = Just True}), _rangeFormatting = Just (RangeFormattingClientCapabilities {_dynamicRegistration = Just True}), _onTypeFormatting = Just (OnTypeFormattingClientCapabilities {_dynamicR egistration = Just True}), _definition = Just (DefinitionClientCapabilities {_dynamicRegistration = Just True}), _typeDefinition = Just (TypeDefinitionClientCapabilities {_dynamicRegistration = Just True}), _implementation = Just (ImplementationClientCapabilities {_dynamicRegistration = Just True}), _codeAction = Just (CodeActionClientCapabilities {_dynamicRegistration = Just True, _codeActionLiteralSupport = Just (CodeActionLiteralSupport {_ codeActionKind = CodeActionKindClientCapabilities {_valueSet = List [CodeActionUnknown "",CodeActionQuickFix,CodeActionRefactor,CodeActionRefactorExtract,CodeActionRefactorInline,CodeActionRefactorRewrite,CodeActionSource,C odeActionSourceOrganizeImports]}})}), _codeLens = Just (CodeLensClientCapabilities {_dynamicRegistration = Just True}), _documentLink = Just (DocumentLinkClientCapabilities {_dynamicRegistration = Just True}), _colorProvide r = Just (ColorProviderClientCapabilities {_dynamicRegistration = Just True}), _rename = Just (RenameClientCapabilities {_dynamicRegistration = Just True, _prepareSupport = Just True}), _publishDiagnostics = Just (PublishDi agnosticsClientCapabilities {_relatedInformation = Just True, _tagSupport = Just (PublishDiagnosticsTagsClientCapabilities {_valueSet = List [DtUnnecessary,DtDeprecated]})}), _foldingRange = Just (FoldingRangeClientCapabili ties {_dynamicRegistration = Just True, _rangeLimit = Just 5000, _lineFoldingOnly = Just True})}), _window = Just (WindowClientCapabilities {_workDoneProgress = Just True}), _experimental = Nothing}, _trace = Just TraceOff, _workspaceFolders = Just (List [WorkspaceFolder {_uri = "file:///Users/carterweinberg/servantExample", _name = "servantExample"}])}} "key \"languageServerHaskell\" not found"
48 2020-10-02 20:54:31.919247 [ThreadId 25] - Opened text document: file:///Users/carterweinberg/servantExample/src/ApiType.hs
49 2020-10-02 20:54:31.920451 [ThreadId 76] - Data.HashMap.Internal.(!): key not found
50 CallStack (from HasCallStack):
>> 51 error, called at ./Data/HashMap/Internal.hs:753:16 in nrdrd-cntnrs-0.2.12.0-5534510c:Data.HashMap.Internal
52 !, called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation
Also, here is my CocConfig, just in case that proves necessary.
{
"languageserver": {
"haskell": {
"command": "haskell-language-server-wrapper",
"args": ["--lsp"],
"rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
"filetypes": ["haskell", "lhaskell"]
}
},
"codeLens.enable": true,
"coc.preferences.formatOnSaveFiletypes": ["haskell"],
"coc.preferences.snippets.enable": true
}
Thanks for taking the time to build this everyone!
I think these are some coc.nvim issues, they work with LanguageClient-neovim for me.
There have been some other people with issues with coc.nvim: #435 https://github.com/haskell/haskell-language-server/issues/425#issuecomment-698251431
(FWIW I also have the key not found in my logs, but it doesn't seem to stop hls from working :thinking:)
Yeah its possible there are some CocConfig settings I need to add perhaps? Like I needed to add "codeLens.enable": true in order for codelenses to work, which wasn't mentioned anywhere when I set it up. Maybe there should be a mention in the ReadMe about other Coc configurations you will need to get certain things to work?
I agree that a small section on editor configuration would be useful in the readme, perhaps something along the lines of 'Some features of this language server are exposed as code-lenses, make sure your editor is set to display these if you want them' (and then the relevant settings for coc.nvim and others). (Better yet may be to get coc.nvim to change the default to match vscode!)
Here is a cast of me using HLint and Retrie with coc.nvim in nvim.