File tree Expand file tree Collapse file tree 4 files changed +68
-2
lines changed Expand file tree Collapse file tree 4 files changed +68
-2
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,25 @@ type alias Info =
22
22
23
23
24
24
makeInfo : Reference -> FQN -> NEL .Nonempty FQN -> Info
25
- makeInfo ref suffixName allFqns =
25
+ makeInfo ref suffixName allFqns_ =
26
26
let
27
27
( namespace, otherNames ) =
28
- namespaceAndOtherNames ref suffixName allFqns
28
+ namespaceAndOtherNames ref suffixName allFqns_
29
29
in
30
30
Info suffixName namespace otherNames
31
31
32
32
33
+ allFqns : Info -> List FQN
34
+ allFqns info =
35
+ let
36
+ reconstructed =
37
+ info. namespace
38
+ |> Maybe . map ( \ namespace -> FQN . extend namespace info. name)
39
+ |> Maybe . withDefault info. name
40
+ in
41
+ reconstructed :: info. otherNames
42
+
43
+
33
44
34
45
-- Helpers
35
46
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module Code.Workspace exposing
2
2
( Model
3
3
, Msg
4
4
, OutMsg (..)
5
+ , currentlyOpenFqns
5
6
, currentlyOpenReferences
6
7
, init
7
8
, open
@@ -585,6 +586,11 @@ currentlyOpenReferences model =
585
586
WorkspaceItems . references model. workspaceItems
586
587
587
588
589
+ currentlyOpenFqns : Model -> List FQN
590
+ currentlyOpenFqns model =
591
+ WorkspaceItems . fqns model. workspaceItems
592
+
593
+
588
594
589
595
-- EFFECTS
590
596
Original file line number Diff line number Diff line change @@ -181,6 +181,30 @@ reference item =
181
181
refResponse
182
182
183
183
184
+ allFqns : WorkspaceItem -> List FQN
185
+ allFqns workspaceItem =
186
+ case workspaceItem of
187
+ Loading r ->
188
+ MaybeE . values [ Reference . fqn r ]
189
+
190
+ Failure r _ ->
191
+ MaybeE . values [ Reference . fqn r ]
192
+
193
+ Success _ { item } ->
194
+ case item of
195
+ TermItem ( Term _ _ { info } ) ->
196
+ Info . allFqns info
197
+
198
+ TypeItem ( Type _ _ { info } ) ->
199
+ Info . allFqns info
200
+
201
+ AbilityConstructorItem ( AbilityConstructor _ { info } ) ->
202
+ Info . allFqns info
203
+
204
+ DataConstructorItem ( DataConstructor _ { info } ) ->
205
+ Info . allFqns info
206
+
207
+
184
208
{- | Convert the Reference of a WorkspaceItem to be HashOnly
185
209
-}
186
210
toHashReference : WorkspaceItem -> WorkspaceItem
Original file line number Diff line number Diff line change 18
18
module Code.Workspace.WorkspaceItems exposing (..)
19
19
20
20
import Code.Definition.Reference exposing (Reference )
21
+ import Code.FullyQualifiedName exposing (FQN )
21
22
import Code.Hash exposing (Hash )
22
23
import Code.Workspace.WorkspaceItem as WorkspaceItem exposing (WorkspaceItem )
23
24
import List
@@ -288,6 +289,11 @@ references items =
288
289
|> List . map WorkspaceItem . reference
289
290
290
291
292
+ fqns : WorkspaceItems -> List FQN
293
+ fqns items =
294
+ concatMapToList ( \ i _ -> WorkspaceItem . allFqns i) items
295
+
296
+
291
297
head : WorkspaceItems -> Maybe WorkspaceItem
292
298
head items =
293
299
items
@@ -525,6 +531,25 @@ mapToList f wItems =
525
531
before ++ ( f data. focus True :: after)
526
532
527
533
534
+ concatMapToList : (WorkspaceItem -> Bool -> List a ) -> WorkspaceItems -> List a
535
+ concatMapToList f wItems =
536
+ case wItems of
537
+ Empty ->
538
+ []
539
+
540
+ WorkspaceItems data ->
541
+ let
542
+ before =
543
+ data. before
544
+ |> List . concatMap ( \ i -> f i False )
545
+
546
+ after =
547
+ data. after
548
+ |> List . concatMap ( \ i -> f i False )
549
+ in
550
+ before ++ f data. focus True ++ after
551
+
552
+
528
553
{- | Converting the workspace items to a list, looses the focus indicator
529
554
-}
530
555
toList : WorkspaceItems -> List WorkspaceItem
You can’t perform that action at this time.
0 commit comments