Development.IDE.Test

hls-test-utils-2.9.0.0: Utilities used in the tests of Haskell Language Server

Safe Haskell | None
Language | GHC2021

Development.IDE.Test

Synopsis

- type Cursor = (UInt, UInt)
- cursorPosition :: Cursor -> Position
- requireDiagnostic :: (Foldable f, Show (f Diagnostic), HasCallStack) => f Diagnostic -> (DiagnosticSeverity, Cursor, Text, Maybe DiagnosticTag) -> Maybe ErrorMsg
- diagnostic :: Session (TNotificationMessage 'Method_TextDocumentPublishDiagnostics)
- expectDiagnostics :: HasCallStack => [(FilePath, [(DiagnosticSeverity, Cursor, Text)])] -> Session ()
- expectDiagnosticsWithTags :: HasCallStack => [(String, [(DiagnosticSeverity, Cursor, Text, Maybe DiagnosticTag)])] -> Session ()
- expectNoMoreDiagnostics :: HasCallStack => Seconds -> Session ()
- expectMessages :: forall {t :: MessageKind} (m :: Method 'ServerToClient t). SMethod m -> Seconds -> (TServerMessage m -> Session ()) -> Session ()
- expectCurrentDiagnostics :: HasCallStack => TextDocumentIdentifier -> [(DiagnosticSeverity, Cursor, Text)] -> Session ()
- checkDiagnosticsForDoc :: HasCallStack => TextDocumentIdentifier -> [(DiagnosticSeverity, Cursor, Text)] -> [Diagnostic] -> Session ()
- canonicalizeUri :: Uri -> IO Uri
- standardizeQuotes :: Text -> Text
- flushMessages :: Session ()
- waitForAction :: String -> TextDocumentIdentifier -> Session WaitForIdeRuleResult
- getInterfaceFilesDir :: TextDocumentIdentifier -> Session FilePath
- garbageCollectDirtyKeys :: CheckParents -> Int -> Session [String]
- getFilesOfInterest :: Session [FilePath]
- waitForTypecheck :: TextDocumentIdentifier -> Session Bool
- waitForBuildQueue :: Session ()
- getStoredKeys :: Session [Text]
- waitForCustomMessage :: Text -> (Value -> Maybe res) -> Session res
- waitForGC :: Session [Text]
- configureCheckProject :: Bool -> Session ()
- isReferenceReady :: FilePath -> Session ()
- referenceReady :: (FilePath -> Bool) -> Session FilePath

# Documentation

type Cursor = (UInt, UInt) #

(0-based line number, 0-based column number)

cursorPosition :: Cursor -> Position #

requireDiagnostic :: (Foldable f, Show (f Diagnostic), HasCallStack) => f Diagnostic -> (DiagnosticSeverity, Cursor, Text, Maybe DiagnosticTag) -> Maybe ErrorMsg #

diagnostic :: Session (TNotificationMessage 'Method_TextDocumentPublishDiagnostics) #

expectDiagnostics :: HasCallStack => [(FilePath, [(DiagnosticSeverity, Cursor, Text)])] -> Session () #

It is not possible to use 'expectDiagnostics []' to assert the absence of diagnostics, only that existing diagnostics have been cleared.

Rather than trying to assert the absence of diagnostics, introduce an expected diagnostic (e.g. a redundant import) and assert the singleton diagnostic.

expectDiagnosticsWithTags :: HasCallStack => [(String, [(DiagnosticSeverity, Cursor, Text, Maybe DiagnosticTag)])] -> Session () #

expectNoMoreDiagnostics :: HasCallStack => Seconds -> Session () #

wait for `timeout` seconds and report an assertion failure if any diagnostic messages arrive in that period

expectMessages :: forall {t :: MessageKind} (m :: Method 'ServerToClient t). SMethod m -> Seconds -> (TServerMessage m -> Session ()) -> Session () #

expectCurrentDiagnostics :: HasCallStack => TextDocumentIdentifier -> [(DiagnosticSeverity, Cursor, Text)] -> Session () #

checkDiagnosticsForDoc :: HasCallStack => TextDocumentIdentifier -> [(DiagnosticSeverity, Cursor, Text)] -> [Diagnostic] -> Session () #

canonicalizeUri :: Uri -> IO Uri #

standardizeQuotes :: Text -> Text #

flushMessages :: Session () #

waitForAction :: String -> TextDocumentIdentifier -> Session WaitForIdeRuleResult #

getInterfaceFilesDir :: TextDocumentIdentifier -> Session FilePath #

garbageCollectDirtyKeys :: CheckParents -> Int -> Session [String] #

getFilesOfInterest :: Session [FilePath] #

waitForTypecheck :: TextDocumentIdentifier -> Session Bool #

waitForBuildQueue :: Session () #

getStoredKeys :: Session [Text] #

waitForCustomMessage :: Text -> (Value -> Maybe res) -> Session res #

waitForGC :: Session [Text] #

configureCheckProject :: Bool -> Session () #

isReferenceReady :: FilePath -> Session () #

Pattern match a message from ghcide indicating that a file has been indexed

referenceReady :: (FilePath -> Bool) -> Session FilePath #