@@ -38,10 +38,10 @@ test = testGroup "explicit-fields"
38
38
]
39
39
, testGroup " inlay hints"
40
40
[ mkInlayHintsTest " Construction" 16 $ \ ih -> do
41
- let mkLabelPart' = mkLabelPart " Construction" 16 12
42
- foo <- mkLabelPart' " foo"
43
- bar <- mkLabelPart' " bar"
44
- baz <- mkLabelPart' " baz"
41
+ let mkLabelPart' = mkLabelPart " Construction"
42
+ foo <- mkLabelPart' 13 6 " foo"
43
+ bar <- mkLabelPart' 14 6 " bar"
44
+ baz <- mkLabelPart' 15 6 " baz"
45
45
(@?=) ih
46
46
[defInlayHint { _position = Position 16 14
47
47
, _label = InR [ foo, commaPart
@@ -55,8 +55,8 @@ test = testGroup "explicit-fields"
55
55
, _paddingLeft = Just True
56
56
}]
57
57
, mkInlayHintsTest " HsExpanded1" 17 $ \ ih -> do
58
- let mkLabelPart' = mkLabelPart " HsExpanded1" 17 17
59
- foo <- mkLabelPart' " foo"
58
+ let mkLabelPart' = mkLabelPart " HsExpanded1"
59
+ foo <- mkLabelPart' 11 4 " foo"
60
60
(@?=) ih
61
61
[defInlayHint { _position = Position 17 19
62
62
, _label = InR [ foo ]
@@ -65,8 +65,8 @@ test = testGroup "explicit-fields"
65
65
, _paddingLeft = Just True
66
66
}]
67
67
, mkInlayHintsTest " HsExpanded2" 23 $ \ ih -> do
68
- let mkLabelPart' = mkLabelPart " HsExpanded2" 23 19
69
- bar <- mkLabelPart' " bar"
68
+ let mkLabelPart' = mkLabelPart " HsExpanded2"
69
+ bar <- mkLabelPart' 14 4 " bar"
70
70
(@?=) ih
71
71
[defInlayHint { _position = Position 23 21
72
72
, _label = InR [ bar ]
@@ -75,9 +75,9 @@ test = testGroup "explicit-fields"
75
75
, _paddingLeft = Just True
76
76
}]
77
77
, mkInlayHintsTest " Mixed" 14 $ \ ih -> do
78
- let mkLabelPart' = mkLabelPart " Mixed" 14 34
79
- baz <- mkLabelPart' " baz"
80
- quux <- mkLabelPart' " quux"
78
+ let mkLabelPart' = mkLabelPart " Mixed"
79
+ baz <- mkLabelPart' 9 4 " baz"
80
+ quux <- mkLabelPart' 10 4 " quux"
81
81
(@?=) ih
82
82
[defInlayHint { _position = Position 14 36
83
83
, _label = InR [ baz, commaPart
@@ -88,10 +88,10 @@ test = testGroup "explicit-fields"
88
88
, _paddingLeft = Just True
89
89
}]
90
90
, mkInlayHintsTest " Unused" 12 $ \ ih -> do
91
- let mkLabelPart' = mkLabelPart " Unused" 12 17
92
- foo <- mkLabelPart' " foo"
93
- bar <- mkLabelPart' " bar"
94
- baz <- mkLabelPart' " baz"
91
+ let mkLabelPart' = mkLabelPart " Unused"
92
+ foo <- mkLabelPart' 6 4 " foo"
93
+ bar <- mkLabelPart' 7 4 " bar"
94
+ baz <- mkLabelPart' 8 4 " baz"
95
95
(@?=) ih
96
96
[defInlayHint { _position = Position 12 19
97
97
, _label = InR [ foo, commaPart
@@ -105,10 +105,10 @@ test = testGroup "explicit-fields"
105
105
, _paddingLeft = Just True
106
106
}]
107
107
, mkInlayHintsTest " Unused2" 12 $ \ ih -> do
108
- let mkLabelPart' = mkLabelPart " Unused2" 12 17
109
- foo <- mkLabelPart' " foo"
110
- bar <- mkLabelPart' " bar"
111
- baz <- mkLabelPart' " baz"
108
+ let mkLabelPart' = mkLabelPart " Unused2"
109
+ foo <- mkLabelPart' 6 4 " foo"
110
+ bar <- mkLabelPart' 7 4 " bar"
111
+ baz <- mkLabelPart' 8 4 " baz"
112
112
(@?=) ih
113
113
[defInlayHint { _position = Position 12 19
114
114
, _label = InR [ foo, commaPart
@@ -122,10 +122,10 @@ test = testGroup "explicit-fields"
122
122
, _paddingLeft = Just True
123
123
}]
124
124
, mkInlayHintsTest " WildcardOnly" 12 $ \ ih -> do
125
- let mkLabelPart' = mkLabelPart " WildcardOnly" 12 17
126
- foo <- mkLabelPart' " foo"
127
- bar <- mkLabelPart' " bar"
128
- baz <- mkLabelPart' " baz"
125
+ let mkLabelPart' = mkLabelPart " WildcardOnly"
126
+ foo <- mkLabelPart' 6 4 " foo"
127
+ bar <- mkLabelPart' 7 4 " bar"
128
+ baz <- mkLabelPart' 8 4 " baz"
129
129
(@?=) ih
130
130
[defInlayHint { _position = Position 12 19
131
131
, _label = InR [ foo, commaPart
@@ -139,9 +139,9 @@ test = testGroup "explicit-fields"
139
139
, _paddingLeft = Just True
140
140
}]
141
141
, mkInlayHintsTest " WithExplicitBind" 12 $ \ ih -> do
142
- let mkLabelPart' = mkLabelPart " WithExplicitBind" 12 29
143
- bar <- mkLabelPart' " bar"
144
- baz <- mkLabelPart' " baz"
142
+ let mkLabelPart' = mkLabelPart " WithExplicitBind"
143
+ bar <- mkLabelPart' 7 4 " bar"
144
+ baz <- mkLabelPart' 8 4 " baz"
145
145
(@?=) ih
146
146
[defInlayHint { _position = Position 12 31
147
147
, _label = InR [ bar, commaPart
@@ -154,9 +154,9 @@ test = testGroup "explicit-fields"
154
154
, _paddingLeft = Just True
155
155
}]
156
156
, mkInlayHintsTest " WithPun" 13 $ \ ih -> do
157
- let mkLabelPart' = mkLabelPart " WithPun" 13 22
158
- bar <- mkLabelPart' " bar"
159
- baz <- mkLabelPart' " baz"
157
+ let mkLabelPart' = mkLabelPart " WithPun"
158
+ bar <- mkLabelPart' 8 4 " bar"
159
+ baz <- mkLabelPart' 9 4 " baz"
160
160
(@?=) ih
161
161
[defInlayHint { _position = Position 13 24
162
162
, _label = InR [ bar, commaPart
@@ -227,17 +227,17 @@ defInlayHint =
227
227
}
228
228
229
229
mkLabelPart :: FilePath -> UInt -> UInt -> Text -> IO InlayHintLabelPart
230
- mkLabelPart fp dotline dotstart value = do
230
+ mkLabelPart fp line start value = do
231
231
uri' <- uri
232
- pure $ InlayHintLabelPart { _location = Just (location uri' dotline dotstart )
232
+ pure $ InlayHintLabelPart { _location = Just (location uri' line start )
233
233
, _value = value
234
234
, _tooltip = Nothing
235
235
, _command = Nothing
236
236
}
237
237
where
238
238
toUri = fromNormalizedUri . filePathToUri' . toNormalizedFilePath'
239
239
uri = canonicalizeUri $ toUri (testDataDir </> (fp ++ " .hs" ))
240
- location uri line char = Location uri (Range (Position line char) (Position line (char + 2 )))
240
+ location uri line char = Location uri (Range (Position line char) (Position line (char + ( fromIntegral $ T. length value) )))
241
241
242
242
commaPart :: InlayHintLabelPart
243
243
commaPart =
0 commit comments