Skip to content

Plugins don't seem to be loaded when checking files "in the background" #4631

Open
@martijnbastiaan

Description

@martijnbastiaan

Your environment

Which OS do you use?
Ubuntu 24.04.2 LTS

Which version of GHC do you use and how did you install it?
The Glorious Glasgow Haskell Compilation System, version 9.10.1, GHCup

Reproducer repo: https://github.com/martijnbastiaan/hls-circuit-notation-issue

Which LSP client (editor/plugin) do you use?
VS Code+vscode-haskell

Which version of HLS do you use and how did you install it?
haskell-language-server version: 2.10.0.0 (GHC: 9.10.1) (PATH: /home/martijn/.ghcup/hls/2.10.0.0/lib/haskell-language-server-2.10.0.0/bin/haskell-language-server-wrapper)

Have you configured HLS in any way (especially: a hie.yaml file)?
Yes:

cradle:
  cabal:

Steps to reproduce

  1. Open the project in VSCode
  2. Open File1.hs

Expected behaviour

I expect the "Problems" tab to remain empty

Actual behaviour

HLS complains about File2.hs. See:

Image

When I open File2.hs the error disappears:

Image

Admittedly, this is a bit of a weird setup. It seems like HLS doesn't account for -fplugin Protocols.Plugin when running "in the background", but does run plugins if you're actively looking at a file.

Debug information

The error:

[{
	"resource": "/home/martijn/code/hls-circuit-notation-issue/src/Example/File2.hs",
	"owner": "Haskell (hls-circuit-notation-issue)",
	"code": "GHC-76037",
	"severity": 8,
	"message": "Not in scope: data constructor ‘Fwd’",
	"source": "typecheck",
	"startLineNumber": 7,
	"startColumn": 25,
	"endLineNumber": 7,
	"endColumn": 28
}]

Full debug log:

2025-06-09 15:54:21.4580000 [client] INFO Finding haskell-language-server
2025-06-09 15:54:21.4590000 [client] INFO Searching for server executables haskell-language-server-wrapper,haskell-language-server in $PATH
2025-06-09 15:54:21.4590000 [client] INFO $PATH environment variable: /home/martijn/.local/bin:/home/martijn/.intelFPGA_pro/24.3.1/questa_fse/bin:/home/martijn/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/martijn/.cargo/bin:/home/martijn/.cabal/bin:/home/martijn/.ghcup/bin:/home/martijn/.local/bin:/home/martijn/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
2025-06-09 15:54:21.4850000 [client] INFO Found server executable in $PATH: haskell-language-server-wrapper
2025-06-09 15:54:21.4850000 [client] INFO Support for '.cabal' files: automatic
2025-06-09 15:54:21.4850000 [client] INFO Activating the language server in working dir: /home/martijn/code/hls-circuit-notation-issue (the workspace folder)
2025-06-09 15:54:21.4850000 [client] INFO run command: haskell-language-server-wrapper --lsp
2025-06-09 15:54:21.4850000 [client] INFO debug command: haskell-language-server-wrapper --lsp
2025-06-09 15:54:21.4850000 [client] INFO server cwd: /home/martijn/code/hls-circuit-notation-issue
2025-06-09 15:54:21.4850000 [client] INFO server environment variables:
2025-06-09 15:54:21.4860000 [client] INFO Executing 'haskell-language-server-wrapper --numeric-version' in cwd '/home/martijn/code/hls-circuit-notation-issue'
2025-06-09 15:54:21.5650000 [client] INFO Starting language server
Found "/home/martijn/code/hls-circuit-notation-issue/hie.yaml" for "/home/martijn/code/hls-circuit-notation-issue/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.10.0.0 x86_64 ghc-9.10.1
Current directory: /home/martijn/code/hls-circuit-notation-issue
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/martijn/code/hls-circuit-notation-issue
Cradle type: Cabal

Tool versions found on the $PATH
cabal:          3.14.2.0
stack:          3.5.1
ghc:            9.10.1


Consulting the cradle to get project GHC version...
2025-06-09T15:54:21.904219Z | Debug | cabal exec -v0 -- ghc --print-libdir
2025-06-09T15:54:22.154153Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2025-06-09T15:54:25.897667Z | Debug | cabal --builddir=/home/martijn/.cache/hie-bios/dist-hls-circuit-notation-issue-c8615290b1831e15b19b85497ebff8bd v2-exec --with-compiler /home/martijn/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/martijn/.cache/hie-bios/ghc-pkg-d061e0c34ff5b58e65abac34f47b8125 ghc -v0 -- --numeric-version
  Environment Variables
    HIE_BIOS_GHC: /home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/bin/ghc-9.10.1
    HIE_BIOS_GHC_ARGS: -B/home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/lib
Project GHC version: 9.10.1
haskell-language-server exe candidates: ["haskell-language-server-9.10.1","haskell-language-server"]
Launching haskell-language-server exe at:/home/martijn/.ghcup/bin/haskell-language-server-9.10.1
2025-06-09T15:54:26.055552Z | Debug | cabal exec -v0 -- ghc --print-libdir
2025-06-09T15:54:26.277087Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2025-06-09T15:54:27.628854Z | Debug | cabal --builddir=/home/martijn/.cache/hie-bios/dist-hls-circuit-notation-issue-c8615290b1831e15b19b85497ebff8bd v2-exec --with-compiler /home/martijn/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/martijn/.cache/hie-bios/ghc-pkg-d061e0c34ff5b58e65abac34f47b8125 ghc -v0 -- -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
  Environment Variables
    HIE_BIOS_GHC: /home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/bin/ghc-9.10.1
    HIE_BIOS_GHC_ARGS: -B/home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/lib
2025-06-09T15:54:27.785951Z | Debug | cabal exec -v0 -- ghc --print-libdir
2025-06-09T15:54:28.029720Z | Debug | cabal exec -v0 -- ghc -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2025-06-09T15:54:28.184950Z | Debug | cabal --builddir=/home/martijn/.cache/hie-bios/dist-hls-circuit-notation-issue-c8615290b1831e15b19b85497ebff8bd v2-exec --with-compiler /home/martijn/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/martijn/.cache/hie-bios/ghc-pkg-d061e0c34ff5b58e65abac34f47b8125 ghc -v0 -- --print-libdir
  Environment Variables
    HIE_BIOS_GHC: /home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/bin/ghc-9.10.1
    HIE_BIOS_GHC_ARGS: -B/home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/lib
2025-06-09T15:54:29.804698Z | Info | haskell-language-server version: 2.10.0.0 (GHC: 9.10.1) (PATH: /home/martijn/.ghcup/hls/2.10.0.0/lib/haskell-language-server-2.10.0.0/bin/haskell-language-server-9.10.1)
2025-06-09T15:54:29.806426Z | Info | Directory: /home/martijn/code/hls-circuit-notation-issue
2025-06-09T15:54:29.806733Z | Info | Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsLogLevel = Info, argsLogFile = Nothing, argsLogStderr = True, argsLogClient = False, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas-suggest
             , pragmas-completion
             , ghcide-code-actions-bindings
             , cabalHaskellIntegration
             , ghcide-extend-import-action
             , explicit-fields
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-fill-holes
             , stan
             , changeTypeSignature
             , ghcide-code-actions-imports-exports
             , cabal-fmt
             , notes
             , ghcide-completions
             , eval
             , ghcide-type-lenses
             , cabal
             , overloaded-record-dot
             , gadt
             , LSPRecorderCallback
             , importLens
             , codeRange
             , class
             , ormolu
             , qualifyImportedNames
             , ghcide-hover-and-symbols
             , alternateNumberFormat
             , rename
             , moduleName
             , semanticTokens
             , fourmolu
             , cabal-gild
             , callHierarchy
             , ghcide-core
             , explicit-fixity
             , pragmas-disable ]
2025-06-09T15:54:29.812190Z | Info | Logging heap statistics every 60.00s
 2025-06-09T15:54:29.833992Z | Info | Starting LSP server...
  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
  PluginIds: [ pragmas-suggest
             , pragmas-completion
             , ghcide-code-actions-bindings
             , cabalHaskellIntegration
             , ghcide-extend-import-action
             , explicit-fields
             , ghcide-code-actions-type-signatures
             , ghcide-code-actions-fill-holes
             , stan
             , changeTypeSignature
             , ghcide-code-actions-imports-exports
             , cabal-fmt
             , notes
             , ghcide-completions
             , eval
             , ghcide-type-lenses
             , cabal
             , overloaded-record-dot
             , gadt
             , LSPRecorderCallback
             , importLens
             , codeRange
             , class
             , ormolu
             , qualifyImportedNames
             , ghcide-hover-and-symbols
             , alternateNumberFormat
             , rename
             , moduleName
             , semanticTokens
             , fourmolu
             , cabal-gild
             , callHierarchy
             , ghcide-core
             , explicit-fixity
             , pragmas-disable ]
2025-06-09T15:54:29.834357Z | Info | Starting server
2025-06-09T15:54:29.863629Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-2030193280501794071) "file:///home/martijn/code/hls-circuit-notation-issue"], clientSettings = hashed Nothing}
2025-06-09T15:54:29.938897Z | Info | Started LSP server in 0.10s
2025-06-09T15:54:29.959955Z | Info | Cradle path: src/Example/File1.hs
2025-06-09T15:54:29.961833Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2025-06-09T15:54:30.490760Z | Warning | No plugin handles this "textDocument/semanticTokens/full" request.
[Error - 5:54:30 PM] Request textDocument/semanticTokens/full failed.
  Message: No plugins are available to handle this SMethod_TextDocumentSemanticTokensFull request.
 Plugins installed for this method, but not available to handle this request are:
semanticTokens is disabled globally in your config.
  Code: -32601 
2025-06-09T15:54:30.545196Z | Info | Load cabal cradle using single file
2025-06-09T15:54:30.954638Z | Info | cabal --builddir=/home/martijn/.cache/hie-bios/dist-hls-circuit-notation-issue-c8615290b1831e15b19b85497ebff8bd v2-repl --with-compiler /home/martijn/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/martijn/.cache/hie-bios/ghc-pkg-d061e0c34ff5b58e65abac34f47b8125 /home/martijn/code/hls-circuit-notation-issue/src/Example/File1.hs
  Environment Variables
    HIE_BIOS_OUTPUT: /tmp/HIE_BIOS_OUTPUT19047-0
    HIE_BIOS_GHC: /home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/bin/ghc-9.10.1
    HIE_BIOS_GHC_ARGS: -B/home/martijn/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/lib
2025-06-09T15:54:33.438149Z | Info | Interface files cache directory: /home/martijn/.cache/ghcide/hls-circuit-notation-issue-0.1-inplace-de41e51ad88ba237ca80cd151338d6297cdcd330
2025-06-09T15:54:33.443593Z | Info | Making new HscEnv. In-place unit ids: [hls-circuit-notation-issue-0.1-inplace]

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: 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