1
- {-# LANGUAGE DisambiguateRecordFields #-}
2
- {-# LANGUAGE OverloadedStrings #-}
1
+ {-# LANGUAGE OverloadedStrings #-}
3
2
4
3
module Outline (
5
4
outlineTests
6
5
) where
7
6
8
- import qualified Language.LSP.Protocol.Types as LSP
9
- import Test.Hls
7
+ import Language.LSP.Protocol.Types (DocumentSymbol (.. ),
8
+ Position (.. ), Range (.. ))
9
+ import qualified Test.Hls as T
10
10
import Utils
11
11
12
- testSymbols :: (HasCallStack ) => TestName -> FilePath -> [DocumentSymbol ] -> TestTree
12
+ testSymbols :: (T. HasCallStack ) => T. TestName -> FilePath -> [DocumentSymbol ] -> T. TestTree
13
13
testSymbols testName path expectedSymbols =
14
14
runCabalTestCaseSession testName " outline-cabal" $ do
15
- docId <- openDoc path " cabal"
16
- symbols <- getDocumentSymbols docId
17
- liftIO $ symbols @?= Right expectedSymbols
15
+ docId <- T. openDoc path " cabal"
16
+ symbols <- T. getDocumentSymbols docId
17
+ T. liftIO $ symbols T. @?= Right expectedSymbols
18
18
19
- outlineTests :: TestTree
19
+ outlineTests :: T. TestTree
20
20
outlineTests =
21
- testGroup
21
+ T. testGroup
22
22
" Cabal Outline Tests"
23
23
[ testSymbols
24
24
" cabal Field outline test"
@@ -42,43 +42,43 @@ outlineTests =
42
42
fieldDocumentSymbol = (defDocumentSymbol (Range {_start = Position {_line = 0 , _character = 0 },
43
43
_end = Position {_line = 0 , _character = 8 }}))
44
44
{ _name = " homepage" ,
45
- _kind = SymbolKind_Field ,
45
+ _kind = T. SymbolKind_Field ,
46
46
_children = Nothing
47
47
}
48
48
fieldLineDocumentSymbol :: DocumentSymbol
49
49
fieldLineDocumentSymbol = (defDocumentSymbol (Range {_start = Position {_line = 0 , _character = 0 },
50
50
_end = Position {_line = 0 , _character = 13 }}))
51
51
{ _name = " cabal-version" ,
52
- _kind = SymbolKind_Field ,
52
+ _kind = T. SymbolKind_Field ,
53
53
_children = Nothing -- the values of fieldLine are removed from the outline
54
54
}
55
55
sectionDocumentSymbol :: DocumentSymbol
56
56
sectionDocumentSymbol = (defDocumentSymbol (Range {_start = Position {_line = 0 , _character = 2 },
57
57
_end = Position {_line = 0 , _character = 15 }}))
58
58
{ _name = " build-depends" ,
59
- _kind = SymbolKind_Field ,
59
+ _kind = T. SymbolKind_Field ,
60
60
_children = Nothing -- the values of fieldLine are removed from the outline
61
61
}
62
62
sectionArgDocumentSymbol :: DocumentSymbol
63
63
sectionArgDocumentSymbol = (defDocumentSymbol (Range {_start = Position {_line = 0 , _character = 2 },
64
64
_end = Position {_line = 0 , _character = 19 }}))
65
65
{ _name = " if os ( windows )" ,
66
- _kind = SymbolKind_Object ,
66
+ _kind = T. SymbolKind_Object ,
67
67
_children = Just $ [sectionArgChildrenDocumentSymbol] }
68
68
sectionArgChildrenDocumentSymbol :: DocumentSymbol
69
69
sectionArgChildrenDocumentSymbol = (defDocumentSymbol (Range {_start = Position {_line = 1 , _character = 4 },
70
70
_end = Position {_line = 1 , _character = 17 }}))
71
71
{ _name = " build-depends" ,
72
- _kind = SymbolKind_Field ,
72
+ _kind = T. SymbolKind_Field ,
73
73
_children = Nothing
74
74
}
75
75
76
- defDocumentSymbol :: LSP. Range -> DocumentSymbol
76
+ defDocumentSymbol :: Range -> DocumentSymbol
77
77
defDocumentSymbol range = DocumentSymbol
78
78
{ _detail = Nothing
79
79
, _deprecated = Nothing
80
80
, _name = " "
81
- , _kind = LSP . SymbolKind_File
81
+ , _kind = T . SymbolKind_File
82
82
, _range = range
83
83
, _selectionRange = range
84
84
, _children = Nothing
0 commit comments