Skip to content

Commit 2209853

Browse files
committed
descriptor
1 parent 10544f9 commit 2209853

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{-# LANGUAGE OverloadedStrings #-}
55
{-# LANGUAGE TypeFamilies #-}
66

7-
module Ide.Plugin.Cabal (descriptor, haskellFilesDescriptor, Log (..)) where
7+
module Ide.Plugin.Cabal (descriptor, haskellInteractionDescriptor, Log (..)) where
88

99
import Control.Concurrent.Strict
1010
import Control.DeepSeq
@@ -88,9 +88,10 @@ instance Pretty Log where
8888
LogCompletions logs -> pretty logs
8989
LogCabalAdd logs -> pretty logs
9090

91-
92-
haskellFilesDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
93-
haskellFilesDescriptor recorder plId =
91+
-- | Some actions with cabal files originate from haskell files.
92+
-- This descriptor is needed to handle these cases.
93+
haskellInteractionDescriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
94+
haskellInteractionDescriptor recorder plId =
9495
(defaultPluginDescriptor plId "Provides the cabal-add code action in haskell files")
9596
{ pluginHandlers =
9697
mconcat

plugins/hls-cabal-plugin/test/Utils.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Data.List (sort)
99
import Data.Proxy (Proxy (Proxy))
1010
import qualified Data.Text as T
1111
import Ide.Plugin.Cabal (descriptor,
12-
haskellFilesDescriptor)
12+
haskellInteractionDescriptor)
1313
import qualified Ide.Plugin.Cabal
1414
import Ide.Plugin.Cabal.Completion.Types
1515
import System.FilePath
@@ -20,7 +20,7 @@ cabalPlugin :: PluginTestDescriptor Ide.Plugin.Cabal.Log
2020
cabalPlugin = mkPluginTestDescriptor descriptor "cabal"
2121

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

2525
simpleCabalPrefixInfoFromPos :: Position -> T.Text -> CabalPrefixInfo
2626
simpleCabalPrefixInfoFromPos pos prefix =

src/HlsPlugins.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ idePlugins recorder = pluginDescToIdePlugins allPlugins
152152
allPlugins =
153153
#if hls_cabal
154154
let pId = "cabal" in Cabal.descriptor (pluginRecorder pId) pId :
155-
let caId = "cabaladd" in Cabal.haskellFilesDescriptor (pluginRecorder caId) caId :
155+
let caId = "cabaladd" in Cabal.haskellInteractionDescriptor (pluginRecorder caId) caId :
156156
#endif
157157
#if hls_pragmas
158158
Pragmas.suggestPragmaDescriptor "pragmas-suggest" :

0 commit comments

Comments
 (0)