descriptor

This commit is contained in:
George Gerasev 2024-08-15 00:24:54 +03:00
parent 10544f9f06
commit 220985392d
3 changed files with 8 additions and 7 deletions

View File

@ -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
@ -88,9 +88,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

View File

@ -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
@ -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 =

View File

@ -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" :