Skip to content

Commit

Permalink
configureCheckProject
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra committed Nov 25, 2021
1 parent 4b7d139 commit e198757
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 2 additions & 5 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 10 additions & 2 deletions ghcide/test/src/Development/IDE/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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})

0 comments on commit e198757

Please sign in to comment.