Skip to content

Commit b1bced2

Browse files
committed
hls-cabal-project-plugin: Add completions suggestions for cabal.project files.
1 parent e677c9b commit b1bced2

File tree

28 files changed

+1141
-87
lines changed

28 files changed

+1141
-87
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
# Commit git commit -m "Removed submodule <name>"
99
# Delete the now untracked submodule files
1010
# rm -rf path_to_submodule
11+
12+
[submodule "vendor/cabal"]
13+
path = vendor/cabal
14+
url = https://github.com/rm41339/cabal.git

cabal.project

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ packages:
66
./ghcide
77
./hls-plugin-api
88
./hls-test-utils
9+
./vendor/cabal/Cabal
10+
./vendor/cabal/Cabal-syntax
11+
./vendor/cabal/cabal-install
12+
./vendor/cabal/cabal-install-solver
13+
./vendor/cabal/Cabal-described
14+
./vendor/cabal/Cabal-tree-diff
915

16+
package cabal-install
17+
tests: False
18+
benchmarks: False
1019

1120
index-state: 2025-05-12T13:26:29Z
1221

haskell-language-server.cabal

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,15 @@ common cabalProject
333333

334334
library hls-cabal-project-plugin
335335
import: defaults, pedantic, warnings
336-
if !flag(cabal)
336+
if !flag(cabalProject)
337337
buildable: False
338338
exposed-modules:
339339
Ide.Plugin.CabalProject
340-
340+
Ide.Plugin.CabalProject.Parse
341+
Ide.Plugin.CabalProject.Diagnostics
342+
Ide.Plugin.CabalProject.Types
343+
Ide.Plugin.CabalProject.Completion.Completions
344+
Ide.Plugin.CabalProject.Completion.Data
341345

342346
build-depends:
343347
, bytestring
@@ -347,10 +351,10 @@ library hls-cabal-project-plugin
347351
, directory
348352
, filepath
349353
, extra >=1.7.4
350-
, ghcide == 2.9.0.1
354+
, ghcide == 2.11.0.0
351355
, hashable
352-
, hls-plugin-api == 2.9.0.1
353-
, hls-graph == 2.9.0.1
356+
, hls-plugin-api == 2.11.0.0
357+
, hls-graph == 2.11.0.0
354358
, lens
355359
, lsp ^>=2.7
356360
, lsp-types ^>=2.3
@@ -364,6 +368,11 @@ library hls-cabal-project-plugin
364368
, aeson
365369
, Cabal
366370
, pretty
371+
, cabal-install
372+
, cabal-install-solver
373+
, haskell-language-server:hls-cabal-plugin
374+
, base16-bytestring
375+
, cryptohash-sha1
367376

368377
hs-source-dirs: plugins/hls-cabal-project-plugin/src
369378

@@ -375,18 +384,22 @@ test-suite hls-cabal-project-plugin-tests
375384
hs-source-dirs: plugins/hls-cabal-project-plugin/test
376385
main-is: Main.hs
377386
other-modules:
387+
Completer
388+
Utils
378389
build-depends:
379390
, bytestring
380391
, Cabal-syntax >= 3.7
381392
, extra
382393
, filepath
383394
, ghcide
384395
, haskell-language-server:hls-cabal-project-plugin
385-
, hls-test-utils == 2.9.0.1
396+
, hls-test-utils == 2.11.0.0
386397
, lens
387398
, lsp-types
388399
, text
389400
, hls-plugin-api
401+
, cabal-install
402+
, haskell-language-server:hls-cabal-plugin
390403

391404
-----------------------------
392405
-- class plugin

plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Diagnostics.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module Ide.Plugin.Cabal.Diagnostics
55
, warningDiagnostic
66
, positionFromCabalPosition
77
, fatalParseErrorDiagnostic
8+
, toBeginningOfNextLine
9+
, mkDiag
810
-- * Re-exports
911
, FileDiagnostic
1012
, Diagnostic(..)

plugins/hls-cabal-plugin/test/testdata/completer.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ be
1111
library
1212
lib
1313

14-
co
14+
co

0 commit comments

Comments
 (0)