@@ -71,12 +71,12 @@ cabalKeywords =
71
71
stanzaKeywordMap :: Map StanzaType (Map KeyWordName Completer )
72
72
stanzaKeywordMap =
73
73
Map. fromList
74
- [ (" library" , libraryFields <> libExecTestBenchCommons),
75
- (" executable" , executableFields <> libExecTestBenchCommons),
76
- (" test-suite" , testSuiteFields <> libExecTestBenchCommons),
77
- (" benchmark" , benchmarkFields <> libExecTestBenchCommons),
78
- (" foreign-library" , foreignLibraryFields <> libExecTestBenchCommons),
79
- (" common" , libExecTestBenchCommons),
74
+ [ (" library" , libraryFields <> libExecTestBenchCommons " library " ),
75
+ (" executable" , executableFields <> libExecTestBenchCommons " executable " ),
76
+ (" test-suite" , testSuiteFields <> libExecTestBenchCommons " test-suite " ),
77
+ (" benchmark" , benchmarkFields <> libExecTestBenchCommons " benchmark " ),
78
+ (" foreign-library" , foreignLibraryFields <> libExecTestBenchCommons " benchmark " ),
79
+ (" common" , libExecTestBenchCommons " library " ),
80
80
(" flag" , flagFields),
81
81
(" source-repository" , sourceRepositoryFields)
82
82
]
@@ -90,9 +90,7 @@ libraryFields =
90
90
(" visibility:" , constantCompleter [" private" , " public" ]),
91
91
(" reexported-modules:" , noopCompleter),
92
92
(" signatures:" , noopCompleter),
93
- (" other-modules:" , modulesCompleter sourceDirsExtractionLibrary),
94
- (" autogen-includes:" , filePathCompleter),
95
- (" autogen-modules:" , modulesCompleter sourceDirsExtractionLibrary)
93
+ (" other-modules:" , modulesCompleter sourceDirsExtractionLibrary)
96
94
97
95
]
98
96
@@ -101,28 +99,23 @@ executableFields =
101
99
Map. fromList
102
100
[ (" main-is:" , mainIsCompleter sourceDirsExtractionExecutable),
103
101
(" scope:" , constantCompleter [" public" , " private" ]),
104
- (" other-modules:" , modulesCompleter sourceDirsExtractionExecutable),
105
- (" autogen-modules:" , modulesCompleter sourceDirsExtractionExecutable)
102
+ (" other-modules:" , modulesCompleter sourceDirsExtractionExecutable)
106
103
]
107
104
108
105
testSuiteFields :: Map KeyWordName Completer
109
106
testSuiteFields =
110
107
Map. fromList
111
108
[ (" type:" , constantCompleter [" exitcode-stdio-1.0" , " detailed-0.9" ]),
112
109
(" main-is:" , mainIsCompleter sourceDirsExtractionTestSuite),
113
- (" other-modules:" , modulesCompleter sourceDirsExtractionTestSuite),
114
- (" autogen-modules:" , modulesCompleter sourceDirsExtractionTestSuite),
115
- (" autogen-includes:" , filePathCompleter)
110
+ (" other-modules:" , modulesCompleter sourceDirsExtractionTestSuite)
116
111
]
117
112
118
113
benchmarkFields :: Map KeyWordName Completer
119
114
benchmarkFields =
120
115
Map. fromList
121
116
[ (" type:" , noopCompleter),
122
117
(" main-is:" , mainIsCompleter sourceDirsExtractionBenchmark),
123
- (" other-modules:" , modulesCompleter sourceDirsExtractionBenchmark),
124
- (" autogen-modules:" , modulesCompleter sourceDirsExtractionBenchmark),
125
- (" autogen-includes:" , filePathCompleter)
118
+ (" other-modules:" , modulesCompleter sourceDirsExtractionBenchmark)
126
119
]
127
120
128
121
foreignLibraryFields :: Map KeyWordName Completer
@@ -170,8 +163,20 @@ flagFields =
170
163
(" lib-version-linux:" , noopCompleter)
171
164
]
172
165
173
- libExecTestBenchCommons :: Map KeyWordName Completer
174
- libExecTestBenchCommons =
166
+ libExecTestBenchCommons :: StanzaType -> Map KeyWordName Completer
167
+ libExecTestBenchCommons stanza =
168
+ Map. insert " autogen-modules:" (modulesCompleter extractor) $
169
+ Map. insert " autogen-includes:" filePathCompleter baseBenchCommons
170
+ where
171
+ extractor = case stanza of
172
+ " library" -> sourceDirsExtractionLibrary
173
+ " executable" -> sourceDirsExtractionExecutable
174
+ " test-suite" -> sourceDirsExtractionTestSuite
175
+ " benchmark" -> sourceDirsExtractionBenchmark
176
+ _ -> sourceDirsExtractionLibrary
177
+
178
+ baseBenchCommons :: Map KeyWordName Completer
179
+ baseBenchCommons =
175
180
Map. fromList
176
181
[ (" import:" , importCompleter),
177
182
(" build-depends:" , noopCompleter),
0 commit comments