Skip to content
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

Move Recorder to hls-plugin-api #3714

Merged
merged 18 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
4 changes: 2 additions & 2 deletions exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import Data.Function ((&))
import Data.Functor ((<&>))
import Data.Maybe (catMaybes)
import Data.Text (Text)
import Development.IDE.Types.Logger (Doc, Priority (Error, Info),
import Ide.Logger (Doc, Priority (Error, Info),
Recorder,
WithPriority (WithPriority, priority),
cfilter, cmapWithPrio,
defaultLayoutOptions,
layoutPretty, logWith,
makeDefaultStderrRecorder,
renderStrict, withFileRecorder)
import qualified Development.IDE.Types.Logger as Logger
import qualified Ide.Logger as Logger
import qualified HlsPlugins as Plugins
import Ide.Arguments (Arguments (..),
GhcideArguments (..),
Expand Down
4 changes: 2 additions & 2 deletions exe/Wrapper.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE CPP #-}

Check warning on line 1 in exe/Wrapper.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in module Main: Use module export list ▫︎ Found: "module Main where" ▫︎ Perhaps: "module Main (\n module Main\n ) where" ▫︎ Note: an explicit list is usually better
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
Expand Down Expand Up @@ -45,14 +45,14 @@
import qualified Data.Text.IO as T
import Development.IDE.LSP.LanguageServer (runLanguageServer)
import qualified Development.IDE.Main as Main
import Development.IDE.Types.Logger (Doc, Logger (Logger),
import GHC.Stack.Types (emptyCallStack)
import Ide.Logger (Doc, Logger (Logger),
Pretty (pretty),
Recorder (logger_),
WithPriority (WithPriority),
cmapWithPrio,
makeDefaultStderrRecorder,
toCologActionWithPrio)
import GHC.Stack.Types (emptyCallStack)
import Ide.Plugin.Config (Config)
import Ide.Types (IdePlugins (IdePlugins))
import Language.LSP.Protocol.Message (Method (Method_Initialize),
Expand Down
8 changes: 4 additions & 4 deletions ghcide/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import qualified Development.IDE.Main as IDEMain
import qualified Development.IDE.Monitoring.EKG as EKG
import qualified Development.IDE.Monitoring.OpenTelemetry as OpenTelemetry
import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
import Development.IDE.Types.Logger (Logger (Logger),
import Development.IDE.Types.Options
import GHC.Stack (emptyCallStack)
import Ide.Logger (Logger (Logger),
LoggingColumn (DataColumn, PriorityColumn),
Pretty (pretty),
Priority (Debug, Error, Info),
Expand All @@ -33,9 +35,7 @@ import Development.IDE.Types.Logger (Logger (Logger),
layoutPretty,
makeDefaultStderrRecorder,
renderStrict)
import qualified Development.IDE.Types.Logger as Logger
import Development.IDE.Types.Options
import GHC.Stack (emptyCallStack)
import qualified Ide.Logger as Logger
import Ide.Plugin.Config (Config (checkParents, checkProject))
import Ide.PluginUtils (pluginDescToIdePlugins)
import Ide.Types (PluginDescriptor (pluginNotificationHandlers),
Expand Down
1 change: 0 additions & 1 deletion ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ library
Development.IDE.Types.HscEnvEq
Development.IDE.Types.KnownTargets
Development.IDE.Types.Location
Development.IDE.Types.Logger
Development.IDE.Types.Monitoring
Development.IDE.Monitoring.OpenTelemetry
Development.IDE.Types.Options
Expand Down
14 changes: 7 additions & 7 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@
import Development.IDE.Types.HscEnvEq (HscEnvEq, newHscEnvEq,
newHscEnvEqPreserveImportPaths)
import Development.IDE.Types.Location
import Development.IDE.Types.Logger (Pretty (pretty),
Priority (Debug, Error, Info, Warning),
Recorder, WithPriority,
cmapWithPrio, logWith,
nest,
toCologActionWithPrio,
vcat, viaShow, (<+>))
import Development.IDE.Types.Options
import GHC.Check
import qualified HIE.Bios as HieBios
import HIE.Bios.Environment hiding (getCacheDir)
import HIE.Bios.Types hiding (Log)
import qualified HIE.Bios.Types as HieBios
import Hie.Implicit.Cradle (loadImplicitHieCradle)
import Ide.Logger (Pretty (pretty),
Priority (Debug, Error, Info, Warning),
Recorder, WithPriority,
cmapWithPrio, logWith,
nest,
toCologActionWithPrio,
vcat, viaShow, (<+>))
import Language.LSP.Protocol.Message
import Language.LSP.Server
import System.Directory
Expand Down Expand Up @@ -596,7 +596,7 @@
void $ modifyVar' fileToFlags $
Map.insert hieYaml (HM.fromList (concatMap toFlagsMap all_targets))
void $ modifyVar' filesMap $
flip HM.union (HM.fromList (zip (map fst $ concatMap toFlagsMap all_targets) (repeat hieYaml)))

Check warning on line 599 in ghcide/session-loader/Development/IDE/Session.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in loadSessionWithOptions in module Development.IDE.Session: Use map ▫︎ Found: "zip (map fst $ concatMap toFlagsMap all_targets) (repeat hieYaml)" ▫︎ Perhaps: "map (, hieYaml) (map fst $ concatMap toFlagsMap all_targets)" ▫︎ Note: may require `{-# LANGUAGE TupleSections #-}` adding to the top of the file

void $ extendKnownTargets all_targets

Expand Down Expand Up @@ -802,7 +802,7 @@
-> IO ( [TargetDetails], (IdeResult HscEnvEq, DependencyInfo))
newComponentCache recorder exts cradlePath cfp hsc_env uids ci = do
let df = componentDynFlags ci
hscEnv' <-

Check warning on line 805 in ghcide/session-loader/Development/IDE/Session.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in newComponentCache in module Development.IDE.Session: Use let ▫︎ Found: "hscEnv' <- pure\n $ hscSetFlags\n df hsc_env {hsc_IC = (hsc_IC hsc_env) {ic_dflags = df}}" ▫︎ Perhaps: "let hscEnv'\n = hscSetFlags\n df hsc_env {hsc_IC = (hsc_IC hsc_env) {ic_dflags = df}}"
#if MIN_VERSION_ghc(9,3,0)
-- Set up a multi component session with the other units on GHC 9.4
Compat.initUnits (map snd uids) (hscSetFlags df hsc_env)
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ import Development.IDE.Types.HscEnvEq as X (HscEnvEq (..),
hscEnv,
hscEnvWithImportPaths)
import Development.IDE.Types.Location as X
import Development.IDE.Types.Logger as X
import Ide.Logger as X
6 changes: 3 additions & 3 deletions ghcide/src/Development/IDE/Core/FileExists.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import Development.IDE.Core.Shake hiding (Log)
import qualified Development.IDE.Core.Shake as Shake
import Development.IDE.Graph
import Development.IDE.Types.Location
import Development.IDE.Types.Logger (Pretty (pretty),
Recorder, WithPriority,
cmapWithPrio)
import Development.IDE.Types.Options
import qualified Focus
import Ide.Logger (Pretty (pretty),
Recorder, WithPriority,
cmapWithPrio)
import Ide.Plugin.Config (Config)
import Language.LSP.Protocol.Types
import Language.LSP.Server hiding (getVirtualFile)
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Core/FileStore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import qualified System.Directory as Dir
#else
#endif

import qualified Development.IDE.Types.Logger as L
import qualified Ide.Logger as L

import Data.Aeson (ToJSON (toJSON))
import qualified Data.Binary as B
Expand All @@ -63,7 +63,7 @@ import Data.List (foldl')
import qualified Data.Text as Text
import Development.IDE.Core.IdeConfiguration (isWorkspaceFile)
import qualified Development.IDE.Core.Shake as Shake
import Development.IDE.Types.Logger (Pretty (pretty),
import Ide.Logger (Pretty (pretty),
Priority (Info),
Recorder,
WithPriority,
Expand Down
6 changes: 3 additions & 3 deletions ghcide/src/Development/IDE/Core/OfInterest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ import qualified Development.IDE.Core.Shake as Shake
import Development.IDE.Plugin.Completions.Types
import Development.IDE.Types.Exports
import Development.IDE.Types.Location
import Development.IDE.Types.Logger (Pretty (pretty),
import Development.IDE.Types.Options (IdeTesting (..))
import GHC.TypeLits (KnownSymbol)
import Ide.Logger (Pretty (pretty),
Recorder,
WithPriority,
cmapWithPrio,
logDebug)
import Development.IDE.Types.Options (IdeTesting (..))
import GHC.TypeLits (KnownSymbol)
import qualified Language.LSP.Protocol.Message as LSP
import qualified Language.LSP.Server as LSP

Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ import Control.Concurrent.STM.Stats (atomically)
import Language.LSP.Server (LspT)
import System.Info.Extra (isWindows)
import HIE.Bios.Ghc.Gap (hostIsDynamic)
import Development.IDE.Types.Logger (Recorder, logWith, cmapWithPrio, WithPriority, Pretty (pretty), (<+>), nest, vcat)
import Ide.Logger (Recorder, logWith, cmapWithPrio, WithPriority, Pretty (pretty), (<+>), nest, vcat)
import qualified Development.IDE.Core.Shake as Shake
import qualified Development.IDE.Types.Logger as Logger
import qualified Ide.Logger as Logger
import qualified Development.IDE.Types.Shake as Shake
import Development.IDE.GHC.CoreFile
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Core/Service.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import Development.IDE.Core.Debouncer
import Development.IDE.Core.FileExists (fileExistsRules)
import Development.IDE.Core.OfInterest hiding (Log, LogShake)
import Development.IDE.Graph
import Development.IDE.Types.Logger as Logger (Logger,
import Development.IDE.Types.Options (IdeOptions (..))
import Ide.Logger as Logger (Logger,
Pretty (pretty),
Priority (Debug),
Recorder,
WithPriority,
cmapWithPrio)
import Development.IDE.Types.Options (IdeOptions (..))
import Ide.Plugin.Config
import qualified Language.LSP.Protocol.Types as LSP
import qualified Language.LSP.Server as LSP
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ import Development.IDE.Types.Exports
import qualified Development.IDE.Types.Exports as ExportsMap
import Development.IDE.Types.KnownTargets
import Development.IDE.Types.Location
import Development.IDE.Types.Logger hiding (Priority)
import qualified Development.IDE.Types.Logger as Logger
import Ide.Logger hiding (Priority)
import qualified Ide.Logger as Logger
import Development.IDE.Types.Monitoring (Monitoring (..))
import Development.IDE.Types.Options
import Development.IDE.Types.Shake
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Core/Tracing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Development.IDE.Graph.Rule
import Development.IDE.Types.Diagnostics (FileDiagnostic,
showDiagnostics)
import Development.IDE.Types.Location (Uri (..))
import Development.IDE.Types.Logger (Logger (Logger))
import Ide.Logger (Logger (Logger))
import Ide.Types (PluginId (..))
import Language.LSP.Protocol.Types (NormalizedFilePath,
fromNormalizedFilePath)
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/LSP/HoverDefinition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Development.IDE.Core.Actions
import Development.IDE.Core.Rules
import Development.IDE.Core.Shake
import Development.IDE.Types.Location
import Development.IDE.Types.Logger
import Ide.Logger
import Language.LSP.Protocol.Message
import Language.LSP.Protocol.Types
import qualified Language.LSP.Server as LSP
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/LSP/LanguageServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import Development.IDE.Core.IdeConfiguration
import Development.IDE.Core.Shake hiding (Log, Priority)
import Development.IDE.Core.Tracing
import qualified Development.IDE.Session as Session
import Development.IDE.Types.Logger
import qualified Development.IDE.Types.Logger as Logger
import Development.IDE.Types.Shake (WithHieDb)
import Ide.Logger
import qualified Ide.Logger as Logger
import Language.LSP.Server (LanguageContextEnv,
LspServerLog,
type (<~>))
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/LSP/Notifications.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import Development.IDE.Core.Service hiding (Log, LogShake)
import Development.IDE.Core.Shake hiding (Log, Priority)
import qualified Development.IDE.Core.Shake as Shake
import Development.IDE.Types.Location
import Development.IDE.Types.Logger
import Development.IDE.Types.Shake (toKey)
import Ide.Logger
import Ide.Types
import Numeric.Natural

Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE PackageImports #-}

Check warning on line 1 in ghcide/src/Development/IDE/Main.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in module Development.IDE.Main: Unused LANGUAGE pragma ▫︎ Found: "{-# LANGUAGE PackageImports #-}"
{-# OPTIONS_GHC -Wno-orphans #-}
{-# LANGUAGE RankNTypes #-}
module Development.IDE.Main
Expand Down Expand Up @@ -77,7 +77,7 @@
import qualified Development.IDE.Session as Session
import Development.IDE.Types.Location (NormalizedUri,
toNormalizedFilePath')
import Development.IDE.Types.Logger (Logger,
import Ide.Logger (Logger,
Pretty (pretty),
Priority (Info, Warning),
Recorder,
Expand Down
8 changes: 4 additions & 4 deletions ghcide/src/Development/IDE/Main/HeapStats.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import Control.Concurrent
import Control.Concurrent.Async
import Control.Monad
import Data.Word
import Development.IDE.Types.Logger (Pretty (pretty), Priority (Info),
Recorder, WithPriority, hsep,
logWith, (<+>))
import GHC.Stats
import Text.Printf (printf)
import Ide.Logger (Pretty (pretty), Priority (Info),
Recorder, WithPriority, hsep,
logWith, (<+>))
import Text.Printf (printf)

data Log
= LogHeapStatsPeriod !Int
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Monitoring/EKG.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{-# LANGUAGE CPP #-}
module Development.IDE.Monitoring.EKG(monitoring) where

import Development.IDE.Types.Logger (Logger)
import Development.IDE.Types.Monitoring (Monitoring (..))
import Ide.Logger (Logger)
#ifdef MONITORING_EKG
import Control.Concurrent (killThread)
import Control.Concurrent.Async (async, waitCatch)
import Control.Monad (forM_)
import Data.Text (pack)
import Development.IDE.Types.Logger (logInfo)
import Ide.Logger (logInfo)
import qualified System.Metrics as Monitoring
import qualified System.Remote.Monitoring.Wai as Monitoring

Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Plugin/Completions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import Development.IDE.Types.HscEnvEq (HscEnvEq (envPackageE
hscEnv)
import qualified Development.IDE.Types.KnownTargets as KT
import Development.IDE.Types.Location
import Development.IDE.Types.Logger (Pretty (pretty),
import Ide.Logger (Pretty (pretty),
Recorder,
WithPriority,
cmapWithPrio)
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Plugin/HLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Development.IDE.Graph (Rules)
import Development.IDE.LSP.Server
import Development.IDE.Plugin
import qualified Development.IDE.Plugin as P
import Development.IDE.Types.Logger hiding (Error)
import Ide.Logger hiding (Error)
import Ide.Plugin.Config
import Ide.PluginUtils (getClientConfig)
import Ide.Types as HLS
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Plugin/TypeLenses.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ import Development.IDE.Graph.Classes
import Development.IDE.Spans.LocalBindings (Bindings, getFuzzyScope)
import Development.IDE.Types.Location (Position (Position, _character, _line),
Range (Range, _end, _start))
import Development.IDE.Types.Logger (Pretty (pretty),
import GHC.Generics (Generic)
import Ide.Logger (Pretty (pretty),
Recorder, WithPriority,
cmapWithPrio)
import GHC.Generics (Generic)
import Ide.Plugin.Properties
import Ide.PluginUtils
import Ide.Types (CommandFunction,
Expand Down
12 changes: 6 additions & 6 deletions ghcide/src/Development/IDE/Types/Action.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ module Development.IDE.Types.Action
where

import Control.Concurrent.STM
import Data.Hashable (Hashable (..))
import Data.HashSet (HashSet)
import qualified Data.HashSet as Set
import Data.Unique (Unique)
import Development.IDE.Graph (Action)
import Development.IDE.Types.Logger
import Data.Hashable (Hashable (..))
import Data.HashSet (HashSet)
import qualified Data.HashSet as Set
import Data.Unique (Unique)
import Development.IDE.Graph (Action)
import Ide.Logger
import Numeric.Natural

data DelayedAction a = DelayedAction
Expand Down
Loading
Loading