Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 18 additions & 32 deletions plugins/hls-refactor-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@
import Development.IDE.Plugin.Completions.Types (extendImportCommandId)
import Development.IDE.Test
import Development.IDE.Types.Location
import Development.Shake (getDirectoryFilesIO)
import qualified Language.LSP.Protocol.Lens as L
import Language.LSP.Protocol.Message
import Language.LSP.Protocol.Types hiding
(SemanticTokensEdit (_start),
mkRange)
import Language.LSP.Test
import System.Directory
import System.FilePath
import qualified System.IO.Extra
import System.IO.Extra hiding (withTempDir)
import System.Time.Extra
import Test.Tasty
import Test.Tasty.HUnit
Expand All @@ -45,6 +41,7 @@

import Development.IDE.Plugin.CodeAction (matchRegExMultipleImports)
import Test.Hls
import qualified Test.Hls.FileSystem as FS

import qualified Development.IDE.GHC.ExactPrint
import Development.IDE.Plugin.CodeAction (NotInScope (..))
Expand Down Expand Up @@ -1849,8 +1846,8 @@
let before = T.unlines $ "module A where" : ["import " <> x | x <- imps] ++ def : other
after = T.unlines $ "module A where" : ["import " <> x | x <- imps] ++ [newImp] ++ def : other
cradle = "cradle: {direct: {arguments: [-hide-all-packages, -package, base, -package, text, -package-env, -, A, Bar, Foo, B]}}"
liftIO $ writeFileUTF8 (dir </> "hie.yaml") cradle

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1

Check failure on line 1849 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t0 -> IO a1
liftIO $ writeFileUTF8 (dir </> "B.hs") $ unlines ["{-# LANGUAGE PatternSynonyms #-}", "module B where", "pattern Some x = Just x"]

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0

Check failure on line 1850 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a0
doc <- createDoc "Test.hs" "haskell" before
waitForProgressDone
_ <- waitForDiagnostics
Expand Down Expand Up @@ -1886,8 +1883,8 @@
let before = T.unlines ["module A where", "import B (Foo)", "getFoo :: Foo -> Int", "getFoo x = x.foo"]
after = T.unlines ["module A where", "import B (Foo, foo)", "getFoo :: Foo -> Int", "getFoo x = x.foo"]
cradle = "cradle: {direct: {arguments: [-hide-all-packages, -package, base, -package, text, -package-env, -, A, B]}}"
liftIO $ writeFileUTF8 (dir </> "hie.yaml") cradle

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6

Check failure on line 1886 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t2 -> IO a6
liftIO $ writeFileUTF8 (dir </> "B.hs") $ unlines ["module B where", "data Foo = Foo { foo :: Int }"]

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5

Check failure on line 1887 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a5
doc <- createDoc "Test.hs" "haskell" before
waitForProgressDone
_ <- waitForDiagnostics
Expand All @@ -1913,9 +1910,9 @@
before = T.unlines ["{-# LANGUAGE OverloadedRecordDot #-}", "module A where", if qualifiedGhcRecords then "" else "import GHC.Records", "import C (bar)", "spam = bar.foo"]
after = T.unlines ["{-# LANGUAGE OverloadedRecordDot #-}", "module A where", if qualifiedGhcRecords then "" else "import GHC.Records", "import C (bar)", "import B (Foo(..))", "spam = bar.foo"]
cradle = "cradle: {direct: {arguments: [-hide-all-packages, -package, base, -package, text, -package-env, -, A, B, C]}}"
liftIO $ writeFileUTF8 (dir </> "hie.yaml") cradle

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4

Check failure on line 1913 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t1 -> IO a4
liftIO $ writeFileUTF8 (dir </> "B.hs") $ unlines ["module B where", if polymorphicType then "data Foo x = Foo { foo :: x }" else "data Foo = Foo { foo :: Int }"]

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3

Check failure on line 1914 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a3
liftIO $ writeFileUTF8 (dir </> "C.hs") $ unlines ["module C where", "import B", "bar = Foo 10" ]

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2

Check failure on line 1915 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a2
doc <- createDoc "Test.hs" "haskell" before
waitForProgressDone
_ <- waitForDiagnostics
Expand All @@ -1938,9 +1935,9 @@
before = T.unlines ["module C where", "import B", "biz = bar { foo = 100 }"]
after = T.unlines ["module C where", "import B", "import A (Foo(..))", "biz = bar { foo = 100 }"]
cradle = "cradle: {direct: {arguments: [-hide-all-packages, -package, base, -package, text, -package-env, -, A, B, C]}}"
liftIO $ writeFileUTF8 (dir </> "hie.yaml") cradle

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9

Check failure on line 1938 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> t3 -> IO a9
liftIO $ writeFileUTF8 (dir </> "A.hs") $ unlines ["module A where", "data Foo = Foo { foo :: Int }"]

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8

Check failure on line 1939 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a8
liftIO $ writeFileUTF8 (dir </> "B.hs") $ unlines ["module B where", "import A", "bar = Foo 10" ]

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.12, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / flags (9.8, ubuntu-latest)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.8, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.6, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.12, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, windows-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7

Check failure on line 1940 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, macOS-latest, false)

Variable not in scope: writeFileUTF8 :: FilePath -> String -> IO a7
doc <- createDoc "Test.hs" "haskell" before
waitForProgressDone
diags <- waitForDiagnostics
Expand Down Expand Up @@ -2000,7 +1997,7 @@
let before = T.unlines ["module A where", "import Data.Coerce (coerce)", "import Data.Semigroup (Sum)", "bar = coerce (10 :: Int) :: Sum Int"]
after = T.unlines ["module A where", "import Data.Coerce (coerce)", "import Data.Semigroup (Sum)", "import Data.Semigroup (Sum(..))", "bar = coerce (10 :: Int) :: Sum Int"]
cradle = "cradle: {direct: {arguments: [-hide-all-packages, -package, base, -package, text, -package-env, -, A]}}"
liftIO $ writeFileUTF8 (dir </> "hie.yaml") cradle

Check failure on line 2000 in plugins/hls-refactor-plugin/test/Main.hs

View workflow job for this annotation

GitHub Actions / test (9.10, ubuntu-latest, true)

Variable not in scope: writeFileUTF8 :: FilePath -> t4 -> IO a10
doc <- createDoc "Test.hs" "haskell" before
waitForProgressDone
_ <- waitForDiagnostics
Expand Down Expand Up @@ -4031,40 +4028,29 @@
testSessionWithExtraFiles prefix name = testCase name . runWithExtraFiles prefix

runWithExtraFiles :: HasCallStack => FilePath -> (FilePath -> Session a) -> IO a
runWithExtraFiles prefix s = withTempDir $ \dir -> do
copyTestDataFiles dir prefix
runInDir dir (s dir)

copyTestDataFiles :: HasCallStack => FilePath -> FilePath -> IO ()
copyTestDataFiles dir prefix = do
-- Copy all the test data files to the temporary workspace
testDataFiles <- getDirectoryFilesIO ("plugins/hls-refactor-plugin/test/data" </> prefix) ["//*"]
for_ testDataFiles $ \f -> do
createDirectoryIfMissing True $ dir </> takeDirectory f
copyFile ("plugins/hls-refactor-plugin/test/data" </> prefix </> f) (dir </> f)

run :: Session a -> IO a
run s = run' (const s)

run' :: (FilePath -> Session a) -> IO a
run' s = withTempDir $ \dir -> runInDir dir (s dir)

runInDir :: FilePath -> Session a -> IO a
runInDir dir act =
runWithExtraFiles prefix s =
runSessionWithTestConfig def
{ testDirLocation = Left dir
{ testDirLocation = Right $ mkVirtualFileTreeWithPrefix prefix
, testPluginDescriptor = refactorPlugin
, testConfigCaps = lspTestCaps }
$ const act
s

testDataDir :: FilePath
testDataDir = "plugins/hls-refactor-plugin/test/data"

mkVirtualFileTreeWithPrefix :: FilePath -> FS.VirtualFileTree
mkVirtualFileTreeWithPrefix prefix =
FS.mkVirtualFileTree testDataDir [FS.copyDir prefix]

run :: Session a -> IO a
run s = runSessionWithTestConfig def
{ testDirLocation = Right $ FS.mkVirtualFileTree testDataDir []
, testPluginDescriptor = refactorPlugin
, testConfigCaps = lspTestCaps }
(const s)

lspTestCaps :: ClientCapabilities
lspTestCaps = fullLatestClientCaps { _window = Just $ WindowClientCapabilities (Just True) Nothing Nothing }

pattern R :: UInt -> UInt -> UInt -> UInt -> Range
pattern R x y x' y' = Range (Position x y) (Position x' y')

-- | Version of 'System.IO.Extra.withTempDir' that canonicalizes the path
-- Which we need to do on macOS since the $TMPDIR can be in @/private/var@ or
-- @/var@
withTempDir :: (FilePath -> IO a) -> IO a
withTempDir f = System.IO.Extra.withTempDir $ (canonicalizePath >=> f)
Loading