Skip to content

cabal-add integration as a CodeAction #4360

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

Merged
merged 66 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
4004210
cabal-add code action traces
VenInf Jun 28, 2024
76af0ab
showing specific code action
VenInf Jun 29, 2024
b2e45a0
hidden package progress
VenInf Jul 1, 2024
a940b58
+ hidden-package test case
VenInf Jul 2, 2024
ccbd228
test cases update
VenInf Jul 4, 2024
0266514
embedded cabal-add
VenInf Jul 4, 2024
5cf86c8
cabal-add CodeAction, PATH cabal-add install
VenInf Jul 5, 2024
fc2db8f
+ cabal file path in CodeAction
VenInf Jul 9, 2024
922cfe5
WIP command arguments
VenInf Jul 10, 2024
e20da0d
WIP hardcoded cabal-add
VenInf Jul 10, 2024
a032bc0
+ cabal-add
VenInf Jul 11, 2024
9c64de8
catched parameters in a command
VenInf Jul 11, 2024
f633e70
working prototype
VenInf Jul 12, 2024
fd719e6
adds package's version if detected
VenInf Jul 12, 2024
2087b06
+ docs
VenInf Jul 12, 2024
980e4ed
+ source-repository-package cabal-add
VenInf Jul 15, 2024
01e33c8
parsing comma
VenInf Jul 15, 2024
c8cde85
+ build targets
VenInf Jul 17, 2024
707316b
WIP resolve multiple targets
VenInf Jul 17, 2024
5f1694b
resolve target, no multiple
VenInf Jul 18, 2024
419a48a
rule usage, refactoring
VenInf Jul 18, 2024
3977151
better findResponsibleCabalFile
VenInf Jul 22, 2024
1ad4356
runAction data lookup
VenInf Jul 22, 2024
68b9a64
bugfix
VenInf Jul 27, 2024
f729147
WIP tests
VenInf Jul 29, 2024
d06fa2e
WIP tests, ghcIdePlugin issue(?)
VenInf Jul 30, 2024
fca76cb
WIP: make tests fail for good reason
fendor Jul 31, 2024
260d333
WIP tests, succesfull CodeAction call
VenInf Jul 31, 2024
7258ea0
WIP from writeFile to edit
VenInf Aug 1, 2024
497b1fc
WIP logging prototype
VenInf Aug 3, 2024
cf8d356
Use PluginError instead of error
fendor Aug 4, 2024
45399c6
Wait for TextEdit messages in CabalAdd test
fendor Aug 4, 2024
a1c70db
WIP formatting
VenInf Aug 3, 2024
4abb95e
WIP formatting
VenInf Aug 4, 2024
6924af6
dashed deps test
VenInf Aug 4, 2024
24ac7bb
more tests
VenInf Aug 5, 2024
069e796
renamed tests
VenInf Aug 6, 2024
c05ee6d
formatting and cleanup
VenInf Aug 6, 2024
1959d74
schema update
VenInf Aug 7, 2024
3f5d4f7
test assertion order fix
VenInf Aug 7, 2024
5157063
test dashed change
VenInf Aug 7, 2024
0b335fd
regex tests
VenInf Aug 8, 2024
7704af3
formatting
VenInf Aug 8, 2024
a661b3b
Update plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/CabalAdd.hs
VenInf Aug 14, 2024
11a7496
tests, formatting, other
VenInf Aug 14, 2024
37522fa
formatting
VenInf Aug 14, 2024
1ae3613
descriptor
VenInf Aug 14, 2024
f1ef7c9
Apply suggestions from code review
VenInf Aug 16, 2024
911ccbe
diagnostic optimisation
VenInf Aug 16, 2024
d9bf2b2
Update plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/CabalAdd.hs
VenInf Aug 16, 2024
831b110
Apply suggestions from code review
VenInf Aug 16, 2024
9cb82b8
HlsPlugins rename id
VenInf Aug 16, 2024
7b36ae2
docs, revert changes
VenInf Aug 16, 2024
cca5bfc
logs, docs
VenInf Aug 16, 2024
5fb7943
more docs
VenInf Aug 16, 2024
a3ea3b0
docs
VenInf Aug 16, 2024
78913d3
imports
VenInf Aug 16, 2024
f2129d4
docs
VenInf Aug 16, 2024
0b26f5d
schema
VenInf Aug 16, 2024
e4e363b
Apply suggestions from code review
VenInf Aug 18, 2024
76f064c
- logs and empty suggestion
VenInf Aug 18, 2024
310226f
- empty recorder
VenInf Aug 18, 2024
ae6a060
docs
VenInf Aug 18, 2024
385d83b
resolve merging issues
VenInf Aug 18, 2024
68deb73
Merge branch 'master' into cabal-add-codeaction
fendor Aug 20, 2024
e8c6051
Add cabal-add extra-dep for stack files
fendor Aug 20, 2024
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
Prev Previous commit
Next Next commit
descriptor
  • Loading branch information
VenInf committed Aug 18, 2024
commit 1ae361396f5c63aba4a8cc3f2947b217815ea658
9 changes: 5 additions & 4 deletions plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}

module Ide.Plugin.Cabal (descriptor, haskellFilesDescriptor, Log (..)) where
module Ide.Plugin.Cabal (descriptor, haskellInteractionDescriptor, Log (..)) where

import Control.Concurrent.Strict
import Control.DeepSeq
Expand Down Expand Up @@ -92,9 +92,10 @@ instance Pretty Log where
LogCompletions logs -> pretty logs
LogCabalAdd logs -> pretty logs


haskellFilesDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
haskellFilesDescriptor recorder plId =
-- | Some actions with cabal files originate from haskell files.
-- This descriptor is needed to handle these cases.
haskellInteractionDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
haskellInteractionDescriptor recorder plId =
(defaultPluginDescriptor plId "Provides the cabal-add code action in haskell files")
{ pluginHandlers =
mconcat
Expand Down
4 changes: 2 additions & 2 deletions plugins/hls-cabal-plugin/test/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Data.List (sort)
import Data.Proxy (Proxy (Proxy))
import qualified Data.Text as T
import Ide.Plugin.Cabal (descriptor,
haskellFilesDescriptor)
haskellInteractionDescriptor)
import qualified Ide.Plugin.Cabal
import Ide.Plugin.Cabal.Completion.Types
import System.FilePath
Expand All @@ -20,7 +20,7 @@ cabalPlugin :: PluginTestDescriptor Ide.Plugin.Cabal.Log
cabalPlugin = mkPluginTestDescriptor descriptor "cabal"

cabalHaskellPlugin :: PluginTestDescriptor Ide.Plugin.Cabal.Log
cabalHaskellPlugin = mkPluginTestDescriptor haskellFilesDescriptor "cabal-haskell"
cabalHaskellPlugin = mkPluginTestDescriptor haskellInteractionDescriptor "cabal-haskell"

simpleCabalPrefixInfoFromPos :: Position -> T.Text -> CabalPrefixInfo
simpleCabalPrefixInfoFromPos pos prefix =
Expand Down
2 changes: 1 addition & 1 deletion src/HlsPlugins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ idePlugins recorder = pluginDescToIdePlugins allPlugins
allPlugins =
#if hls_cabal
let pId = "cabal" in Cabal.descriptor (pluginRecorder pId) pId :
let caId = "cabaladd" in Cabal.haskellFilesDescriptor (pluginRecorder caId) caId :
let caId = "cabaladd" in Cabal.haskellInteractionDescriptor (pluginRecorder caId) caId :
#endif
#if hls_pragmas
Pragmas.suggestPragmaDescriptor "pragmas-suggest" :
Expand Down