@@ -8,19 +8,15 @@ import qualified Data.Text as T
8
8
import Development.IDE.GHC.Compat.Core (flagsForCompletion )
9
9
import Distribution.CabalSpecVersion (CabalSpecVersion (CabalSpecV2_2 ),
10
10
showCabalSpecVersion )
11
- -- import Ide.Plugin.Cabal.Completion.Completer.FilePath
12
- -- import Ide.Plugin.Cabal.Completion.Completer.Module
13
- -- import Ide.Plugin.Cabal.Completion.Completer.Paths
14
11
import Ide.Plugin.Cabal.Completion.Completer.FilePath (directoryCompleter ,
15
12
filePathCompleter )
16
13
import Ide.Plugin.Cabal.Completion.Completer.Simple
17
14
import Ide.Plugin.Cabal.Completion.Completer.Types (Completer )
18
15
import Ide.Plugin.Cabal.Completion.Types
19
- -- import Ide.Plugin.Cabal.LicenseSuggest (licenseNames)
20
16
21
17
-- | Ad-hoc data type for modelling the available top-level stanzas.
22
18
-- Not intended right now for anything else but to avoid string
23
- -- comparisons in 'stanzaKeywordMap' and 'libExecTestBenchCommons' .
19
+ -- comparisons in 'stanzaKeywordMap'.
24
20
data TopLevelStanza
25
21
= Package
26
22
| ProgramOptions
@@ -29,30 +25,16 @@ data TopLevelStanza
29
25
-- Completion Data
30
26
-- ----------------------------------------------------------------
31
27
32
- -- supportedCabalVersions :: [CabalSpecVersion]
33
- -- supportedCabalVersions = [CabalSpecV2_2 .. maxBound]
34
-
35
- -- -- | Keyword for cabal version; required to be the top line in a cabal file
36
- -- cabalVersionKeyword :: Map KeyWordName Completer
37
- -- cabalVersionKeyword =
38
- -- Map.singleton "cabal-version:" $
39
- -- constantCompleter $
40
- -- -- We only suggest cabal versions newer than 2.2
41
- -- -- since we don't recommend using older ones.
42
- -- map (T.pack . showCabalSpecVersion) supportedCabalVersions
43
-
44
- -- | Top level keywords of a cabal file.
28
+ -- | Top level keywords of a cabal.project file.
45
29
--
46
30
-- TODO: we could add descriptions of field values and
47
31
-- then show them when inside the field's context
48
32
cabalProjectKeywords :: Map KeyWordName Completer
49
33
cabalProjectKeywords =
50
34
Map. fromList
51
- [ -- projectConfigFieldGrammar
52
- (" packages:" , filePathCompleter),
35
+ [ (" packages:" , filePathCompleter),
53
36
(" optional-packages:" , filePathCompleter),
54
37
(" extra-packages:" , filePathCompleter),
55
- -- projectConfigBuildOnlyFieldGrammar
56
38
(" verbose:" , constantCompleter [" 0" , " 1" , " 2" , " 3" ]),
57
39
(" build-summary:" , filePathCompleter),
58
40
(" build-log:" , noopCompleter),
@@ -68,7 +50,6 @@ cabalProjectKeywords =
68
50
(" ignore-expiry:" , constantCompleter [" False" , " True" ]),
69
51
(" remote-repo-cache:" , noopCompleter),
70
52
(" logs-dir:" , noopCompleter),
71
- -- projectConfigSharedFieldGrammar
72
53
(" builddir:" , noopCompleter),
73
54
(" project-dir:" , noopCompleter),
74
55
(" project-file:" , noopCompleter),
@@ -101,16 +82,14 @@ cabalProjectKeywords =
101
82
(" prefer-oldest:" , noopCompleter),
102
83
(" extra-prog-path-shared-only:" , noopCompleter),
103
84
(" multi-repl:" , noopCompleter),
104
- -- extras
105
85
(" benchmarks:" , constantCompleter [" False" , " True" ]),
106
86
(" import:" , filePathCompleter)
107
87
]
108
88
109
89
packageFields :: Map KeyWordName Completer
110
90
packageFields =
111
91
Map. fromList
112
- [ -- packageConfigFieldGrammar
113
- (" haddock-all:" , constantCompleter [" False" , " True" ]),
92
+ [ (" haddock-all:" , constantCompleter [" False" , " True" ]),
114
93
(" extra-prog-path:" , filePathCompleter),
115
94
(" flags:" , noopCompleter),
116
95
(" library-vanilla:" , constantCompleter [" True" , " False" ]),
@@ -171,18 +150,10 @@ packageFields =
171
150
(" test-fail-when-no-test-suites:" , noopCompleter),
172
151
(" test-options:" , noopCompleter),
173
152
(" benchmark-options:" , noopCompleter),
174
- -- packageConfigCoverageGrammar
175
153
(" coverage:" , constantCompleter [" False" , " True" ]),
176
- -- other
177
154
(" ghc-options:" , noopCompleter)
178
155
]
179
156
180
- -- just for testing right now, to be filled in later
181
- programOptionsFields :: Map KeyWordName Completer
182
- programOptionsFields = Map. fromList
183
- [ (" ghc-options:" , noopCompleter)
184
- ]
185
-
186
157
sourceRepoFields :: Map KeyWordName Completer
187
158
sourceRepoFields = Map. fromList
188
159
[ (" type:" , constantCompleter
@@ -196,18 +167,18 @@ sourceRepoFields = Map.fromList
196
167
" bzr" ,
197
168
" arch" ,
198
169
" monotone"
199
- ]), -- just used the one from cabal
170
+ ]),
200
171
(" location:" , noopCompleter),
201
172
(" tag:" , noopCompleter),
202
173
(" subdir:" , noopCompleter)
203
174
]
204
175
205
- -- | Map, containing all stanzas in a cabal file as keys,
176
+ -- | Map, containing all stanzas in a cabal.project file as keys,
206
177
-- and lists of their possible nested keywords as values.
207
178
stanzaKeywordMap :: Map StanzaType (Map KeyWordName Completer )
208
179
stanzaKeywordMap =
209
180
Map. fromList
210
181
[ (" package" , packageFields),
211
- (" program-options" , programOptionsFields ),
182
+ (" program-options" , packageFields ),
212
183
(" source-repository-package" , sourceRepoFields)
213
184
]
0 commit comments