Skip to content

Commit a479a31

Browse files
committed
edit Completions/Data documentation
1 parent 0558c84 commit a479a31

File tree

4 files changed

+9
-46
lines changed

4 files changed

+9
-46
lines changed

plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject/Completion/CabalProjectFields.hs

Lines changed: 0 additions & 7 deletions
This file was deleted.

plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject/Completion/Completions.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import qualified Distribution.Fields as Syntax
1414
import qualified Distribution.Parsec.Position as Syntax
1515
import Ide.Plugin.Cabal.Completion.CabalFields
1616
import Ide.Plugin.Cabal.Completion.Completer.Simple
17-
-- import Ide.Plugin.Cabal.Completion.Completer.Snippet
1817
import Ide.Plugin.Cabal.Completion.Completer.Types (Completer)
1918
import Ide.Plugin.Cabal.Completion.Types
2019
import Ide.Plugin.CabalProject.Completion.Data
@@ -29,7 +28,7 @@ import System.FilePath (takeBaseName)
2928
-- | Takes information about the completion context within the file
3029
-- and finds the correct completer to be applied.
3130
contextToCompleter :: Context -> Completer
32-
-- if we are in the top level of the cabal file and not in a keyword context,
31+
-- if we are in the top level of the cabal.project file and not in a keyword context,
3332
-- we can write any top level keywords or a stanza declaration
3433
contextToCompleter (TopLevel, None) =
3534
constantCompleter $

plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject/Completion/Data.hs

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ import qualified Data.Text as T
88
import Development.IDE.GHC.Compat.Core (flagsForCompletion)
99
import Distribution.CabalSpecVersion (CabalSpecVersion (CabalSpecV2_2),
1010
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
1411
import Ide.Plugin.Cabal.Completion.Completer.FilePath (directoryCompleter,
1512
filePathCompleter)
1613
import Ide.Plugin.Cabal.Completion.Completer.Simple
1714
import Ide.Plugin.Cabal.Completion.Completer.Types (Completer)
1815
import Ide.Plugin.Cabal.Completion.Types
19-
-- import Ide.Plugin.Cabal.LicenseSuggest (licenseNames)
2016

2117
-- | Ad-hoc data type for modelling the available top-level stanzas.
2218
-- Not intended right now for anything else but to avoid string
23-
-- comparisons in 'stanzaKeywordMap' and 'libExecTestBenchCommons'.
19+
-- comparisons in 'stanzaKeywordMap'.
2420
data TopLevelStanza
2521
= Package
2622
| ProgramOptions
@@ -29,30 +25,16 @@ data TopLevelStanza
2925
-- Completion Data
3026
-- ----------------------------------------------------------------
3127

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.
4529
--
4630
-- TODO: we could add descriptions of field values and
4731
-- then show them when inside the field's context
4832
cabalProjectKeywords :: Map KeyWordName Completer
4933
cabalProjectKeywords =
5034
Map.fromList
51-
[ -- projectConfigFieldGrammar
52-
("packages:", filePathCompleter),
35+
[ ("packages:", filePathCompleter),
5336
("optional-packages:", filePathCompleter),
5437
("extra-packages:", filePathCompleter),
55-
-- projectConfigBuildOnlyFieldGrammar
5638
("verbose:", constantCompleter ["0", "1", "2", "3"]),
5739
("build-summary:", filePathCompleter),
5840
("build-log:", noopCompleter),
@@ -68,7 +50,6 @@ cabalProjectKeywords =
6850
("ignore-expiry:", constantCompleter ["False", "True"]),
6951
("remote-repo-cache:", noopCompleter),
7052
("logs-dir:", noopCompleter),
71-
-- projectConfigSharedFieldGrammar
7253
("builddir:", noopCompleter),
7354
("project-dir:", noopCompleter),
7455
("project-file:", noopCompleter),
@@ -101,16 +82,14 @@ cabalProjectKeywords =
10182
("prefer-oldest:", noopCompleter),
10283
("extra-prog-path-shared-only:", noopCompleter),
10384
("multi-repl:", noopCompleter),
104-
-- extras
10585
("benchmarks:", constantCompleter ["False", "True"]),
10686
("import:", filePathCompleter)
10787
]
10888

10989
packageFields :: Map KeyWordName Completer
11090
packageFields =
11191
Map.fromList
112-
[ -- packageConfigFieldGrammar
113-
("haddock-all:", constantCompleter ["False", "True"]),
92+
[ ("haddock-all:", constantCompleter ["False", "True"]),
11493
("extra-prog-path:", filePathCompleter),
11594
("flags:", noopCompleter),
11695
("library-vanilla:", constantCompleter ["True", "False"]),
@@ -171,18 +150,10 @@ packageFields =
171150
("test-fail-when-no-test-suites:", noopCompleter),
172151
("test-options:", noopCompleter),
173152
("benchmark-options:", noopCompleter),
174-
-- packageConfigCoverageGrammar
175153
("coverage:", constantCompleter ["False", "True"]),
176-
-- other
177154
("ghc-options:", noopCompleter)
178155
]
179156

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-
186157
sourceRepoFields :: Map KeyWordName Completer
187158
sourceRepoFields = Map.fromList
188159
[ ("type:", constantCompleter
@@ -196,18 +167,18 @@ sourceRepoFields = Map.fromList
196167
"bzr",
197168
"arch",
198169
"monotone"
199-
]), -- just used the one from cabal
170+
]),
200171
("location:", noopCompleter),
201172
("tag:", noopCompleter),
202173
("subdir:", noopCompleter)
203174
]
204175

205-
-- | Map, containing all stanzas in a cabal file as keys,
176+
-- | Map, containing all stanzas in a cabal.project file as keys,
206177
-- and lists of their possible nested keywords as values.
207178
stanzaKeywordMap :: Map StanzaType (Map KeyWordName Completer)
208179
stanzaKeywordMap =
209180
Map.fromList
210181
[ ("package", packageFields),
211-
("program-options", programOptionsFields),
182+
("program-options", packageFields),
212183
("source-repository-package", sourceRepoFields)
213184
]

vendor/cabal

Submodule cabal updated from 447964a to b44fecd

0 commit comments

Comments
 (0)