I am having problems when using the vscode-haskell extension.
I am using ghcup to manage all my haskell related stuff.
I want to use haskell 9.4.8 for my exercise, but the hls is keeping popping this and unable to provide autocomplete support. Can anyone help?
My Vscode Workspace settings are
{
"haskell.manageHLS": "GHCup",
"haskell.serverEnvironment": {
"PATH": "${HOME}/.ghcup/bin:$PATH"
},
"haskell.toolchain": {
"ghc": "9.4.8",
"hls": "2.5.0.0",
"cabal": "recommended"
}
}
2024-01-18T03:15:08.330017Z | Error | LSP: no handler for: "textDocument/didOpen"
2024-01-18T03:15:08.330316Z | Debug | LSP: set new config: {
"checkProject": true,
"formattingProvider": "brittany",
"ghcupExecutablePath": "",
"indentationRules": { "enabled": true },
"logFile": "",
"manageHLS": "GHCup",
"maxCompletions": 40,
"metadataURL": "",
"openDocumentationInHackage": true,
"openSourceInHackage": true,
"plugin": {
"alternateNumberFormat": { "globalOn": true },
"cabal": {
"codeActionsOn": true,
"completionOn": true,
"diagnosticsOn": true
},
"callHierarchy": { "globalOn": true },
"changeTypeSignature": { "globalOn": true },
"class": { "codeActionsOn": true, "codeLensOn": true },
"eval": {
"config": { "diff": true, "exception": false },
"globalOn": true
},
"explicit-fields": { "globalOn": true },
"explicit-fixity": { "globalOn": true },
"fourmolu": { "config": { "external": false } },
"gadt": { "globalOn": true },
"ghcide-code-actions-bindings": { "globalOn": true },
"ghcide-code-actions-fill-holes": { "globalOn": true },
"ghcide-code-actions-imports-exports": { "globalOn": true },
"ghcide-code-actions-type-signatures": { "globalOn": true },
"ghcide-completions": {
"config": { "autoExtendOn": true, "snippetsOn": true },
"globalOn": true
},
"ghcide-hover-and-symbols": { "hoverOn": true, "symbolsOn": true },
"ghcide-type-lenses": { "config": { "mode": "always" }, "globalOn": true },
"hlint": {
"codeActionsOn": true,
"config": { "flags": [ ] },
"diagnosticsOn": true
},
"importLens": { "codeActionsOn": true, "codeLensOn": true },
"moduleName": { "globalOn": true },
"ormolu": { "config": { "external": false } },
"overloaded-record-dot": { "globalOn": true },
"pragmas-completion": { "globalOn": true },
"pragmas-disable": { "globalOn": true },
"pragmas-suggest": { "globalOn": true },
"qualifyImportedNames": { "globalOn": true },
"rename": { "config": { "crossModule": false }, "globalOn": true },
"retrie": { "globalOn": true },
"semanticTokens": {
"config": {
"classMethodToken": "method",
"classToken": "class",
"dataConstructorToken": "enumMember",
"functionToken": "function",
"patternSynonymToken": "macro",
"recordFieldToken": "property",
"typeConstructorToken": "enum",
"typeFamilyToken": "interface",
"typeSynonymToken": "type",
"typeVariableToken": "typeParameter",
"variableToken": "variable"
},
"globalOn": false
},
"splice": { "globalOn": true },
"stan": { "globalOn": false }
},
"promptBeforeDownloads": "true",
"releasesDownloadStoragePath": "",
"releasesURL": "",
"serverEnvironment": { "PATH": "${HOME}/.ghcup/bin:$PATH" },
"serverExecutablePath": "",
"serverExtraArgs": "",
"toolchain": { "cabal": "recommended", "ghc": "9.4.8", "hls": "2.5.0.0" },
"trace": { "client": "debug", "server": "messages" },
"upgradeGHCup": true
}
Here I attach the output of vscode-haskell.
Your project is a stack project which means that resolver
field in stack.yaml
controls the ghc version and not GHCUp. For example, resolver version lts-21.25
has ghc version 9.4.8.
Change the resolver version to lts-21.25
and that should fix it.