File tree 4 files changed +18
-1
lines changed
src/Ide/Plugin/Cabal/Completion
4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ cabalKeywords =
63
63
(" extra-tmp-files:" , filePathCompleter)
64
64
]
65
65
66
- -- | Map, containing all stanzas in a cabal file as keys
66
+ -- | Map, containing all stanzas in a cabal file as keys,
67
67
-- and lists of their possible nested keywords as values.
68
68
stanzaKeywordMap :: Map StanzaType (Map KeyWordName Completer )
69
69
stanzaKeywordMap =
@@ -73,6 +73,7 @@ stanzaKeywordMap =
73
73
(" test-suite" , testSuiteFields <> libExecTestBenchCommons),
74
74
(" benchmark" , benchmarkFields <> libExecTestBenchCommons),
75
75
(" foreign-library" , foreignLibraryFields <> libExecTestBenchCommons),
76
+ (" common" , libExecTestBenchCommons),
76
77
(" flag" , flagFields),
77
78
(" source-repository" , sourceRepositoryFields)
78
79
]
Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ basicCompleterTests =
51
51
compls <- getCompletions doc (Position 8 2 )
52
52
let complTexts = getTextEditTexts compls
53
53
liftIO $ assertBool " suggests benchmark" $ " benchmark" `elem` complTexts
54
+ , runCabalTestCaseSession " In top level context - stanza should be suggested" " " $ do
55
+ doc <- openDoc " completer.cabal" " cabal"
56
+ compls <- getCompletions doc (Position 13 2 )
57
+ let complTexts = getTextEditTexts compls
58
+ liftIO $ assertBool " suggests common" $ " common" `elem` complTexts
54
59
, runCabalTestCaseSession " Main-is completions should be relative to hs-source-dirs of same stanza" " filepath-completions" $ do
55
60
doc <- openDoc " main-is.cabal" " cabal"
56
61
compls <- getCompletions doc (Position 10 12 )
Original file line number Diff line number Diff line change @@ -188,6 +188,9 @@ getContextTests =
188
188
, (Stanza " source-repository" (Just " head" ), KeyWord " type:" )
189
189
, (Stanza " source-repository" (Just " head" ), KeyWord " type:" )
190
190
, (Stanza " source-repository" (Just " head" ), None )
191
+ , (Stanza " common" (Just " cabalfmt" ), None )
192
+ , (Stanza " common" (Just " cabalfmt" ), None )
193
+ , (Stanza " common" (Just " cabalfmt" ), KeyWord " build-depends:" )
191
194
]
192
195
$ \ fileContent posPrefInfo ->
193
196
callGetContext (cursorPos posPrefInfo) (prefixText posPrefInfo) fileContent
@@ -276,4 +279,10 @@ source-repository head
276
279
location: https://github.com/haskell/haskell-language-server
277
280
278
281
^
282
+ common cabalfmt
283
+
284
+ ^
285
+ build-depends: haskell-language-server:hls-cabal-fmt-plugin
286
+ ^ ^
287
+ cpp-options: -Dhls_cabalfmt
279
288
|]
Original file line number Diff line number Diff line change 10
10
11
11
library
12
12
lib
13
+
14
+ co
You can’t perform that action at this time.
0 commit comments