Skip to content

Commit 08350aa

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 1875-tests-randomly-fail-with-exception-fd111-hputbuf-resource-vanished-broken-pipe---test-option-j1-workaround
2 parents 8f37e25 + 60a6c48 commit 08350aa

File tree

10 files changed

+171
-124
lines changed

10 files changed

+171
-124
lines changed

docs/configuration.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,22 +443,20 @@ This will install `eglot` and enable it by default in `haskell-mode`.
443443
To configure `haskell-language-server` we use the `eglot-workspace-configuration` variable.
444444
With `M-x eglot-show-workspace-configuration` you can see the JSON that `eglot` will send to `haskell-language-server`.
445445
See <https://joaotavora.github.io/eglot/#Customizing-Eglot> for more information.
446-
As an example, the setting below will disable the `stan` plugin.
446+
As an example, the setting below will disable the `stan` plugin and use `fourmolu` for formatting:
447447

448448
```emacs-lisp
449449
(use-package eglot
450450
:ensure t
451451
:config
452-
(add-hook 'haskell-mode-hook 'eglot-ensure)
452+
(add-hook 'haskell-mode-hook 'eglot-ensure) ; start eglot automatically in haskell projects
453453
:config
454454
(setq-default eglot-workspace-configuration
455-
'((haskell
456-
(plugin
457-
(stan
458-
(globalOn . :json-false)))))) ;; disable stan
455+
'(:haskell (:plugin (:stan (:globalOn :json-false)) ; disable stan
456+
:formattingProvider "fourmolu"))) ; use fourmolu instead of ormolu
459457
:custom
460-
(eglot-autoshutdown t) ;; shutdown language server after closing last file
461-
(eglot-confirm-server-initiated-edits nil) ;; allow edits without confirmation
458+
(eglot-autoshutdown t) ; shutdown language server after closing last file
459+
(eglot-confirm-server-initiated-edits nil) ; allow edits without confirmation
462460
)
463461
```
464462

ghcide-test/exe/DiagnosticTests.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ tests = testGroup "diagnostics"
244244
_ <- createDoc "ModuleB.hs" "haskell" contentB
245245
_ <- createDoc "ModuleB.hs-boot" "haskell" contentBboot
246246
expectDiagnostics [("ModuleB.hs", [(DiagnosticSeverity_Warning, (3,0), "Top-level binding", Just "GHC-38417")])]
247-
, testWithDummyPlugin "bidirectional module dependency with hs-boot"
248-
(mkIdeTestFs [directCradle ["ModuleA", "ModuleB"]])
249-
$ do
247+
, testWithDummyPluginEmpty "bidirectional module dependency with hs-boot" $ do
250248
let contentA = T.unlines
251249
[ "module ModuleA where"
252250
, "import {-# SOURCE #-} ModuleB"

ghcide/src/Development/IDE/GHC/Compat/Error.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ module Development.IDE.GHC.Compat.Error (
1818
DriverMessage (..),
1919
-- * General Diagnostics
2020
Diagnostic(..),
21+
-- * GHC Hints
22+
GhcHint (SuggestExtension),
23+
LanguageExtensionHint (..),
2124
-- * Prisms and lenses for error selection
2225
_TcRnMessage,
2326
_TcRnMessageWithCtx,

hls-test-utils/hls-test-utils.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ library
4949
, lsp
5050
, lsp-test ^>=0.17
5151
, lsp-types ^>=2.3
52-
, neat-interpolation
5352
, safe-exceptions
53+
, string-interpolate
5454
, tasty
5555
, tasty-expected-failure
5656
, tasty-golden

hls-test-utils/src/Test/Hls.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ goldenWithDocInTmpDir languageKind config plugin title tree path desc ext act =
369369
-- For example:
370370
--
371371
-- @
372-
-- parameterisedCursorTest "Cursor Test" [trimming|
372+
-- parameterisedCursorTest "Cursor Test" [__i|
373373
-- foo = 2
374374
-- ^
375375
-- bar = 3
@@ -392,7 +392,7 @@ goldenWithDocInTmpDir languageKind config plugin title tree path desc ext act =
392392
-- TODO: Many Haskell and Cabal source may contain '^' characters for good reasons.
393393
-- We likely need a way to change the character for certain test cases in the future.
394394
--
395-
-- The quasi quoter 'trimming' is very helpful to define such tests, as it additionally
395+
-- The quasi quoter '__i' is very helpful to define such tests, as it additionally
396396
-- allows to interpolate haskell values and functions. We reexport this quasi quoter
397397
-- for easier usage.
398398
parameterisedCursorTest :: (Show a, Eq a) => String -> T.Text -> [a] -> (T.Text -> PosPrefixInfo -> IO a) -> TestTree

hls-test-utils/src/Test/Hls/Util.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module Test.Hls.Util
4747
-- * Extract positions from input file.
4848
, extractCursorPositions
4949
, mkParameterisedLabel
50-
, trimming
50+
, __i
5151
)
5252
where
5353

@@ -81,11 +81,11 @@ import Test.Tasty.ExpectedFailure (expectFailBecause,
8181
import Test.Tasty.HUnit (assertFailure)
8282

8383
import qualified Data.List as List
84+
import Data.String.Interpolate (__i)
8485
import qualified Data.Text.Internal.Search as T
8586
import qualified Data.Text.Utf16.Rope.Mixed as Rope
8687
import Development.IDE.Plugin.Completions.Logic (getCompletionPrefixFromRope)
8788
import Development.IDE.Plugin.Completions.Types (PosPrefixInfo (..))
88-
import NeatInterpolation (trimming)
8989

9090
noLiteralCaps :: ClientCapabilities
9191
noLiteralCaps = def & L.textDocument ?~ textDocumentCaps

plugins/hls-cabal-plugin/test/Completer.hs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -392,39 +392,39 @@ extract item = case item ^. L.textEdit of
392392
_ -> error ""
393393

394394
importTestData :: T.Text
395-
importTestData = [trimming|
396-
cabal-version: 3.0
397-
name: hls-cabal-plugin
398-
version: 0.1.0.0
399-
synopsis:
400-
homepage:
401-
license: MIT
402-
license-file: LICENSE
403-
author: Fendor
404-
maintainer: [email protected]
405-
category: Development
406-
extra-source-files: CHANGELOG.md
395+
importTestData = [__i|
396+
cabal-version: 3.0
397+
name: hls-cabal-plugin
398+
version: 0.1.0.0
399+
synopsis:
400+
homepage:
401+
license: MIT
402+
license-file: LICENSE
403+
author: Fendor
404+
maintainer: [email protected]
405+
category: Development
406+
extra-source-files: CHANGELOG.md
407407

408-
common defaults
409-
default-language: GHC2021
410-
-- Should have been in GHC2021, an oversight
411-
default-extensions: ExplicitNamespaces
408+
common defaults
409+
default-language: GHC2021
410+
-- Should have been in GHC2021, an oversight
411+
default-extensions: ExplicitNamespaces
412412

413-
common test-defaults
414-
ghc-options: -threaded -rtsopts -with-rtsopts=-N
413+
common test-defaults
414+
ghc-options: -threaded -rtsopts -with-rtsopts=-N
415415

416-
library
417-
import:
418-
^
419-
exposed-modules: IDE.Plugin.Cabal
420-
build-depends: base ^>=4.14.3.0
421-
hs-source-dirs: src
422-
default-language: Haskell2010
416+
library
417+
import:
418+
^
419+
exposed-modules: IDE.Plugin.Cabal
420+
build-depends: base ^>=4.14.3.0
421+
hs-source-dirs: src
422+
default-language: Haskell2010
423423

424-
common notForLib
425-
default-language: GHC2021
424+
common notForLib
425+
default-language: GHC2021
426426

427-
test-suite tests
428-
import:
429-
^
427+
test-suite tests
428+
import:
429+
^
430430
|]

plugins/hls-cabal-plugin/test/Context.hs

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -217,93 +217,93 @@ getContextTests =
217217
-- ------------------------------------------------------------------------
218218

219219
libraryStanzaData :: T.Text
220-
libraryStanzaData = [trimming|
221-
cabal-version: 3.0
222-
name: simple-cabal
223-
library
224-
default-language: Haskell98
225-
build-depends:
220+
libraryStanzaData = [__i|
221+
cabal-version: 3.0
222+
name: simple-cabal
223+
library
224+
default-language: Haskell98
225+
build-depends:
226226

227-
ma
227+
ma
228228
|]
229229

230230
executableStanzaData :: T.Text
231-
executableStanzaData = [trimming|
232-
cabal-version: 3.0
233-
name: simple-cabal
234-
executable exeName
235-
default-language: Haskell2010
236-
hs-source-dirs: test/preprocessor
231+
executableStanzaData = [__i|
232+
cabal-version: 3.0
233+
name: simple-cabal
234+
executable exeName
235+
default-language: Haskell2010
236+
hs-source-dirs: test/preprocessor
237237
|]
238238

239239
topLevelData :: T.Text
240-
topLevelData = [trimming|
241-
cabal-version: 3.0
242-
name:
240+
topLevelData = [__i|
241+
cabal-version: 3.0
242+
name:
243243

244244

245245

246-
eee
246+
eee
247247
|]
248248

249249
conditionalData :: T.Text
250-
conditionalData = [trimming|
251-
cabal-version: 3.0
252-
name: simple-cabal
253-
library
254-
if os(windows)
255-
buildable:
256-
elif os(linux)
257-
buildable:
258-
else
259-
buildable:
250+
conditionalData = [__i|
251+
cabal-version: 3.0
252+
name: simple-cabal
253+
library
254+
if os(windows)
255+
buildable:
256+
elif os(linux)
257+
buildable:
258+
else
259+
buildable:
260260
|]
261261
multiLineOptsData :: T.Text
262-
multiLineOptsData = [trimming|
263-
cabal-version: 3.0
264-
name:
262+
multiLineOptsData = [__i|
263+
cabal-version: 3.0
264+
name:
265265

266266

267-
library
268-
build-depends:
269-
base,
267+
library
268+
build-depends:
269+
base,
270270

271-
text ,
271+
text ,
272272
|]
273273

274274
multiPositionTestData :: T.Text
275-
multiPositionTestData = [trimming|
276-
cabal-version: 3.4
277-
^ ^
278-
category: Development
279-
^
280-
name: haskell-language-server
281-
description:
282-
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
275+
multiPositionTestData = [__i|
276+
cabal-version: 3.4
277+
^ ^
278+
category: Development
283279
^
284-
extra-source-files:
285-
README.md
286-
ChangeLog.md
287-
test/testdata/**/*.project
288-
test/testdata/**/*.cabal
289-
test/testdata/**/*.yaml
290-
test/testdata/**/*.hs
291-
test/testdata/**/*.json
292-
^
293-
-- These globs should only match test/testdata
294-
plugins/**/*.project
280+
name: haskell-language-server
281+
description:
282+
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server\#readme>
283+
^
284+
extra-source-files:
285+
README.md
286+
ChangeLog.md
287+
test/testdata/**/*.project
288+
test/testdata/**/*.cabal
289+
test/testdata/**/*.yaml
290+
test/testdata/**/*.hs
291+
test/testdata/**/*.json
292+
^
293+
-- These globs should only match test/testdata
294+
plugins/**/*.project
295295

296-
source-repository head
297-
^ ^ ^
298-
type: git
299-
^ ^ ^ ^
300-
location: https://github.com/haskell/haskell-language-server
296+
source-repository head
297+
^ ^ ^
298+
type: git
299+
^ ^ ^ ^
300+
location: https://github.com/haskell/haskell-language-server
301301

302-
^
303-
common cabalfmt
302+
^
303+
common cabalfmt
304304

305-
^
306-
build-depends: haskell-language-server:hls-cabal-fmt-plugin
307-
^ ^
308-
cpp-options: -Dhls_cabalfmt
305+
^
306+
build-depends: haskell-language-server:hls-cabal-fmt-plugin
307+
^ ^
308+
cpp-options: -Dhls_cabalfmt
309309
|]

plugins/hls-cabal-plugin/test/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ reloadOnCabalChangeTests = testGroup "Reload on .cabal changes"
292292
cabalDoc <- openDoc "simple-reload.cabal" "cabal"
293293
skipManyTill anyMessage cabalKickDone
294294
saveDoc cabalDoc
295-
[trimming|
295+
[__i|
296296
cabal-version: 3.4
297297
name: simple-reload
298298
version: 0.1.0.0

0 commit comments

Comments
 (0)