Skip to content

Commit 1eaf924

Browse files
authored
Merge branch 'master' into mergepocalypse-8.10.3
2 parents 1aa1ce1 + 1a34357 commit 1eaf924

File tree

42 files changed

+462
-551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+462
-551
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
- os: windows-latest
2121
ghc: "8.8.2" # fails due to error with Cabal
2222
include:
23+
- os: windows-latest
24+
ghc: "8.6.4" # times out after 300m
2325
- os: windows-latest
2426
ghc: "8.10.2.2" # only available for windows and choco
2527
# one ghc-lib build

exe/Plugins.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
module Plugins where
44

55
import Ide.Types (IdePlugins)
6-
import Ide.Plugin (pluginDescToIdePlugins)
6+
import Ide.PluginUtils (pluginDescToIdePlugins)
77

88
-- fixed plugins
99
import Ide.Plugin.Example as Example
1010
import Ide.Plugin.Example2 as Example2
11-
import Ide.Plugin.GhcIde as GhcIde
11+
import Development.IDE (IdeState)
12+
import Development.IDE.Plugin.HLS.GhcIde as GhcIde
1213

1314
-- haskell-language-server optional plugins
1415

@@ -73,7 +74,7 @@ import Ide.Plugin.Brittany as Brittany
7374
-- These can be freely added or removed to tailor the available
7475
-- features of the server.
7576

76-
idePlugins :: Bool -> IdePlugins
77+
idePlugins :: Bool -> IdePlugins IdeState
7778
idePlugins includeExamples = pluginDescToIdePlugins allPlugins
7879
where
7980
allPlugins = if includeExamples

ghcide/bench/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ versions:
5555
# - v0.4.0
5656
# - v0.5.0
5757
# - v0.6.0
58-
# - upstream: origin/master
58+
- upstream: origin/master
5959
- HEAD

ghcide/exe/Main.hs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import Development.IDE.Types.Diagnostics
2828
import Development.IDE.Types.Options
2929
import Development.IDE.Types.Logger
3030
import Development.IDE.Plugin
31-
import Development.IDE.Plugin.Completions as Completions
32-
import Development.IDE.Plugin.CodeAction as CodeAction
3331
import Development.IDE.Plugin.Test as Test
3432
import Development.IDE.Session (loadSession)
3533
import qualified Language.Haskell.LSP.Core as LSP
@@ -54,6 +52,10 @@ import Development.IDE (action)
5452
import Text.Printf
5553
import Development.IDE.Core.Tracing
5654
import Development.IDE.Types.Shake (Key(Key))
55+
import Development.IDE.Plugin.HLS (asGhcIdePlugin)
56+
import Development.IDE.Plugin.HLS.GhcIde as GhcIde
57+
import Ide.Plugin.Config
58+
import Ide.PluginUtils (allLspCmdIds', getProcessID, pluginDescToIdePlugins)
5759

5860
ghcideVersion :: IO String
5961
ghcideVersion = do
@@ -83,18 +85,23 @@ main = do
8385
whenJust argsCwd IO.setCurrentDirectory
8486

8587
dir <- IO.getCurrentDirectory
86-
command <- makeLspCommandId "typesignature.add"
8788

88-
let plugins = Completions.plugin <> CodeAction.plugin
89+
let hlsPlugins = pluginDescToIdePlugins [GhcIde.descriptor "ghcide"]
90+
91+
pid <- T.pack . show <$> getProcessID
92+
let hlsPlugin = asGhcIdePlugin hlsPlugins
93+
hlsCommands = allLspCmdIds' pid hlsPlugins
94+
95+
let plugins = hlsPlugin
8996
<> if argsTesting then Test.plugin else mempty
90-
onInitialConfiguration :: InitializeRequest -> Either T.Text LspConfig
97+
onInitialConfiguration :: InitializeRequest -> Either T.Text Config
9198
onInitialConfiguration x = case x ^. params . initializationOptions of
92-
Nothing -> Right defaultLspConfig
99+
Nothing -> Right def
93100
Just v -> case J.fromJSON v of
94101
J.Error err -> Left $ T.pack err
95102
J.Success a -> Right a
96103
onConfigurationChange = const $ Left "Updating Not supported"
97-
options = def { LSP.executeCommandCommands = Just [command]
104+
options = def { LSP.executeCommandCommands = Just hlsCommands
98105
, LSP.completionTriggerCharacters = Just "."
99106
}
100107

@@ -106,7 +113,7 @@ main = do
106113
t <- t
107114
hPutStrLn stderr $ "Started LSP server in " ++ showDuration t
108115
sessionLoader <- loadSession $ fromMaybe dir rootPath
109-
config <- fromMaybe defaultLspConfig <$> getConfig
116+
config <- fromMaybe def <$> getConfig
110117
let options = (defaultIdeOptions sessionLoader)
111118
{ optReportProgress = clientSupportsProgress caps
112119
, optShakeProfiling = argsShakeProfiling
@@ -159,7 +166,7 @@ main = do
159166
, optTesting = IdeTesting argsTesting
160167
, optThreads = argsThreads
161168
, optCheckParents = NeverCheck
162-
, optCheckProject = CheckProject False
169+
, optCheckProject = False
163170
}
164171
logLevel = if argsVerbose then minBound else Info
165172
ide <- initialise def mainRule (pure $ IdInt 0) (showEvent lock) dummyWithProg (const (const id)) (logger logLevel) debouncer options vfs

ghcide/ghcide.cabal

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ library
5656
haskell-lsp-types == 0.22.*,
5757
haskell-lsp == 0.22.*,
5858
hie-compat,
59+
hls-plugin-api,
60+
lens,
5961
mtl,
6062
network-uri,
6163
parallel,
@@ -127,7 +129,6 @@ library
127129
include
128130
exposed-modules:
129131
Development.IDE
130-
Development.IDE.Compat
131132
Development.IDE.Core.Debouncer
132133
Development.IDE.Core.FileStore
133134
Development.IDE.Core.IdeConfiguration
@@ -163,6 +164,8 @@ library
163164
Development.IDE.Plugin
164165
Development.IDE.Plugin.Completions
165166
Development.IDE.Plugin.CodeAction
167+
Development.IDE.Plugin.HLS
168+
Development.IDE.Plugin.HLS.GhcIde
166169
Development.IDE.Plugin.Test
167170

168171
-- Unfortunately, we cannot use loadSession with ghc-lib since hie-bios uses
@@ -190,6 +193,7 @@ library
190193
Development.IDE.Plugin.CodeAction.RuleTypes
191194
Development.IDE.Plugin.Completions.Logic
192195
Development.IDE.Plugin.Completions.Types
196+
Development.IDE.Plugin.HLS.Formatter
193197
Development.IDE.Types.Action
194198
ghc-options: -Wall -Wno-name-shadowing -Wincomplete-uni-patterns
195199

@@ -265,6 +269,7 @@ executable ghcide
265269
haskell-lsp-types,
266270
heapsize,
267271
hie-bios,
272+
hls-plugin-api,
268273
ghcide,
269274
lens,
270275
optparse-applicative,

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
136136
} <- getShakeExtras
137137

138138
IdeOptions{ optTesting = IdeTesting optTesting
139-
, optCheckProject = CheckProject checkProject
139+
, optCheckProject = checkProject
140140
, optCustomDynFlags
141141
, optExtensions
142142
} <- getIdeOptions

ghcide/src/Development/IDE.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module Development.IDE
99
import Development.IDE.Core.RuleTypes as X
1010
import Development.IDE.Core.Rules as X
1111
(getAtPoint
12+
,getClientConfigAction
1213
,getDefinition
1314
,getParsedModule
1415
,getTypeDefinition

ghcide/src/Development/IDE/Compat.hs

Lines changed: 0 additions & 19 deletions
This file was deleted.

ghcide/src/Development/IDE/Core/FileStore.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Development.IDE.Core.RuleTypes
4040
import Development.IDE.Types.Options
4141
import qualified Data.Rope.UTF16 as Rope
4242
import Development.IDE.Import.DependencyInformation
43+
import Ide.Plugin.Config (CheckParents(..))
4344

4445
#ifdef mingw32_HOST_OS
4546
import qualified System.Directory as Dir

ghcide/src/Development/IDE/Core/IdeConfiguration.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ isWorkspaceFile file =
8888
workspaceFolders
8989

9090
getClientSettings :: Action (Maybe Value)
91-
getClientSettings = unhashed . clientSettings <$> getIdeConfiguration
91+
getClientSettings = unhashed . clientSettings <$> getIdeConfiguration

0 commit comments

Comments
 (0)