Skip to content

Commit 49ba293

Browse files
committed
Merge branch 'master' into unify-showGhc
2 parents 4308b75 + fbcd3a4 commit 49ba293

File tree

7 files changed

+31
-27
lines changed

7 files changed

+31
-27
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
name: Test hls-splice-plugin
191191
run: cabal test hls-splice-plugin --test-options="$TEST_OPTS" || cabal test hls-splice-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-splice-plugin --test-options="$TEST_OPTS"
192192

193-
- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2' && matrix.ghc != '9.2.2'
193+
- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2'
194194
name: Test hls-stylish-haskell-plugin
195195
run: cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS"
196196

cabal-ghc92.project

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ package *
3939

4040
write-ghc-environment-files: never
4141

42-
index-state: 2022-03-08T10:53:01Z
42+
index-state: 2022-04-19T07:18:40Z
4343

4444
constraints:
4545
-- These plugins don't build/work on GHC92 yet
@@ -50,7 +50,6 @@ constraints:
5050
-hlint
5151
-retrie
5252
-splice
53-
-stylishhaskell
5453
-tactic,
5554

5655
allow-newer:
@@ -74,11 +73,6 @@ allow-newer:
7473
-- https://github.com/lspitzner/butcher/pull/8
7574
butcher:base,
7675

77-
stylish-haskell:ghc-lib-parser,
78-
stylish-haskell:Cabal,
79-
stylish-haskell:bytestring,
80-
stylish-haskell:aeson,
81-
8276
ormolu:ghc-lib-parser,
8377

8478
fourmolu:ghc-lib-parser,

configuration-ghc-921.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
let
55
disabledPlugins = [
66
"hls-brittany-plugin"
7-
"hls-stylish-haskell-plugin"
87
"hls-hlint-plugin"
98
"hls-haddock-comments-plugin"
109
"hls-tactics-plugin"
@@ -34,7 +33,6 @@ let
3433
hself.callCabal2nixWithOptions "haskell-language-server" ./.
3534
(pkgs.lib.concatStringsSep " " [
3635
"-f-brittany"
37-
"-f-stylishHaskell"
3836
"-f-hlint"
3937
"-f-haddockComments"
4038
"-f-tactics"

ghcide/src/Development/IDE/Core/FileExists.hs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ fromChange FcChanged = Nothing
131131
-------------------------------------------------------------------------------------
132132

133133
-- | Returns True if the file exists
134-
-- Note that a file is not considered to exist unless it is saved to disk.
135-
-- In particular, VFS existence is not enough.
136-
-- Consider the following example:
137-
-- 1. The file @A.hs@ containing the line @import B@ is added to the files of interest
138-
-- Since @B.hs@ is neither open nor exists, GetLocatedImports finds Nothing
139-
-- 2. The editor creates a new buffer @B.hs@
140-
-- Unless the editor also sends a @DidChangeWatchedFile@ event, ghcide will not pick it up
141-
-- Most editors, e.g. VSCode, only send the event when the file is saved to disk.
142134
getFileExists :: NormalizedFilePath -> Action Bool
143135
getFileExists fp = use_ GetFileExists fp
144136

ghcide/test/exe/Main.hs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ import System.Process.Extra (CreateProcess (cwd),
9595
import Test.QuickCheck
9696
-- import Test.QuickCheck.Instances ()
9797
import Control.Concurrent.Async
98-
import Control.Lens (to, (^.))
98+
import Control.Lens (to, (^.), (.~))
9999
import Control.Monad.Extra (whenJust)
100100
import Data.Function ((&))
101101
import Data.IORef
@@ -133,6 +133,7 @@ import Test.Tasty.Ingredients.Rerun
133133
import Test.Tasty.QuickCheck
134134
import Text.Printf (printf)
135135
import Text.Regex.TDFA ((=~))
136+
import Language.LSP.Types.Lens (workspace, didChangeWatchedFiles)
136137

137138
data Log
138139
= LogGhcIde Ghcide.Log
@@ -421,9 +422,12 @@ diagnosticTests = testGroup "diagnostics"
421422
let contentA = T.unlines [ "module ModuleA where" ]
422423
_ <- createDoc "ModuleA.hs" "haskell" contentA
423424
expectDiagnostics [("ModuleB.hs", [])]
424-
, ignoreTestBecause "Flaky #2831" $ testSessionWait "add missing module (non workspace)" $ do
425-
-- need to canonicalize in Mac Os
426-
tmpDir <- liftIO $ canonicalizePath =<< getTemporaryDirectory
425+
, testCase "add missing module (non workspace)" $
426+
-- By default lsp-test sends FileWatched notifications for all files, which we don't want
427+
-- as non workspace modules will not be watched by the LSP server.
428+
-- To work around this, we tell lsp-test that our client doesn't have the
429+
-- FileWatched capability, which is enough to disable the notifications
430+
withTempDir $ \tmpDir -> runInDir'' lspTestCapsNoFileWatches tmpDir "." "." [] $ do
427431
let contentB = T.unlines
428432
[ "module ModuleB where"
429433
, "import ModuleA ()"
@@ -6306,7 +6310,18 @@ withLongTimeout = bracket_ (setEnv "LSP_TIMEOUT" "120" True) (unsetEnv "LSP_TIME
63066310

63076311
-- | Takes a directory as well as relative paths to where we should launch the executable as well as the session root.
63086312
runInDir' :: FilePath -> FilePath -> FilePath -> [String] -> Session a -> IO a
6309-
runInDir' dir startExeIn startSessionIn extraOptions s = do
6313+
runInDir' = runInDir'' lspTestCaps
6314+
6315+
runInDir''
6316+
:: ClientCapabilities
6317+
-> FilePath
6318+
-> FilePath
6319+
-> FilePath
6320+
-> [String]
6321+
-> Session b
6322+
-> IO b
6323+
runInDir'' lspCaps dir startExeIn startSessionIn extraOptions s = do
6324+
63106325
ghcideExe <- locateGhcideExecutable
63116326
let startDir = dir </> startExeIn
63126327
let projDir = dir </> startSessionIn
@@ -6326,10 +6341,11 @@ runInDir' dir startExeIn startSessionIn extraOptions s = do
63266341
-- Only sets HOME if it wasn't already set.
63276342
setEnv "HOME" "/homeless-shelter" False
63286343
conf <- getConfigFromEnv
6329-
runSessionWithConfig conf cmd lspTestCaps projDir $ do
6344+
runSessionWithConfig conf cmd lspCaps projDir $ do
63306345
configureCheckProject False
63316346
s
63326347

6348+
63336349
getConfigFromEnv :: IO SessionConfig
63346350
getConfigFromEnv = do
63356351
logColor <- fromMaybe True <$> checkEnv "LSP_TEST_LOG_COLOR"
@@ -6347,6 +6363,9 @@ getConfigFromEnv = do
63476363
lspTestCaps :: ClientCapabilities
63486364
lspTestCaps = fullCaps { _window = Just $ WindowClientCapabilities (Just True) Nothing Nothing }
63496365

6366+
lspTestCapsNoFileWatches :: ClientCapabilities
6367+
lspTestCapsNoFileWatches = lspTestCaps & workspace . Lens._Just . didChangeWatchedFiles .~ Nothing
6368+
63506369
openTestDataDoc :: FilePath -> Session TextDocumentIdentifier
63516370
openTestDataDoc path = do
63526371
source <- liftIO $ readFileUtf8 $ "test/data" </> path

plugins/hls-stylish-haskell-plugin/hls-stylish-haskell-plugin.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ library
2727
, ghcide ^>=1.6
2828
, hls-plugin-api ^>=1.3
2929
, lsp-types
30-
, stylish-haskell ^>=0.12 || ^>=0.13
30+
, stylish-haskell ^>=0.12 || ^>=0.13 || ^>=0.14
3131
, text
3232

3333
default-language: Haskell2010

stack-9.2.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ packages:
2222
# - ./plugins/hls-splice-plugin
2323
# - ./plugins/hls-tactics-plugin
2424
# - ./plugins/hls-brittany-plugin
25-
# - ./plugins/hls-stylish-haskell-plugin
25+
- ./plugins/hls-stylish-haskell-plugin
2626
- ./plugins/hls-floskell-plugin
2727
- ./plugins/hls-fourmolu-plugin
2828
- ./plugins/hls-pragmas-plugin
@@ -94,6 +94,8 @@ extra-deps:
9494
- unix-2.7.2.2
9595
- Win32-2.12.0.1
9696

97+
- stylish-haskell-0.14.1.0
98+
9799
# currently needed for ghcide>extra, etc.
98100
allow-newer: true
99101

@@ -120,7 +122,6 @@ flags:
120122
hlint: false
121123
retrie: false
122124
splice: false
123-
stylishhaskell: false
124125
tactic: false
125126

126127
retrie:

0 commit comments

Comments
 (0)