Skip to content

Refactor autogen completions using libExecTestBenchCommons and consolidate test data #4535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ flag cabalgild
manual: True

common cabalgild
if flag(cabalgild) && impl(ghc < 9.11)
if flag(cabalgild) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-cabal-gild-plugin
cpp-options: -Dhls_cabalgild

Expand All @@ -186,7 +186,7 @@ flag isolateCabalGildTests

library hls-cabal-gild-plugin
import: defaults, pedantic, warnings
if !flag(cabalgild) || impl(ghc > 9.11)
if !flag(cabalgild) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Ide.Plugin.CabalGild
hs-source-dirs: plugins/hls-cabal-gild-plugin/src
Expand All @@ -203,7 +203,7 @@ library hls-cabal-gild-plugin
-- The `hls-cabal-plugin` is needed for tests, as we need to install notification handlers
test-suite hls-cabal-gild-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !flag(cabalgild) || !flag(cabal) || impl(ghc > 9.11)
if !flag(cabalgild) || !flag(cabal) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-cabal-gild-plugin/test
Expand Down Expand Up @@ -580,13 +580,13 @@ flag rename
manual: True

common rename
if flag(rename) && impl(ghc < 9.11)
if flag(rename) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-rename-plugin
cpp-options: -Dhls_rename

library hls-rename-plugin
import: defaults, pedantic, warnings
if !flag(rename) || impl(ghc > 9.11)
if !flag(rename) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Ide.Plugin.Rename
hs-source-dirs: plugins/hls-rename-plugin/src
Expand All @@ -610,7 +610,7 @@ library hls-rename-plugin

test-suite hls-rename-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !flag(rename) || impl(ghc > 9.11)
if !flag(rename) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-rename-plugin/test
Expand All @@ -636,13 +636,13 @@ flag retrie
manual: True

common retrie
if flag(retrie) && impl(ghc < 9.10)
if flag(retrie) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-retrie-plugin
cpp-options: -Dhls_retrie

library hls-retrie-plugin
import: defaults, pedantic, warnings
if !(flag(retrie) && impl(ghc < 9.10))
if !(flag(retrie) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
exposed-modules: Ide.Plugin.Retrie
hs-source-dirs: plugins/hls-retrie-plugin/src
Expand Down Expand Up @@ -673,7 +673,7 @@ library hls-retrie-plugin

test-suite hls-retrie-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !(flag(retrie) && impl(ghc < 9.10))
if !(flag(retrie) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-retrie-plugin/test
Expand Down Expand Up @@ -703,14 +703,14 @@ flag hlint
manual: True

common hlint
if flag(hlint) && impl(ghc < 9.10)
if flag(hlint) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-hlint-plugin
cpp-options: -Dhls_hlint

library hls-hlint-plugin
import: defaults, pedantic, warnings
-- https://github.com/ndmitchell/hlint/pull/1594
if !(flag(hlint)) || impl(ghc > 9.10)
if !(flag(hlint)) || (impl(ghc > 9.10) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Ide.Plugin.Hlint
hs-source-dirs: plugins/hls-hlint-plugin/src
Expand Down Expand Up @@ -753,7 +753,7 @@ library hls-hlint-plugin

test-suite hls-hlint-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if (!flag(hlint)) || impl(ghc > 9.10)
if (!flag(hlint)) || (impl(ghc > 9.10) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-hlint-plugin/test
Expand Down Expand Up @@ -782,13 +782,13 @@ flag stan
manual: True

common stan
if flag(stan) && impl(ghc < 9.11)
if flag(stan) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-stan-plugin
cpp-options: -Dhls_stan

library hls-stan-plugin
import: defaults, pedantic, warnings
if !flag(stan) || impl(ghc > 9.11)
if !flag(stan) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Ide.Plugin.Stan
hs-source-dirs: plugins/hls-stan-plugin/src
Expand All @@ -813,7 +813,7 @@ library hls-stan-plugin

test-suite hls-stan-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !flag(stan) || impl(ghc > 9.11)
if !flag(stan) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-stan-plugin/test
Expand Down Expand Up @@ -932,13 +932,13 @@ flag splice
manual: True

common splice
if flag(splice) && impl(ghc < 9.10)
if flag(splice) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-splice-plugin
cpp-options: -Dhls_splice

library hls-splice-plugin
import: defaults, pedantic, warnings
if !(flag(splice) && impl(ghc < 9.10))
if !(flag(splice) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
exposed-modules:
Ide.Plugin.Splice
Expand Down Expand Up @@ -966,7 +966,7 @@ library hls-splice-plugin

test-suite hls-splice-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !(flag(splice) && impl(ghc < 9.10))
if !(flag(splice) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-splice-plugin/test
Expand Down Expand Up @@ -1208,13 +1208,13 @@ flag gadt
manual: True

common gadt
if flag(gadt) && impl(ghc < 9.11)
if flag(gadt) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-gadt-plugin
cpp-options: -Dhls_gadt

library hls-gadt-plugin
import: defaults, pedantic, warnings
if !flag(gadt) || impl(ghc > 9.11)
if !flag(gadt) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Ide.Plugin.GADT
other-modules: Ide.Plugin.GHC
Expand All @@ -1238,7 +1238,7 @@ library hls-gadt-plugin

test-suite hls-gadt-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !flag(gadt) || impl(ghc > 9.11)
if !flag(gadt) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-gadt-plugin/test
Expand Down Expand Up @@ -1400,14 +1400,14 @@ flag floskell
manual: True

common floskell
if flag(floskell) && impl(ghc < 9.10)
if flag(floskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-floskell-plugin
cpp-options: -Dhls_floskell

library hls-floskell-plugin
import: defaults, pedantic, warnings
-- https://github.com/ennocramer/floskell/pull/82
if !(flag(floskell) && impl(ghc < 9.10))
if !(flag(floskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
exposed-modules: Ide.Plugin.Floskell
hs-source-dirs: plugins/hls-floskell-plugin/src
Expand All @@ -1422,7 +1422,7 @@ library hls-floskell-plugin

test-suite hls-floskell-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !(flag(floskell) && impl(ghc < 9.10))
if !(flag(floskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-floskell-plugin/test
Expand All @@ -1442,13 +1442,13 @@ flag fourmolu
manual: True

common fourmolu
if flag(fourmolu) && impl(ghc < 9.11)
if flag(fourmolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-fourmolu-plugin
cpp-options: -Dhls_fourmolu

library hls-fourmolu-plugin
import: defaults, pedantic, warnings
if !flag(fourmolu) || impl(ghc > 9.11)
if !flag(fourmolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Ide.Plugin.Fourmolu
hs-source-dirs: plugins/hls-fourmolu-plugin/src
Expand All @@ -1468,7 +1468,7 @@ library hls-fourmolu-plugin

test-suite hls-fourmolu-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !flag(fourmolu) || impl(ghc > 9.11)
if !flag(fourmolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-fourmolu-plugin/test
Expand Down Expand Up @@ -1496,13 +1496,13 @@ flag ormolu
manual: True

common ormolu
if flag(ormolu) && impl(ghc < 9.11)
if flag(ormolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-ormolu-plugin
cpp-options: -Dhls_ormolu

library hls-ormolu-plugin
import: defaults, pedantic, warnings
if !flag(ormolu) || impl(ghc > 9.11)
if !flag(ormolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Ide.Plugin.Ormolu
hs-source-dirs: plugins/hls-ormolu-plugin/src
Expand All @@ -1522,7 +1522,7 @@ library hls-ormolu-plugin

test-suite hls-ormolu-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !flag(ormolu) || impl(ghc > 9.11)
if !flag(ormolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-ormolu-plugin/test
Expand Down Expand Up @@ -1551,14 +1551,14 @@ flag stylishHaskell
manual: True

common stylishHaskell
if flag(stylishHaskell) && impl(ghc < 9.10)
if flag(stylishHaskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-stylish-haskell-plugin
cpp-options: -Dhls_stylishHaskell

library hls-stylish-haskell-plugin
import: defaults, pedantic, warnings
-- https://github.com/haskell/stylish-haskell/issues/479
if !(flag(stylishHaskell) && impl(ghc < 9.10))
if !(flag(stylishHaskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
exposed-modules: Ide.Plugin.StylishHaskell
hs-source-dirs: plugins/hls-stylish-haskell-plugin/src
Expand All @@ -1576,7 +1576,7 @@ library hls-stylish-haskell-plugin

test-suite hls-stylish-haskell-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !(flag(stylishHaskell) && impl(ghc < 9.10))
if !(flag(stylishHaskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-stylish-haskell-plugin/test
Expand All @@ -1596,13 +1596,13 @@ flag refactor
manual: True

common refactor
if flag(refactor) && impl(ghc < 9.11)
if flag(refactor) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
build-depends: haskell-language-server:hls-refactor-plugin
cpp-options: -Dhls_refactor

library hls-refactor-plugin
import: defaults, pedantic, warnings
if !flag(refactor) || impl(ghc > 9.11)
if !flag(refactor) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
exposed-modules: Development.IDE.GHC.ExactPrint
Development.IDE.GHC.Compat.ExactPrint
Expand Down Expand Up @@ -1661,7 +1661,7 @@ library hls-refactor-plugin

test-suite hls-refactor-plugin-tests
import: defaults, pedantic, test-defaults, warnings
if !flag(refactor) || impl(ghc > 9.11)
if !flag(refactor) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
buildable: False
type: exitcode-stdio-1.0
hs-source-dirs: plugins/hls-refactor-plugin/test
Expand Down Expand Up @@ -2007,11 +2007,11 @@ test-suite func-test
if flag(eval)
cpp-options: -Dhls_eval
-- formatters
if flag(floskell) && impl(ghc < 9.10)
if flag(floskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
cpp-options: -Dhls_floskell
if flag(fourmolu) && impl(ghc < 9.11)
if flag(fourmolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
cpp-options: -Dhls_fourmolu
if flag(ormolu) && impl(ghc < 9.11)
if flag(ormolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
cpp-options: -Dhls_ormolu

test-suite wrapper-test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ cabalKeywords =
stanzaKeywordMap :: Map StanzaType (Map KeyWordName Completer)
stanzaKeywordMap =
Map.fromList
[ ("library", libraryFields <> libExecTestBenchCommons),
("executable", executableFields <> libExecTestBenchCommons),
("test-suite", testSuiteFields <> libExecTestBenchCommons),
("benchmark", benchmarkFields <> libExecTestBenchCommons),
("foreign-library", foreignLibraryFields <> libExecTestBenchCommons),
("common", libExecTestBenchCommons),
[ ("library", libraryFields <> libExecTestBenchCommons "library"),
("executable", executableFields <> libExecTestBenchCommons "executable"),
("test-suite", testSuiteFields <> libExecTestBenchCommons "test-suite"),
("benchmark", benchmarkFields <> libExecTestBenchCommons "benchmark"),
("foreign-library", foreignLibraryFields <> libExecTestBenchCommons "benchmark"),
("common", libExecTestBenchCommons "library"),
("flag", flagFields),
("source-repository", sourceRepositoryFields)
]
Expand All @@ -91,6 +91,7 @@ libraryFields =
("reexported-modules:", noopCompleter),
("signatures:", noopCompleter),
("other-modules:", modulesCompleter sourceDirsExtractionLibrary)

]

executableFields :: Map KeyWordName Completer
Expand Down Expand Up @@ -162,8 +163,20 @@ flagFields =
("lib-version-linux:", noopCompleter)
]

libExecTestBenchCommons :: Map KeyWordName Completer
libExecTestBenchCommons =
libExecTestBenchCommons :: StanzaType -> Map KeyWordName Completer
libExecTestBenchCommons stanza =
Map.insert "autogen-modules:" (modulesCompleter extractor) $
Map.insert "autogen-includes:" filePathCompleter baseBenchCommons
where
extractor = case stanza of
"library" -> sourceDirsExtractionLibrary
"executable" -> sourceDirsExtractionExecutable
"test-suite" -> sourceDirsExtractionTestSuite
"benchmark" -> sourceDirsExtractionBenchmark
_ -> sourceDirsExtractionLibrary

baseBenchCommons :: Map KeyWordName Completer
baseBenchCommons =
Map.fromList
[ ("import:", importCompleter),
("build-depends:", noopCompleter),
Expand Down
Loading
Loading