@@ -71,12 +71,12 @@ cabalKeywords =
7171stanzaKeywordMap  ::  Map  StanzaType  (Map  KeyWordName  Completer )
7272stanzaKeywordMap = 
7373  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 "  ),
8080      (" flag"  , flagFields),
8181      (" source-repository"  , sourceRepositoryFields)
8282    ]
@@ -90,9 +90,7 @@ libraryFields =
9090      (" visibility:"  , constantCompleter [" private"  , " public"  ]),
9191      (" reexported-modules:"  , noopCompleter),
9292      (" signatures:"  , noopCompleter),
93-       (" other-modules:"  , modulesCompleter sourceDirsExtractionLibrary),
94-       (" autogen-includes:"  , filePathCompleter),
95-       (" autogen-modules:"  , modulesCompleter sourceDirsExtractionLibrary)
93+       (" other-modules:"  , modulesCompleter sourceDirsExtractionLibrary)
9694
9795    ]
9896
@@ -101,28 +99,23 @@ executableFields =
10199  Map. fromList
102100    [ (" main-is:"  , mainIsCompleter sourceDirsExtractionExecutable),
103101      (" scope:"  , constantCompleter [" public"  , " private"  ]),
104-       (" other-modules:"  , modulesCompleter sourceDirsExtractionExecutable),
105-       (" autogen-modules:"  , modulesCompleter sourceDirsExtractionExecutable)
102+       (" other-modules:"  , modulesCompleter sourceDirsExtractionExecutable)
106103    ]
107104
108105testSuiteFields  ::  Map  KeyWordName  Completer 
109106testSuiteFields = 
110107  Map. fromList
111108    [ (" type:"  , constantCompleter [" exitcode-stdio-1.0"  , " detailed-0.9"  ]),
112109      (" main-is:"  , mainIsCompleter sourceDirsExtractionTestSuite),
113-       (" other-modules:"  , modulesCompleter sourceDirsExtractionTestSuite),
114-       (" autogen-modules:"  , modulesCompleter sourceDirsExtractionTestSuite),
115-       (" autogen-includes:"  , filePathCompleter)
110+       (" other-modules:"  , modulesCompleter sourceDirsExtractionTestSuite)
116111    ]
117112
118113benchmarkFields  ::  Map  KeyWordName  Completer 
119114benchmarkFields = 
120115  Map. fromList
121116    [ (" type:"  , noopCompleter),
122117      (" main-is:"  , mainIsCompleter sourceDirsExtractionBenchmark),
123-       (" other-modules:"  , modulesCompleter sourceDirsExtractionBenchmark),
124-       (" autogen-modules:"  , modulesCompleter sourceDirsExtractionBenchmark),
125-       (" autogen-includes:"  , filePathCompleter)
118+       (" other-modules:"  , modulesCompleter sourceDirsExtractionBenchmark)
126119    ]
127120
128121foreignLibraryFields  ::  Map  KeyWordName  Completer 
@@ -170,8 +163,20 @@ flagFields =
170163      (" lib-version-linux:"  , noopCompleter)
171164    ]
172165
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 = 
175180  Map. fromList
176181    [ (" import:"  , importCompleter),
177182      (" build-depends:"  , noopCompleter),
0 commit comments