Skip to content

Commit 4c99c47

Browse files
authored
Merge branch 'master' into batch-load-multi-read
2 parents cddcc55 + 25c5d82 commit 4c99c47

File tree

12 files changed

+109
-30
lines changed

12 files changed

+109
-30
lines changed

.github/mergify.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,19 @@ queue_rules:
22
- name: default
33
# Mergify always respects the branch protection settings
44
# so we can left empty mergify own ones
5-
conditions: []
6-
7-
pull_request_rules:
8-
- name: Automatically merge pull requests
9-
conditions:
5+
queue_conditions:
106
- label=merge me
117
- '#approved-reviews-by>=1'
12-
actions:
13-
queue:
14-
method: squash
15-
name: default
16-
# The queue action automatically updates PRs that
17-
# have entered the queue, but in order to do that
18-
# they must have passed CI. Since our CI is a bit
19-
# flaky, PRs can fail to get in, which then means
20-
# they don't get updated, which is extra annoying.
21-
# This just adds the updating as an independent
22-
# step.
8+
merge_conditions: []
9+
merge_method: squash
10+
11+
pull_request_rules:
2312
- name: Automatically update pull requests
2413
conditions:
2514
- label=merge me
2615
actions:
2716
update:
17+
- name: refactored queue action rule
18+
conditions: []
19+
actions:
20+
queue:

cabal.project

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ packages:
88
./hls-test-utils
99

1010

11-
index-state: 2024-11-02T00:00:00Z
11+
index-state: 2024-12-02T00:00:00Z
1212

1313
tests: True
1414
test-show-details: direct
@@ -47,7 +47,17 @@ if impl(ghc >= 9.9)
4747
-- https://github.com/haskell/haskell-language-server/issues/4324
4848
benchmarks: False
4949

50+
if impl(ghc >= 9.8.4) && impl(ghc < 9.8.5)
51+
-- By depending on ghc-lib-parser and ghc, we are encountering
52+
-- a constraint conflict, ghc-9.8.4 comes with `filepath-1.4.301.0`,
53+
-- and `ghc-lib-parser-9.8.4.20241130` specifies `filepath >=1.5 && < 1.6.
54+
-- See https://github.com/digital-asset/ghc-lib/issues/572 for details.
55+
allow-older:
56+
ghc-lib-parser:filepath
57+
constraints:
58+
ghc-lib-parser==9.8.4.20241130
59+
5060
source-repository-package
5161
type: git
5262
location: https://github.com/soulomoon/hie-bios.git
53-
tag: 93582c21372af573e5103bad198777a3317a2df2
63+
tag: 93582c21372af573e5103bad198777a3317a2df2

docs/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Sphinx~=5.3.0
2-
sphinx-rtd-theme~=1.1.0
3-
myst-parser~=1.0.0
4-
docutils<0.19
1+
Sphinx~=8.1.3
2+
sphinx-rtd-theme~=3.0.2
3+
myst-parser~=4.0.0
4+
docutils~=0.21.2

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/CabalAdd.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ addDependencySuggestCodeAction plId verTxtDocId suggestions haskellFilePath caba
156156
-- | Gives the build targets that are used in the `CabalAdd`.
157157
-- Note the unorthodox usage of `readBuildTargets`:
158158
-- If the relative path to the haskell file is provided,
159-
-- the `readBuildTargets` will return a main build target.
160-
-- This behaviour is acceptable for now, but changing to a way of getting
161-
-- all build targets in a file is advised.
159+
-- the `readBuildTargets` will return build targets, where this
160+
-- module is mentioned (in exposed-modules or other-modules).
162161
getBuildTargets :: GenericPackageDescription -> FilePath -> FilePath -> IO [BuildTarget]
163162
getBuildTargets gpd cabalFilePath haskellFilePath = do
164163
let haskellFileRelativePath = makeRelative (dropFileName cabalFilePath) haskellFilePath
@@ -167,10 +166,10 @@ addDependencySuggestCodeAction plId verTxtDocId suggestions haskellFilePath caba
167166
mkCodeAction :: FilePath -> Maybe String -> (T.Text, T.Text) -> CodeAction
168167
mkCodeAction cabalFilePath target (suggestedDep, suggestedVersion) =
169168
let
170-
versionTitle = if T.null suggestedVersion then T.empty else " version " <> suggestedVersion
169+
versionTitle = if T.null suggestedVersion then T.empty else "-" <> suggestedVersion
171170
targetTitle = case target of
172171
Nothing -> T.empty
173-
Just t -> " target " <> T.pack t
172+
Just t -> " at " <> T.pack t
174173
title = "Add dependency " <> suggestedDep <> versionTitle <> targetTitle
175174
version = if T.null suggestedVersion then Nothing else Just suggestedVersion
176175

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,30 @@ cabalAddTests :: TestTree
2727
cabalAddTests =
2828
testGroup
2929
"CabalAdd Tests"
30-
[ runHaskellTestCaseSession "Code Actions - Can add hidden package" ("cabal-add-testdata" </> "cabal-add-exe")
30+
[ runHaskellTestCaseSession "Code Actions - Can add hidden package to an executable" ("cabal-add-testdata" </> "cabal-add-exe")
3131
(generateAddDependencyTestSession "cabal-add-exe.cabal" ("src" </> "Main.hs") "split" [253])
32-
, runHaskellTestCaseSession "Code Actions - Guard against HPack" ("cabal-add-testdata" </> "cabal-add-packageYaml")
33-
(generatePackageYAMLTestSession ("src" </> "Main.hs"))
3432
, runHaskellTestCaseSession "Code Actions - Can add hidden package to a library" ("cabal-add-testdata" </> "cabal-add-lib")
3533
(generateAddDependencyTestSession "cabal-add-lib.cabal" ("src" </> "MyLib.hs") "split" [348])
3634
, runHaskellTestCaseSession "Code Actions - Can add hidden package to a test" ("cabal-add-testdata" </> "cabal-add-tests")
3735
(generateAddDependencyTestSession "cabal-add-tests.cabal" ("test" </> "Main.hs") "split" [478])
3836
, runHaskellTestCaseSession "Code Actions - Can add hidden package to a benchmark" ("cabal-add-testdata" </> "cabal-add-bench")
3937
(generateAddDependencyTestSession "cabal-add-bench.cabal" ("bench" </> "Main.hs") "split" [403])
38+
39+
, runHaskellTestCaseSession "Code Actions - Can add hidden package to an executable, multiple targets" ("cabal-add-testdata" </> "cabal-add-multitarget")
40+
(generateAddDependencyTestSession "cabal-add-multitarget.cabal" ("src" </> "Main.hs") "split" [269])
41+
, runHaskellTestCaseSession "Code Actions - Can add hidden package to a library, multiple targets" ("cabal-add-testdata" </> "cabal-add-multitarget")
42+
(generateAddDependencyTestSession "cabal-add-multitarget.cabal" ("lib" </> "MyLib.hs") "split" [413])
43+
, runHaskellTestCaseSession "Code Actions - Can add hidden package to an internal library, multiple targets" ("cabal-add-testdata" </> "cabal-add-multitarget")
44+
(generateAddDependencyTestSession "cabal-add-multitarget.cabal" ("lib" </> "InternalLib.hs") "split" [413])
45+
, runHaskellTestCaseSession "Code Actions - Can add hidden package to a test, multiple targets" ("cabal-add-testdata" </> "cabal-add-multitarget")
46+
(generateAddDependencyTestSession "cabal-add-multitarget.cabal" ("test" </> "Main.hs") "split" [655])
47+
, runHaskellTestCaseSession "Code Actions - Can add hidden package to a benchmark, multiple targets" ("cabal-add-testdata" </> "cabal-add-multitarget")
48+
(generateAddDependencyTestSession "cabal-add-multitarget.cabal" ("bench" </> "Main.hs") "split" [776])
49+
50+
51+
, runHaskellTestCaseSession "Code Actions - Guard against HPack" ("cabal-add-testdata" </> "cabal-add-packageYaml")
52+
(generatePackageYAMLTestSession ("src" </> "Main.hs"))
53+
4054
, testHiddenPackageSuggestions "Check CabalAdd's parser, no version"
4155
[ "It is a member of the hidden package 'base'"
4256
, "It is a member of the hidden package 'Blammo-wai'"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Main (main) where
2+
3+
import Data.List.Split
4+
5+
main :: IO ()
6+
main = putStrLn "Test suite not yet implemented."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
cabal-version: 2.4
2+
name: cabal-add-multitarget
3+
version: 0.1.0.0
4+
build-type: Simple
5+
6+
executable cabal-add-exe
7+
main-is: Main.hs
8+
hs-source-dirs: src
9+
ghc-options: -Wall
10+
build-depends: base
11+
default-language: Haskell2010
12+
13+
library
14+
exposed-modules: MyLib
15+
other-modules: InternalLib
16+
build-depends: base >= 4 && < 5
17+
hs-source-dirs: lib
18+
ghc-options: -Wall
19+
20+
test-suite cabal-add-tests-test
21+
main-is: Main.hs
22+
hs-source-dirs: test
23+
type: exitcode-stdio-1.0
24+
build-depends: base
25+
default-language: Haskell2010
26+
27+
benchmark benchmark
28+
main-is: Main.hs
29+
build-depends: base
30+
hs-source-dirs: bench
31+
type: exitcode-stdio-1.0
32+
ghc-options: -threaded
33+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module InternalLib (internalFunc) where
2+
3+
import Data.List.Split
4+
5+
internalFunc :: IO ()
6+
internalFunc = putStrLn "internalFunc"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module MyLib (someFunc) where
2+
3+
import Data.List.Split
4+
5+
someFunc :: IO ()
6+
someFunc = putStrLn "someFunc"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Main where
2+
3+
import Data.List.Split
4+
5+
main = putStrLn "Hello, Haskell!"

0 commit comments

Comments
 (0)