Skip to content

Commit

Permalink
Merge branch 'master' into optional-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra authored Sep 20, 2022
2 parents 99251fd + bd1d0a1 commit baf4b5e
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Find changed files
uses: technote-space/get-diff-action@v4.0.1
uses: technote-space/get-diff-action@v6.1.0
id: git-diff
with:
PATTERNS: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"hooks": [
{
"entry": "stylish-haskell --inplace",
"exclude": "(^Setup.hs$|test/testdata/.*$|test/data/.*$|test/manual/lhs/.*$|^hie-compat/.*$|^plugins/hls-tactics-plugin/.*$|^ghcide/src/Development/IDE/GHC/Compat.hs$|^ghcide/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs$|^ghcide/src/Development/IDE/GHC/Compat/Core.hs$|^ghcide/src/Development/IDE/Spans/Pragmas.hs$|^ghcide/src/Development/IDE/LSP/Outline.hs$|^plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs$|^ghcide/test/exe/Main.hs$|ghcide/src/Development/IDE/Core/Rules.hs|^hls-test-utils/src/Test/Hls/Util.hs$)",
"exclude": "(^Setup.hs$|test/testdata/.*$|test/data/.*$|test/manual/lhs/.*$|^hie-compat/.*$|^plugins/hls-tactics-plugin/.*$|^ghcide/src/Development/IDE/GHC/Compat.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/GHC/Compat/ExactPrint.hs$|^ghcide/src/Development/IDE/GHC/Compat/Core.hs$|^ghcide/src/Development/IDE/Spans/Pragmas.hs$|^ghcide/src/Development/IDE/LSP/Outline.hs$|^plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs$|^ghcide/test/exe/Main.hs$|^ghcide/src/Development/IDE/Core/Rules.hs$|^hls-test-utils/src/Test/Hls/Util.hs$|^ghcide/src/Development/IDE/Core/Compile.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs$|^plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs$)",
"files": "\\.l?hs$",
"id": "stylish-haskell",
"language": "system",
Expand Down
1 change: 1 addition & 0 deletions .stylish-haskell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ newline: lf

language_extensions:
- BangPatterns
- CPP
- DataKinds
- DeriveFunctor
- DeriveGeneric
Expand Down
4 changes: 2 additions & 2 deletions docs/supported-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Sometimes a plugin will be supported in the pre-built binaries but not in a HLS
| Plugin | Unsupported GHC versions |
|-------------------------------------|--------------------------|
| `hls-alternate-number-plugin` | |
| `hls-brittany-plugin` | 9.2, 9.4 |
| `hls-code-ragne-plugin` | 9.4 |
| `hls-brittany-plugin` | 9.0.2, 9.2, 9.4 |
| `hls-code-range-plugin` | 9.4 |
| `hls-call-hierarchy-plugin` | |
| `hls-class-plugin` | 9.4 |
| `hls-eval-plugin` | 9.4 |
Expand Down
16 changes: 8 additions & 8 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE CPP #-}

{-|
The logic for setting up a ghcide session by tapping into hie-bios.
Expand Down Expand Up @@ -67,15 +67,16 @@ import Development.IDE.Types.Location
import Development.IDE.Types.Logger (Pretty (pretty),
Priority (Debug, Error, Info, Warning),
Recorder, WithPriority,
logWith, nest, vcat,
viaShow, (<+>),
toCologActionWithPrio, cmapWithPrio)
cmapWithPrio, logWith,
nest,
toCologActionWithPrio,
vcat, viaShow, (<+>))
import Development.IDE.Types.Options
import GHC.Check
import qualified HIE.Bios as HieBios
import qualified HIE.Bios.Types 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 Language.LSP.Server
import Language.LSP.Types
Expand All @@ -90,6 +91,8 @@ import Data.Void
import Control.Concurrent.STM.Stats (atomically, modifyTVar',
readTVar, writeTVar)
import Control.Concurrent.STM.TQueue
import Control.DeepSeq
import Control.Exception (evaluate)
import Control.Monad.IO.Unlift (MonadUnliftIO)
import Data.Foldable (for_)
import Data.HashMap.Strict (HashMap)
Expand All @@ -103,9 +106,6 @@ import HieDb.Types
import HieDb.Utils
import qualified System.Random as Random
import System.Random (RandomGen)
import Control.Monad.IO.Unlift (MonadUnliftIO)
import Control.Exception (evaluate)
import Control.DeepSeq

data Log
= LogSettingInitialDynFlags
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/GHC/Compat/Iface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Development.IDE.GHC.Compat.Iface (

import GHC
#if MIN_VERSION_ghc(9,3,0)
import GHC.Driver.Session (targetProfile)
import GHC.Driver.Session (targetProfile)
#endif
#if MIN_VERSION_ghc(9,2,0)
import qualified GHC.Iface.Load as Iface
Expand Down
7 changes: 4 additions & 3 deletions ghcide/src/Development/IDE/Import/FindImports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Data.List (isSuffixOf)
import Data.Maybe
import System.FilePath
#if MIN_VERSION_ghc(9,3,0)
import GHC.Types.PkgQual
import GHC.Types.PkgQual
#endif

data Import
Expand Down Expand Up @@ -123,11 +123,12 @@ locateModule env comp_info exts targetFor modName mbPkgName isSource = do
#if MIN_VERSION_ghc(9,3,0)
OtherPkg uid
| Just dirs <- lookup uid import_paths
-> lookupLocal uid dirs
#else
Just pkgName
| Just (uid, dirs) <- lookup (PackageName pkgName) import_paths
#endif
-> lookupLocal uid dirs
#endif
| otherwise -> lookupInPackageDB env
#if MIN_VERSION_ghc(9,3,0)
NoPkgQual -> do
Expand All @@ -148,7 +149,7 @@ locateModule env comp_info exts targetFor modName mbPkgName isSource = do

mbFile <- locateModuleFile ((homeUnitId_ dflags, importPaths dflags) : import_paths') exts targetFor isSource $ unLoc modName
case mbFile of
Nothing -> lookupInPackageDB env
Nothing -> lookupInPackageDB env
Just (uid, file) -> toModLocation uid file
where
dflags = hsc_dflags env
Expand Down
6 changes: 4 additions & 2 deletions ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ import GHC.Plugins (Depth (AllTheWay),
#endif
import Ide.PluginUtils (mkLspCommand)
import Ide.Types (CommandId (..),
IdePlugins(..), PluginId)
IdePlugins (..),
PluginId)
import Language.LSP.Types
import Language.LSP.Types.Capabilities
import qualified Language.LSP.VFS as VFS
Expand Down Expand Up @@ -516,7 +517,6 @@ findRecordCompl uri pmod mn DataDecl {tcdLName, tcdDataDefn} = result
PrefixCon{} -> Just []
_ -> Nothing

extract ConDeclField{..}
-- NOTE: 'cd_fld_names' is grouped so that the fields
-- sharing the same type declaration to fit in the same group; e.g.
--
Expand All @@ -527,8 +527,10 @@ findRecordCompl uri pmod mn DataDecl {tcdLName, tcdDataDefn} = result
-- is encoded as @[[arg1, arg2], [arg3], [arg4]]@
-- Hence, we must concat nested arguments into one to get all the fields.
#if MIN_VERSION_ghc(9,3,0)
extract ConDeclField{..}
= map (foLabel . unLoc) cd_fld_names
#else
extract ConDeclField{..}
= map (rdrNameFieldOcc . unLoc) cd_fld_names
#endif
-- XConDeclField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import qualified Data.Map as Map
import qualified Data.Text as T
import Development.IDE hiding (pluginHandlers)
import Development.IDE.GHC.Compat
import Development.IDE.Plugin.CodeAction
import Development.IDE.GHC.Compat.ExactPrint
import Development.IDE.GHC.ExactPrint (GetAnnotatedParsedSource (..))
import qualified Development.IDE.GHC.ExactPrint as E
import qualified Development.IDE.GHC.ExactPrint as E
import Development.IDE.Plugin.CodeAction
import Ide.Types
import Language.Haskell.GHC.ExactPrint
import Language.Haskell.GHC.ExactPrint.Types hiding (GhcPs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Control.Arrow (second,
(&&&),
(>>>))
import Control.Concurrent.STM.Stats (atomically)
import Control.Monad.Extra
import Control.Monad.IO.Class
import Control.Monad.Trans.Maybe
import Control.Monad.Extra
import Data.Aeson
import Data.Char
import qualified Data.DList as DL
Expand All @@ -39,50 +39,52 @@ import qualified Data.Set as S
import qualified Data.Text as T
import qualified Data.Text.Utf16.Rope as Rope
import Data.Tuple.Extra (fst3)
import Development.IDE.Types.Logger hiding (group)
import Development.IDE.Core.Rules
import Development.IDE.Core.RuleTypes
import Development.IDE.Core.Service
import Development.IDE.Core.Shake hiding (Log)
import Development.IDE.GHC.Compat
import Development.IDE.GHC.Compat.ExactPrint
import Development.IDE.GHC.Compat.Util
import Development.IDE.GHC.Error
import Development.IDE.GHC.ExactPrint
import qualified Development.IDE.GHC.ExactPrint as E
import qualified Development.IDE.GHC.ExactPrint as E
import Development.IDE.GHC.Util (printOutputable,
printRdrName)
import Development.IDE.Core.Shake hiding (Log)
import Development.IDE.Plugin.CodeAction.Args
import Development.IDE.Plugin.CodeAction.ExactPrint
import Development.IDE.Plugin.CodeAction.Util
import Development.IDE.Plugin.CodeAction.PositionIndexed
import Development.IDE.Plugin.CodeAction.Util
import Development.IDE.Plugin.Completions.Types
import Development.IDE.Plugin.TypeLenses (suggestSignature)
import Development.IDE.Types.Exports
import Development.IDE.Types.Location
import Development.IDE.Types.Logger hiding
(group)
import Development.IDE.Types.Options
import GHC.Exts (fromList)
import qualified GHC.LanguageExtensions as Lang
import Ide.PluginUtils (subRange)
import Ide.Types
import qualified Language.LSP.Server as LSP
import Language.LSP.Types (ApplyWorkspaceEditParams(..), CodeAction (..),
import Language.LSP.Types (ApplyWorkspaceEditParams (..),
CodeAction (..),
CodeActionContext (CodeActionContext, _diagnostics),
CodeActionKind (CodeActionQuickFix, CodeActionUnknown),
CodeActionParams (CodeActionParams),
Command,
Diagnostic (..),
MessageType (..),
ShowMessageParams (..),
List (..),
MessageType (..),
ResponseError,
SMethod (..),
ShowMessageParams (..),
TextDocumentIdentifier (TextDocumentIdentifier),
TextEdit (TextEdit, _range),
UInt,
WorkspaceEdit (WorkspaceEdit, _changeAnnotations, _changes, _documentChanges),
type (|?) (InR),
uriToFilePath)
import GHC.Exts (fromList)
import Language.LSP.VFS (VirtualFile,
_file_text)
import Text.Regex.TDFA (mrAfter,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
module Development.IDE.Plugin.CodeAction.Util where

import Data.Data (Data)
import qualified Data.Unique as U
import Data.Data (Data)
import Data.Time.Clock.POSIX (POSIXTime,
getCurrentTime,
utcTimeToPOSIXSeconds)
import qualified Data.Unique as U
import Debug.Trace
import Development.IDE.GHC.Compat.ExactPrint as GHC
import Development.IDE.GHC.Dump (showAstDataHtml)
import GHC.Stack
import System.Environment.Blank (getEnvDefault)
import System.Environment.Blank (getEnvDefault)
import System.IO.Unsafe
import Text.Printf
import Development.IDE.GHC.Dump (showAstDataHtml)
import Data.Time.Clock.POSIX (POSIXTime, getCurrentTime,
utcTimeToPOSIXSeconds)
#if MIN_VERSION_ghc(9,2,0)
import GHC.Utils.Outputable
#else
import Development.IDE.GHC.Util
import Development.IDE.GHC.Compat.Util
import Development.IDE.GHC.Compat
import Development.IDE.GHC.Compat.Util
import Development.IDE.GHC.Util
#endif
--------------------------------------------------------------------------------
-- Tracing exactprint terms
Expand Down

0 comments on commit baf4b5e

Please sign in to comment.