From e198757cef3663a715048904d69618b023df2819 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Thu, 25 Nov 2021 06:03:09 +0000 Subject: [PATCH] configureCheckProject --- ghcide/test/exe/Main.hs | 7 ++----- ghcide/test/src/Development/IDE/Test.hs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ghcide/test/exe/Main.hs b/ghcide/test/exe/Main.hs index 21f2939d5b9..b61eeb32fb8 100644 --- a/ghcide/test/exe/Main.hs +++ b/ghcide/test/exe/Main.hs @@ -53,7 +53,7 @@ import Development.IDE.Test (Cursor, getInterfaceFilesDir, waitForAction, getStoredKeys, - waitForTypecheck, waitForGC) + waitForTypecheck, waitForGC, configureCheckProject) import Development.IDE.Test.Runfiles import qualified Development.IDE.Types.Diagnostics as Diagnostics import Development.IDE.Types.Location @@ -1603,10 +1603,7 @@ extendImportTests = testGroup "extend import actions" codeActionTitle CodeAction{_title=x} = x template setUpModules moduleUnderTest range expectedTitles expectedContentB = do - sendNotification SWorkspaceDidChangeConfiguration - (DidChangeConfigurationParams $ toJSON - def{checkProject = overrideCheckProject}) - + configureCheckProject overrideCheckProject mapM_ (\x -> createDoc (fst x) "haskell" (snd x)) setUpModules docB <- createDoc (fst moduleUnderTest) "haskell" (snd moduleUnderTest) diff --git a/ghcide/test/src/Development/IDE/Test.hs b/ghcide/test/src/Development/IDE/Test.hs index cdabcdcd220..2e7e976b01d 100644 --- a/ghcide/test/src/Development/IDE/Test.hs +++ b/ghcide/test/src/Development/IDE/Test.hs @@ -29,14 +29,16 @@ module Development.IDE.Test , getStoredKeys , waitForCustomMessage , waitForGC - ,getBuildKeysBuilt,getBuildKeysVisited,getBuildKeysChanged,getBuildEdgesCount) where + ,getBuildKeysBuilt,getBuildKeysVisited,getBuildKeysChanged,getBuildEdgesCount,configureCheckProject) where import Control.Applicative.Combinators import Control.Lens hiding (List) import Control.Monad import Control.Monad.IO.Class +import Data.Aeson (toJSON) import qualified Data.Aeson as A import Data.Bifunctor (second) +import Data.Default import qualified Data.Map.Strict as Map import Data.Maybe (fromJust) import Data.Text (Text) @@ -45,7 +47,7 @@ import Development.IDE.Plugin.Test (TestRequest (..), WaitForIdeRuleResult, ideResultSuccess) import Development.IDE.Test.Diagnostic -import Ide.Plugin.Config (CheckParents) +import Ide.Plugin.Config (CheckParents, checkProject) import Language.LSP.Test hiding (message) import qualified Language.LSP.Test as LspTest import Language.LSP.Types hiding @@ -246,3 +248,9 @@ waitForGC = waitForCustomMessage "ghcide/GC" $ \v -> case A.fromJSON v of A.Success x -> Just x _ -> Nothing + +configureCheckProject :: Bool -> Session () +configureCheckProject overrideCheckProject = + sendNotification SWorkspaceDidChangeConfiguration + (DidChangeConfigurationParams $ toJSON + def{checkProject = overrideCheckProject})