Skip to content

Code messed up by FixIt to insert default implementation for Semigroup's <> #4731

@Aster89

Description

@Aster89

Your environment

Which OS do you use?
up-to-date ArchLinux
Which version of GHC do you use and how did you install it?
GHC 9.10.1 from ghcup 0.1.50.2
How is your project built (alternative: link to the project)?
Just a 5-lines file:

data Set a = Set

instance Semigroup (Set a) where

instance Monoid (Set a) where

Which LSP client (editor/plugin) do you use?
terminal Vim + YCM
Which version of HLS do you use and how did you install it?
HLS 2.11.0.0 from ghcup 0.1.50.2
Have you configured HLS in any way (especially: a hie.yaml file)?
Not that I'm aware of

Steps to reproduce

Request the FixIt on the line defining instance Semigroup (Set a) where, and choose the first option Add placeholders for '<>'.

Expected behaviour

The buffer should become like this:

data Set a = Set

instance Semigroup (Set a) where
  (<>) = _

instance Monoid (Set a) where

Actual behaviour

The buffer content is changed to this:

data Set a = Set

instance Semigroup (Set a) where
  (<>) = _





instanceMonoid (Set a) where

Debug information

No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 2.11.0.0 x86_64 ghc-9.10.1
Current directory: /home/enrico
Operating system: linux
Arguments: ["--debug","--lsp"]
Cradle directory: /home/enrico
Cradle type: Default

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


Consulting the cradle to get project GHC version...
2025-09-22T10:22:57.671725Z | Debug | ghc --numeric-version
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/enrico/.ghcup/bin/haskell-language-server-9.10.1
2025-09-22T10:22:57.768531Z | Debug | ghc -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2025-09-22T10:22:57.795532Z | Debug | ghc --print-libdir
2025-09-22T10:22:58.245224Z | Info | haskell-language-server version: 2.11.0.0 (GHC: 9.10.1) (PATH: /home/enrico/.ghcup/bin/haskell-language-server-9.10.1~2.11.0.0)
2025-09-22T10:22:58.245811Z | Info | Directory: /home/enrico
2025-09-22T10:22:58.245914Z | Info | Starting (haskell-language-server) LSP server...
  GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsLogLevel = Debug, argsLogFile = Nothing, argsLogStderr = True, argsLogClient = False, argsThreads = 0, argsProjectGhcVersion = False}
  PluginIds: [ pragmas-suggest
             , pragmas-completion
             , ghcide-code-actions-bindings
             , cabalHaskellIntegration
             , ghcide-extend-import-action
             , stylish-haskell
             , 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-09-22T10:22:58.247578Z | Info | Logging heap statistics every 60.00s
 2025-09-22T10:22:58.251510Z | 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
             , stylish-haskell
             , 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-09-22T10:22:58.251773Z | Info | Starting server
2025-09-22T10:22:58.252404Z | Debug | LSP: set new config: {  }
2025-09-22T10:22:58.252840Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-7191819183657831203) "file:///home/enrico"], clientSettings = hashed (Just (Object (fromList [])))}
2025-09-22T10:22:58.254548Z | Info | Started LSP server in 0.00s
2025-09-22T10:22:58.254627Z | Debug | shouldRunSubset: True
2025-09-22T10:22:58.254739Z | Debug | Initializing exports map from hiedb
2025-09-22T10:22:58.255232Z | Debug | Done initializing exports map from hiedb. Size: 2
2025-09-22T10:22:58.255728Z | Warning | LSP: can't register dynamically for: "workspace/didChangeConfiguration"
2025-09-22T10:22:58.255792Z | Debug | LSP: not requesting configuration since the client does not support workspace/configuration
2025-09-22T10:22:58.255861Z | Debug | LSP: set new config: {  }
2025-09-22T10:22:58.255947Z | Debug | Shake session initialized
2025-09-22T10:22:58.256052Z | Debug | Finished build session
AsyncCancelled
HasCallStack backtrace:
  collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
  throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:195:43 in ghc-internal:GHC.Internal.Control.Exception.Base


2025-09-22T10:22:58.256071Z | Debug | Configuration changed: Config {checkParents = CheckOnSave, checkProject = True, formattingProvider = "ormolu", cabalFormattingProvider = "cabal-gild", maxCompletions = 40, sessionLoading = PreferSingleComponentLoading, plugins = fromList []}
2025-09-22T10:22:58.256263Z | Debug | Restarting build session due to config change
Action Queue: []
Keys: [GetClientSettings; ]
Aborting previous build session took 0.00s 
2025-09-22T10:22:58.256388Z | Debug | LSP: not requesting configuration since the client does not support workspace/configuration
2025-09-22T10:22:58.256529Z | Debug | VFS: opening file:///home/enrico/uffa.hs
2025-09-22T10:22:58.256868Z | Debug | Finished build session
AsyncCancelled
HasCallStack backtrace:
  collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
  throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:195:43 in ghc-internal:GHC.Internal.Control.Exception.Base


2025-09-22T10:22:58.256907Z | Debug | Set files of interst to
    [(/home/enrico/uffa.hs, Modified {firstOpen = True})]
2025-09-22T10:22:58.257123Z | Debug | Restarting build session due to /home/enrico/uffa.hs (modified)
Action Queue: []
Keys: [ GetClientSettings; 
      , GetModificationTime; /home/enrico/uffa.hs
      , IsFileOfInterest; /home/enrico/uffa.hs ]
Aborting previous build session took 0.00s 
2025-09-22T10:22:58.257199Z | Debug | Opened text document: file:///home/enrico/uffa.hs
2025-09-22T10:22:58.257556Z | Info | Cradle path: uffa.hs
2025-09-22T10:22:58.257633Z | Warning | No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for uffa.hs.
Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
2025-09-22T10:22:58.259544Z | Debug | Cradle: Cradle{ cradleRootDir = "/home/enrico", cradleOptsProg = CradleAction: Default}
2025-09-22T10:22:58.259607Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2025-09-22T10:22:58.290384Z | Debug | ghc --print-libdir
2025-09-22T10:22:58.319649Z | Debug | ghc --numeric-version
2025-09-22T10:22:58.319843Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-dynamic"], componentRoot = "/home/enrico", componentDependencies = []},"/home/enrico/.ghcup/ghc/9.10.1/lib/ghc-9.10.1/lib","9.10.1")
2025-09-22T10:22:58.326563Z | Info | Interface files cache directory: /home/enrico/.cache/ghcide/main-1a596a151463f2c53ee4feb14ecd276a1ccebfda-1a596a151463f2c53ee4feb14ecd276a1ccebfda
2025-09-22T10:22:58.332026Z | Info | Making new HscEnv. In-place unit ids: [ main-1a596a151463f2c53ee4feb14ecd276a1ccebfda ]
2025-09-22T10:22:58.428986Z | Debug | New component cache HscEnvEq: (([],Just HscEnvEq 5),fromList [])
2025-09-22T10:22:58.429657Z | Debug | Finished build session
AsyncCancelled
HasCallStack backtrace:
  collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
  throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:195:43 in ghc-internal:GHC.Internal.Control.Exception.Base


2025-09-22T10:22:58.429722Z | Debug | Known files updated:
  fromList [(TargetFile NormalizedFilePath "/home/enrico/uffa.hs",fromList ["/home/enrico/uffa.hs"])]
2025-09-22T10:22:58.429900Z | Debug | Restarting build session due to new component
Action Queue: []
Keys: [ IsFileOfInterest; /home/enrico/uffa.hs
      , GhcSessionIO; 
      , GetKnownTargets;  ]
Aborting previous build session took 0.00s 
2025-09-22T10:22:58.453591Z | Debug | Finished: InitialLoad Took: 0.02s
2025-09-22T10:23:17.675151Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2025-09-22T10:23:17.675735Z | Debug | Finished: cabal.cabal-add Took: 0.00s
2025-09-22T10:23:17.676997Z | Debug | eval: fp /home/enrico/uffa.hs
2025-09-22T10:23:17.678147Z | Debug | Finished: Pragmas.GhcSession Took: 0.00s
2025-09-22T10:23:17.678432Z | Debug | Finished: classplugin.codeAction.getVersionedTextDoc Took: 0.00s
2025-09-22T10:23:17.678516Z | Debug | Finished: changeTypeSignature.GetParsedModule Took: 0.00s
2025-09-22T10:23:17.678738Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2025-09-22T10:23:17.679058Z | Debug | Finished: QualifyImportedNames.TypeCheck Took: 0.00s
2025-09-22T10:23:17.679114Z | Debug | Finished: Pragmas.GetFileContents Took: 0.00s
2025-09-22T10:23:17.679408Z | Debug | Finished: classplugin.findClassIdentifier.GetHieAst Took: 0.00s
2025-09-22T10:23:17.679419Z | Debug | Finished: Pragmas.GetParsedModule Took: 0.00s
2025-09-22T10:23:17.679440Z | Debug | Finished: Pragmas.GhcSession Took: 0.00s
2025-09-22T10:23:17.679985Z | Debug | Finished: Pragmas.GetFileContents Took: 0.00s
2025-09-22T10:23:17.680244Z | Debug | Finished: classplugin.findClassFromIdentifier.GhcSessionDeps Took: 0.00s
2025-09-22T10:23:17.680295Z | Debug | Finished: Pragmas.GetParsedModule Took: 0.00s
2025-09-22T10:23:17.680637Z | Debug | overloaded-record-dot: Collected record selectors: []
2025-09-22T10:23:17.681264Z | Debug | Finished: classplugin.findClassFromIdentifier.TypeCheck Took: 0.00s
2025-09-22T10:23:17.681376Z | Debug | Finished: GADT.GetParsedModuleWithComments Took: 0.00s
2025-09-22T10:23:17.681382Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2025-09-22T10:23:17.682060Z | Debug | Finished: GhcideCodeActions.GetGlobalBindingTypeSigs Took: 0.01s
2025-09-22T10:23:17.683317Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2025-09-22T10:23:17.684632Z | Debug | explicit-fields: Collected records with wildcards: []
2025-09-22T10:23:17.684684Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.01s
2025-09-22T10:23:17.685603Z | Debug | Finished: GhcideCodeActions.getIdeOptions Took: 0.00s
2025-09-22T10:23:17.685645Z | Debug | Finished: GhcideCodeActions.GhcSession Took: 0.00s
2025-09-22T10:23:17.686879Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2025-09-22T10:23:17.689328Z | Debug | Finished: eval.GetParsedModuleWithComments Took: 0.01s
2025-09-22T10:23:17.690561Z | Debug | eval: comments Comments {lineComments = fromList [], blockComments = fromList []}
2025-09-22T10:23:17.690612Z | Debug | Finished: alternateNumberFormat.CollectLiterals Took: 0.01s
2025-09-22T10:23:17.690702Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2025-09-22T10:23:17.690723Z | Debug | Finished: ExplicitFields.CollectRecords Took: 0.02s
2025-09-22T10:23:17.691028Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
2025-09-22T10:23:17.691105Z | Debug | eval: Tests 0 tests in 0 sections 0 setups 0 lenses.
2025-09-22T10:23:17.691319Z | Debug | Finished: overloadedRecordDot.collectRecordSelectors Took: 0.01s
2025-09-22T10:23:17.691565Z | Debug | Finished: alternateNumberFormat.GhcSession Took: 0.00s
2025-09-22T10:23:17.691680Z | Debug | Finished: classplugin.codeAction.GetInstanceBindTypeSigs Took: 0.01s
2025-09-22T10:23:17.691730Z | Debug | Finished: alternateNumberFormat.GetFileContents Took: 0.00s
2025-09-22T10:23:17.691797Z | Debug | Finished: ImportActions Took: 0.01s
2025-09-22T10:23:17.691844Z | Debug | Finished: classplugin.codeAction.TypeCheck Took: 0.00s
2025-09-22T10:23:17.691873Z | Debug | Finished: classplugin.codeAction.GhcSession Took: 0.00s
2025-09-22T10:23:17.691880Z | Info | class: Detected implemented methods for class "Semigroup": []
2025-09-22T10:23:17.692243Z | Debug | eval: tests: 0.00s
2025-09-22T10:23:17.693035Z | Debug | eval: evalMkRangeCommands: 0.02s
2025-09-22T10:23:17.737121Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
2025-09-22T10:23:17.738288Z | Debug | Finished: GhcideCodeActions.TypeCheck Took: 0.00s
2025-09-22T10:23:17.738352Z | Debug | Finished: GhcideCodeActions.GetHieAst Took: 0.00s
2025-09-22T10:23:17.742407Z | Debug | Finished: hls-refactor-plugin.codeAction.getUriContents Took: 0.00s
2025-09-22T10:23:17.742507Z | Debug | Finished: GhcideCodeActions.getParsedModule Took: 0.00s
2025-09-22T10:23:18.522359Z | Debug | Finished: classplugin.addMethodPlaceholders.GetParsedModule Took: 0.00s
2025-09-22T10:23:18.522499Z | Debug | Finished: classplugin.addMethodPlaceholders.GhcSessionDeps Took: 0.00s
2025-09-22T10:23:18.523227Z | Debug | Finished: classplugin.insertPragmaIfNotPresent.GhcSession Took: 0.00s
2025-09-22T10:23:18.523363Z | Debug | Finished: classplugin.insertPragmaIfNotPresent.GetFileContents Took: 0.00s
2025-09-22T10:23:18.523647Z | Debug | Finished: classplugin.insertPragmaIfNotPresent.GetParsedModuleWithComments Took: 0.00s
2025-09-22T10:23:18.561087Z | Debug | Finished build session
AsyncCancelled
HasCallStack backtrace:
  collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/IO.hs:260:11 in ghc-internal:GHC.Internal.IO
  throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Exception/Base.hs:195:43 in ghc-internal:GHC.Internal.Control.Exception.Base


2025-09-22T10:23:18.561218Z | Debug | Set files of interst to
    [(/home/enrico/uffa.hs, Modified {firstOpen = False})]
2025-09-22T10:23:18.561730Z | Debug | Restarting build session due to /home/enrico/uffa.hs (modified)
Action Queue: []
Keys: [ GetModificationTime; /home/enrico/uffa.hs
      , IsFileOfInterest; /home/enrico/uffa.hs ]
Aborting previous build session took 0.00s 
2025-09-22T10:23:18.561902Z | Debug | Modified text document: file:///home/enrico/uffa.hs

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triagetype: 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