Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 098bff0

Browse files
Merge branch 'master' into structured-diagnostics
2 parents 90eb271 + 5d221b9 commit 098bff0

File tree

61 files changed

+1113
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1113
-322
lines changed

‎cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ packages:
88
./hls-test-utils
99

1010

11-
index-state: 2025-05-12T13:26:29Z
11+
index-state: 2025-06-16T09:44:13Z
1212

1313
tests: True
1414
test-show-details: direct

‎docs/support/plugin-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ For example, a plugin to provide a formatter which has itself been abandoned has
5555
| `hls-explicit-record-fields-plugin` | 2 | |
5656
| `hls-fourmolu-plugin` | 2 | |
5757
| `hls-gadt-plugin` | 2 | |
58-
| `hls-hlint-plugin` | 2 | 9.10.1 |
58+
| `hls-hlint-plugin` | 2 | |
5959
| `hls-module-name-plugin` | 2 | |
6060
| `hls-notes-plugin` | 2 | |
6161
| `hls-qualify-imported-names-plugin` | 2 | |

‎flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
description = "haskell-language-server development flake";
33

44
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
# Don't use nixpkgs-unstable as aarch64-darwin is currently broken there.
6+
# Check again, when https://github.com/NixOS/nixpkgs/pull/414242 is resolved.
7+
nixpkgs.url = "github:NixOS/nixpkgs/c742ae7908a82c9bf23ce27bfca92a00e9bcd541";
68
flake-utils.url = "github:numtide/flake-utils";
79
# For default.nix
810
flake-compat = {
@@ -66,6 +68,7 @@
6668
buildInputs = [
6769
# Compiler toolchain
6870
hpkgs.ghc
71+
hpkgs.haskell-language-server
6972
pkgs.haskellPackages.cabal-install
7073
# Dependencies needed to build some parts of Hackage
7174
gmp zlib ncurses

‎ghcide-test/data/references/Fields.hs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{-# LANGUAGE RecordWildCards #-}
2+
module Fields where
3+
4+
data Foo = MkFoo
5+
{
6+
barr :: String,
7+
bazz :: String
8+
}
9+
10+
fooUse0 :: Foo -> String
11+
fooUse0 MkFoo{barr} = "5"
12+
13+
fooUse1 :: Foo -> String
14+
fooUse1 MkFoo{..} = "6"
15+
16+
fooUse2 :: String -> String -> Foo
17+
fooUse2 bar baz =
18+
MkFoo{..}

‎ghcide-test/data/references/Main.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Main where
22

33
import References
4-
4+
importFields
55
main :: IO ()
66
main = return ()
77

@@ -12,3 +12,6 @@ b = a + 1
1212

1313
acc :: Account
1414
acc = Savings
15+
16+
fooUse3 :: String -> String -> Foo
17+
fooUse3 bar baz = MkFoo{barr = bar, bazz = baz}

‎ghcide-test/data/references/hie.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cradle: {direct: {arguments: ["Main","OtherModule","OtherOtherModule","References"]}}
1+
cradle: {direct: {arguments: ["Main","OtherModule","OtherOtherModule","References", "Fields"]}}

‎ghcide-test/exe/CompletionTests.hs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import Test.Hls.Util
3333
import Test.Tasty
3434
import Test.Tasty.HUnit
3535

36-
3736
tests :: TestTree
3837
tests
3938
= testGroup "completion"
@@ -61,6 +60,7 @@ completionTest :: HasCallStack => String -> [T.Text] -> Position -> [(T.Text, Co
6160
completionTest name src pos expected = testSessionSingleFile name "A.hs" (T.unlines src) $ do
6261
docId <- openDoc "A.hs" "haskell"
6362
_ <- waitForDiagnostics
63+
6464
compls <- getAndResolveCompletions docId pos
6565
let compls' = [ (_label, _kind, _insertText, _additionalTextEdits) | CompletionItem{..} <- compls]
6666
let emptyToMaybe x = if T.null x then Nothing else Just x
@@ -211,7 +211,38 @@ localCompletionTests = [
211211

212212
compls <- getCompletions doc (Position 0 15)
213213
liftIO $ filter ("AAA" `T.isPrefixOf`) (mapMaybe _insertText compls) @?= ["AAAAA"]
214-
pure ()
214+
pure (),
215+
completionTest
216+
"polymorphic record dot completion"
217+
[ "{-# LANGUAGE OverloadedRecordDot #-}"
218+
, "module A () where"
219+
, "data Record = Record"
220+
, " { field1 :: Int"
221+
, " , field2 :: Int"
222+
, " }"
223+
, -- Without the following, this file doesn't trigger any diagnostics, so completionTest waits forever
224+
"triggerDiag :: UnknownType"
225+
, "foo record = record.f"
226+
]
227+
(Position 7 21)
228+
[("field1", CompletionItemKind_Function, "field1", True, False, Nothing)
229+
,("field2", CompletionItemKind_Function, "field2", True, False, Nothing)
230+
],
231+
completionTest
232+
"qualified polymorphic record dot completion"
233+
[ "{-# LANGUAGE OverloadedRecordDot #-}"
234+
, "module A () where"
235+
, "data Record = Record"
236+
, " { field1 :: Int"
237+
, " , field2 :: Int"
238+
, " }"
239+
, "someValue = undefined"
240+
, "foo = A.someValue.f"
241+
]
242+
(Position 7 19)
243+
[("field1", CompletionItemKind_Function, "field1", True, False, Nothing)
244+
,("field2", CompletionItemKind_Function, "field2", True, False, Nothing)
245+
]
215246
]
216247

217248
nonLocalCompletionTests :: [TestTree]

‎ghcide-test/exe/Main.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module Main (main) where
3333
import qualified HieDbRetry
3434
import Test.Tasty
3535
import Test.Tasty.Ingredients.Rerun
36-
import Test.Tasty.Runners
3736

3837
import AsyncTests
3938
import BootTests
@@ -71,7 +70,7 @@ import WatchedFileTests
7170
main :: IO ()
7271
main = do
7372
-- We mess with env vars so run single-threaded.
74-
defaultMainWithRerun $ PlusTestOptions mkSequential $testGroup "ghcide"
73+
defaultMainWithRerun $ testGroup "ghcide"
7574
[ OpenCloseTest.tests
7675
, InitializeResponseTests.tests
7776
, CompletionTests.tests
@@ -105,6 +104,3 @@ main = do
105104
, HieDbRetry.tests
106105
, ExceptionTests.tests
107106
]
108-
where
109-
PlusTestOptions mkSequential _ =sequentialTestGroup "foo" AllFinish []
110-

‎ghcide-test/exe/ReferenceTests.hs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,28 @@ tests = testGroup "references"
156156
, ("References.hs", 16, 0)
157157
]
158158
]
159+
-- Fields.hs does not depend on Main.hs
160+
-- so we can only find references in Fields.hs
161+
, testGroup "references to record fields"
162+
[ referenceTest "references record fields in the same file"
163+
("Fields.hs", 5, 4)
164+
YesIncludeDeclaration
165+
[ ("Fields.hs", 5, 4)
166+
, ("Fields.hs", 10, 14)
167+
, ("Fields.hs", 13, 14)
168+
]
169+
170+
-- Main.hs depends on Fields.hs, so we can find references
171+
-- from Main.hs to Fields.hs
172+
, referenceTest "references record fields cross modules"
173+
("Main.hs", 16, 24)
174+
YesIncludeDeclaration
175+
[ ("Fields.hs", 5, 4)
176+
, ("Fields.hs", 10, 14)
177+
, ("Fields.hs", 13, 14)
178+
, ("Main.hs", 16, 24)
179+
]
180+
]
159181
]
160182

161183
-- | When we ask for all references to symbol "foo", should the declaration "foo

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /