mirror of
https://github.com/haskell/haskell-language-server.git
synced 2024-09-11 08:45:35 +03:00
descriptor
This commit is contained in:
parent
10544f9f06
commit
220985392d
@ -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
|
||||
|
@ -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 =
|
||||
|
@ -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" :
|
||||
|
Loading…
Reference in New Issue
Block a user