Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eval Plugin won't run on module with CPP pragma #1216

Closed
konn opened this issue Jan 17, 2021 · 5 comments · Fixed by #1224
Closed

Eval Plugin won't run on module with CPP pragma #1216

konn opened this issue Jan 17, 2021 · 5 comments · Fixed by #1224
Labels
component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@konn
Copy link
Collaborator

konn commented Jan 17, 2021

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

$ /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server --probe-tools
haskell-language-server version: 0.8.0.0 (GHC: 8.6.5) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server) (GIT hash: 4b0e4560361ce429e09e6708ae8a845e2d37d2cd)
Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.5.1

Which lsp-client do you use: VSCode

Describe your project (alternative: link to the project): The following module alone

{-# LANGUAGE CPP #-}

module Lib where

-- >>> 5

Contents of hie.yaml: No hie.yaml (because it can be run as a single module)

Steps to reproduce

  1. Wait for HLS loading a module and Evaluate code lens appears above -- >>> 5
  2. Click Evaluate

Expected behaviour

A line with contents -- 5 must be appended below.

Actual behaviour

Nothing happens.

If one removes {-# LANGUAGE CPP #-}, everything works fine.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
haskell-language-server version: 0.8.0.0 (GHC: 8.6.5) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server) (GIT hash: 4b0e4560361ce429e09e6708ae8a845e2d37d2cd)
(haskell-language-server)Ghcide setup tester in /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.5.1
ghc:            8.6.5


Step 1/4: Finding files to test in /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit
Found 4 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
[INFO] Consulting the cradle for "test/Spec.hs"
NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for test/Spec.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."}})
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack}
> Using main module: 1. Package `bugs-sandpit' component bugs-sandpit:test:bugs-sandpit-test with main-is file: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/test/Spec.hs
> bugs-sandpit> configure (lib + test)
> Configuring bugs-sandpit-0.1.0.0...
> bugs-sandpit> initial-build-steps (lib + test)
> bugs-sandpit> Test running disabled by --no-run-tests flag.
> Completed 2 action(s).
> The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
> Configuring GHCi with the following packages: bugs-sandpit
> /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d
[INFO] Using interface files cache dir: ghcide
[INFO] Making new HscEnv[main]
[INFO] Consulting the cradle for "Setup.hs"
NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Setup.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."}})
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack}
File:     /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/Setup.hs
Hidden:   no
Range:    1:1-2:1
Source:   cradle
Severity: DsError
Message: 
  Multi Cradle: No prefixes matched
  pwd: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit
  filepath: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/Setup.hs
  prefixes:
  ("./src",Stack {component = Just "bugs-sandpit:lib", stackYaml = Nothing})
  ("./app/Main.hs",Stack {component = Just "bugs-sandpit:exe:bugs-sandpit-exe", stackYaml =
  Nothing})
  ("./app/Paths_bugs_sandpit.hs",Stack {component = Just "bugs-sandpit:exe:bugs-sandpit-exe",
  stackYaml = Nothing})
  ("./test",Stack {component = Just "bugs-sandpit:test:bugs-sandpit-test", stackYaml = Nothing})
[INFO] Consulting the cradle for "src/Lib.hs"
NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Lib.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."}})
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack}
> bugs-sandpit> configure (lib)
> Configuring bugs-sandpit-0.1.0.0...
> bugs-sandpit> initial-build-steps (lib)
> Configuring GHCi with the following packages: bugs-sandpit
> /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d
[INFO] Using interface files cache dir: ghcide
[INFO] Using interface files cache dir: ghcide
[INFO] Making new HscEnv[main,main]
[INFO] Consulting the cradle for "Setup.hs"
NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Setup.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."}})
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack}
[INFO] Consulting the cradle for "app/Main.hs"
NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for app/Main.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."}})
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack}
> Using main module: 1. Package `bugs-sandpit' component bugs-sandpit:exe:bugs-sandpit-exe with main-is file: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/app/Main.hs
> bugs-sandpit> configure (lib + exe)
> Configuring bugs-sandpit-0.1.0.0...
> bugs-sandpit> initial-build-steps (lib + exe)
> The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
> Configuring GHCi with the following packages: bugs-sandpit
> /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d
[INFO] Using interface files cache dir: ghcide
[INFO] Using interface files cache dir: ghcide
[INFO] Using interface files cache dir: ghcide
[INFO] Making new HscEnv[main,main,main]
[INFO] Consulting the cradle for "Setup.hs"
NotShowMessage (NotificationMessage {_jsonrpc = "2.0", _method = WindowShowMessage, _params = ShowMessageParams {_xtype = MtInfo, _message = "No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Setup.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."}})
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack}
[INFO] finish: User TypeCheck (took 0.08s)
Files that failed:
 * /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/Setup.hs

Completed (3 files worked, 1 file failed)

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
[client] run command: "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server --lsp"
[client] debug command: "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server --lsp"
[client] server cwd: undefined
haskell-language-server version: 0.8.0.0 (GHC: 8.6.5) (PATH: /Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server) (GIT hash: 4b0e4560361ce429e09e6708ae8a845e2d37d2cd)
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 "haddockComments",PluginId "hlint",PluginId "importLens",PluginId "moduleName",PluginId "ormolu",PluginId "pragmas",PluginId "retrie",PluginId "splice",PluginId "stylish-haskell",PluginId "tactic"]
  in directory: /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
 Started LSP server in 0.01s
2021-01-17 12:20:01.356235 [ThreadId 38] - Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 2448812684686715143 "file:///Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit"], clientSettings = hashed Nothing}
2021-01-17 12:20:01.452382 [ThreadId 38] - Configuration changed: Object (fromList [("haskell",Object (fromList [("hlint",Object (fromList [("logLevel",String "info"),("executablePath",String "/Users/hiromi/.local/bin/hlint")])),("logFile",String ""),("updateBehavior",String "keep-up-to-date"),("hlintOn",Bool True),("formatOnImportOn",Bool True),("indentationRules",Object (fromList [("enabled",Bool True)])),("liquidOn",Bool False),("languageServerVariant",String "haskell-language-server"),("serverExecutablePath",String "/Users/hiromi/Documents/Programming/Haskell/git/haskell-language-server/.stack-work/install/x86_64-osx/646dfbb1422d7c2bfa3a267d60b0919661541f00370d5b1a6cea365221b8edf3/8.6.5/bin/haskell-language-server"),("diagnosticsOnChange",Bool True),("completionSnippetsOn",Bool True),("maxNumberOfProblems",Number 100.0),("formattingProvider",String "fourmolu"),("trace",Object (fromList [("server",String "off")]))]))])
2021-01-17 12:20:01.453491 [ThreadId 38] - Opened text document: file:///Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/src/Lib.hs
2021-01-17 12:20:01.454751 [ThreadId 103] - hlint:getIdeas:file:NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/src/Lib.hs"
2021-01-17 12:20:01.457092 [ThreadId 111] - Consulting the cradle for "src/Lib.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit", cradleOptsProg = CradleAction: Stack}
2021-01-17 12:20:01.768505 [ThreadId 128] - Plugin.makeCodeLens (ideLogger)
> bugs-sandpit> configure (lib)
> Configuring bugs-sandpit-0.1.0.0...
> bugs-sandpit> initial-build-steps (lib)
> Configuring GHCi with the following packages: bugs-sandpit
> /Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/.stack-work/install/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/snapshots/x86_64-osx/c275d7ac429b81ae69e7fd736283a1c088617d1c517b6df07d12b0f7409733b3/8.6.5/pkgdb:/Users/hiromi/.stack/programs/x86_64-osx/ghc-8.6.5/lib/ghc-8.6.5/package.conf.d
2021-01-17 12:20:05.078533 [ThreadId 111] - Using interface files cache dir: ghcide
2021-01-17 12:20:05.078617 [ThreadId 111] - Making new HscEnv[main]
2021-01-17 12:20:05.102253 [ThreadId 191] - hlint:getIdeas:file:NormalizedFilePath "/Users/hiromi/Documents/Programming/Haskell/git/bugs-sandpit/src/Lib.hs"
2021-01-17 12:20:05.104744 [ThreadId 233] - finish: getSession (took 0.00s)
2021-01-17 12:20:05.152677 [ThreadId 278] - finish: Outline (took 0.05s)
2021-01-17 12:20:05.152686 [ThreadId 280] - hlint:getIdeas:setExtensions:[Cpp,OverlappingInstances,UndecidableInstances,IncoherentInstances,UndecidableSuperClasses,MonomorphismRestriction,MonoPatBinds,MonoLocalBinds,RelaxedPolyRec,ExtendedDefaultRules,ForeignFunctionInterface,UnliftedFFITypes,InterruptibleFFI,CApiFFI,GHCForeignImportPrim,JavaScriptFFI,ParallelArrays,TemplateHaskell,TemplateHaskellQuotes,ImplicitParams,ImplicitPrelude,ScopedTypeVariables,AllowAmbiguousTypes,UnliftedNewtypes,BangPatterns,TypeFamilies,TypeFamilyDependencies,TypeInType,OverloadedStrings,OverloadedLists,NumDecimals,DisambiguateRecordFields,RecordWildCards,RecordPuns,ViewPatterns,GADTs,GADTSyntax,NPlusKPatterns,DoAndIfThenElse,BlockArguments,RebindableSyntax,ConstraintKinds,PolyKinds,DataKinds,InstanceSigs,ApplicativeDo,StandaloneDeriving,DeriveDataTypeable,AutoDeriveTypeable,DeriveFunctor,DeriveTraversable,DeriveFoldable,DeriveGeneric,DefaultSignatures,DeriveAnyClass,DeriveLift,DerivingStrategies,DerivingVia,TypeSynonymInstances,FlexibleContexts,FlexibleInstances,ConstrainedClassMethods,MultiParamTypeClasses,NullaryTypeClasses,FunctionalDependencies,UnicodeSyntax,ExistentialQuantification,MagicHash,EmptyDataDecls,KindSignatures,RoleAnnotations,ParallelListComp,MonadComprehensions,GeneralizedNewtypeDeriving,PostfixOperators,TupleSections,PatternGuards,LiberalTypeSynonyms,RankNTypes,ImpredicativeTypes,TypeOperators,ExplicitNamespaces,PackageImports,ExplicitForAll,AlternativeLayoutRuleTransitional,DatatypeContexts,NondecreasingIndentation,RelaxedLayout,TraditionalRecordSyntax,LambdaCase,MultiWayIf,BinaryLiterals,HexFloatLiterals,DuplicateRecordFields,OverloadedLabels,EmptyCase,PatternSynonyms,PartialTypeSignatures,NamedWildCards,TypeApplications,Strict,StrictData,MonadFailDesugaring,EmptyDataDeriving,NumericUnderscores,QuantifiedConstraints,ImportQualifiedPost,CUSKs,StandaloneKindSignatures,StarIsType]
2021-01-17 12:20:05.175963 [ThreadId 419] - finish: codeLens (took 0.03s)
2021-01-17 12:20:05.176705 [ThreadId 431] - finish:  (took 0.00s)
2021-01-17 12:20:05.177386 [ThreadId 432] - finish: ModuleName.ghcSession (took 0.00s)
2021-01-17 12:20:05.178302 [ThreadId 437] - finish: ModuleName.GetParsedModule (took 0.00s)
2021-01-17 12:20:06.400161 [ThreadId 448] - finish: getSession (took 0.00s)
2021-01-17 12:20:06.400349 [ThreadId 450] - finish: runEvalCmd.getModSummary (took 0.00s)
[Error - 12:20:06] Request workspace/executeCommand failed.
  Message: buffer needs preprocesing; interactive check disabled
  Code: -32603 

Environments

  • macOS Catallina 10.15.7(19H2)
  • VSCode 1.52.1
  • HLS: built from master (4b0e456)
@jneira jneira added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. component: hls-eval-plugin status: regression test needed labels Jan 17, 2021
@pepeiborra
Copy link
Collaborator

pepeiborra commented Jan 17, 2021

@tittoassini I thought that you had fixed the CPP support. I certainly remember asking for it in the Pull Request as a condition for merging.

@tittoassini
Copy link
Contributor

@konn, CPP support works for ghc >= 8.8.

@tittoassini
Copy link
Contributor

Sorry for not clarifying the point in the Tutorial, I have fixed that.

@konn
Copy link
Collaborator Author

konn commented Jan 18, 2021

Thank you for the clarification!
Just curious, but what prevents Eval with CPP in GHC 8.6?

@tittoassini
Copy link
Contributor

I am not really sure @konn.

An error thrown by (I believe) Development.IDE.Core.Preprocessor.preprocessor:

"buffer needs preprocesing; interactive check disabled"

@mergify mergify bot closed this as completed in #1224 Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-eval-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants