Skip to content

Commit 0df9923

Browse files
authored
Merge branch 'master' into test-temp-dir
2 parents 6594a28 + d331019 commit 0df9923

File tree

14 files changed

+229
-48
lines changed

14 files changed

+229
-48
lines changed

.github/actions/setup-build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
sudo chown -R $USER /usr/local/.ghcup
3232
shell: bash
3333

34-
- uses: haskell-actions/[email protected].3
34+
- uses: haskell-actions/[email protected].5
3535
id: HaskEnvSetup
3636
with:
3737
ghc-version : ${{ inputs.ghc }}

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -523,22 +523,17 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
523523
_inplace = map rawComponentUnitId $ NE.toList all_deps
524524

525525
all_deps' <- forM all_deps $ \RawComponentInfo{..} -> do
526-
-- Remove all inplace dependencies from package flags for
527-
-- components in this HscEnv
528-
let (df2, uids) = (rawComponentDynFlags, [])
529526
let prefix = show rawComponentUnitId
530527
-- See Note [Avoiding bad interface files]
531-
let hscComponents = sort $ map show uids
532-
cacheDirOpts = hscComponents ++ componentOptions opts
528+
let cacheDirOpts = componentOptions opts
533529
cacheDirs <- liftIO $ getCacheDirs prefix cacheDirOpts
534-
processed_df <- setCacheDirs recorder cacheDirs df2
530+
processed_df <- setCacheDirs recorder cacheDirs rawComponentDynFlags
535531
-- The final component information, mostly the same but the DynFlags don't
536532
-- contain any packages which are also loaded
537533
-- into the same component.
538534
pure $ ComponentInfo
539535
{ componentUnitId = rawComponentUnitId
540536
, componentDynFlags = processed_df
541-
, componentInternalUnits = uids
542537
, componentTargets = rawComponentTargets
543538
, componentFP = rawComponentFP
544539
, componentCOptions = rawComponentCOptions
@@ -1017,10 +1012,6 @@ data ComponentInfo = ComponentInfo
10171012
-- | Processed DynFlags. Does not contain inplace packages such as local
10181013
-- libraries. Can be used to actually load this Component.
10191014
, componentDynFlags :: DynFlags
1020-
-- | Internal units, such as local libraries, that this component
1021-
-- is loaded with. These have been extracted from the original
1022-
-- ComponentOptions.
1023-
, componentInternalUnits :: [UnitId]
10241015
-- | All targets of this components.
10251016
, componentTargets :: [GHC.Target]
10261017
-- | Filepath which caused the creation of this component

hls-plugin-api/src/Ide/Plugin/Config.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,20 @@ parsePlugins (IdePlugins plugins) = A.withObject "Config.plugins" $ \o -> do
6363
-- ---------------------------------------------------------------------
6464

6565
parsePluginConfig :: PluginConfig -> Value -> A.Parser PluginConfig
66-
parsePluginConfig def = A.withObject "PluginConfig" $ \o -> PluginConfig
66+
parsePluginConfig def = A.withObject "PluginConfig" $ \o -> PluginConfig
6767
<$> o .:? "globalOn" .!= plcGlobalOn def
6868
<*> o .:? "callHierarchyOn" .!= plcCallHierarchyOn def
69-
<*> o .:? "semanticTokensOn" .!= plcSemanticTokensOn def
7069
<*> o .:? "codeActionsOn" .!= plcCodeActionsOn def
7170
<*> o .:? "codeLensOn" .!= plcCodeLensOn def
71+
<*> o .:? "inlayHintsOn" .!= plcInlayHintsOn def
7272
<*> o .:? "diagnosticsOn" .!= plcDiagnosticsOn def -- AZ
7373
<*> o .:? "hoverOn" .!= plcHoverOn def
7474
<*> o .:? "symbolsOn" .!= plcSymbolsOn def
7575
<*> o .:? "completionOn" .!= plcCompletionOn def
7676
<*> o .:? "renameOn" .!= plcRenameOn def
7777
<*> o .:? "selectionRangeOn" .!= plcSelectionRangeOn def
78-
<*> o .:? "foldingRangeOn" .!= plcFoldingRangeOn def
78+
<*> o .:? "foldingRangeOn" .!= plcFoldingRangeOn def
79+
<*> o .:? "semanticTokensOn" .!= plcSemanticTokensOn def
7980
<*> o .:? "config" .!= plcConfig def
8081

8182
-- ---------------------------------------------------------------------

hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ pluginsToDefaultConfig IdePlugins {..} =
8888
handlersToGenericDefaultConfig PluginConfig{..} (IdeMethod m DSum.:=> _) = case m of
8989
SMethod_TextDocumentCodeAction -> ["codeActionsOn" A..= plcCodeActionsOn]
9090
SMethod_TextDocumentCodeLens -> ["codeLensOn" A..= plcCodeLensOn]
91+
SMethod_TextDocumentInlayHint -> ["inlayHintsOn" A..= plcInlayHintsOn]
9192
SMethod_TextDocumentRename -> ["renameOn" A..= plcRenameOn]
9293
SMethod_TextDocumentHover -> ["hoverOn" A..= plcHoverOn]
9394
SMethod_TextDocumentDocumentSymbol -> ["symbolsOn" A..= plcSymbolsOn]
@@ -120,6 +121,7 @@ pluginsToVSCodeExtensionSchema IdePlugins {..} = A.object $ mconcat $ singlePlug
120121
handlersToGenericSchema PluginConfig{..} (IdeMethod m DSum.:=> _) = case m of
121122
SMethod_TextDocumentCodeAction -> [toKey' "codeActionsOn" A..= schemaEntry "code actions" plcCodeActionsOn]
122123
SMethod_TextDocumentCodeLens -> [toKey' "codeLensOn" A..= schemaEntry "code lenses" plcCodeLensOn]
124+
SMethod_TextDocumentInlayHint -> [toKey' "inlayHintsOn" A..= schemaEntry "inlay hints" plcInlayHintsOn]
123125
SMethod_TextDocumentRename -> [toKey' "renameOn" A..= schemaEntry "rename" plcRenameOn]
124126
SMethod_TextDocumentHover -> [toKey' "hoverOn" A..= schemaEntry "hover" plcHoverOn]
125127
SMethod_TextDocumentDocumentSymbol -> [toKey' "symbolsOn" A..= schemaEntry "symbols" plcSymbolsOn]

hls-plugin-api/src/Ide/Types.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ data PluginConfig =
260260
, plcCallHierarchyOn :: !Bool
261261
, plcCodeActionsOn :: !Bool
262262
, plcCodeLensOn :: !Bool
263+
, plcInlayHintsOn :: !Bool
263264
, plcDiagnosticsOn :: !Bool
264265
, plcHoverOn :: !Bool
265266
, plcSymbolsOn :: !Bool
@@ -277,6 +278,7 @@ instance Default PluginConfig where
277278
, plcCallHierarchyOn = True
278279
, plcCodeActionsOn = True
279280
, plcCodeLensOn = True
281+
, plcInlayHintsOn = True
280282
, plcDiagnosticsOn = True
281283
, plcHoverOn = True
282284
, plcSymbolsOn = True
@@ -289,12 +291,13 @@ instance Default PluginConfig where
289291
}
290292

291293
instance ToJSON PluginConfig where
292-
toJSON (PluginConfig g ch ca cl d h s c rn sr fr st cfg) = r
294+
toJSON (PluginConfig g ch ca ih cl d h s c rn sr fr st cfg) = r
293295
where
294296
r = object [ "globalOn" .= g
295297
, "callHierarchyOn" .= ch
296298
, "codeActionsOn" .= ca
297299
, "codeLensOn" .= cl
300+
, "inlayHintsOn" .= ih
298301
, "diagnosticsOn" .= d
299302
, "hoverOn" .= h
300303
, "symbolsOn" .= s
@@ -511,6 +514,12 @@ instance PluginMethod Request Method_WorkspaceSymbol where
511514
-- Unconditionally enabled, but should it really be?
512515
handlesRequest _ _ _ _ = HandlesRequest
513516

517+
instance PluginMethod Request Method_TextDocumentInlayHint where
518+
handlesRequest = pluginEnabledWithFeature plcInlayHintsOn
519+
520+
instance PluginMethod Request Method_InlayHintResolve where
521+
handlesRequest = pluginEnabledResolve plcInlayHintsOn
522+
514523
instance PluginMethod Request Method_TextDocumentCodeLens where
515524
handlesRequest = pluginEnabledWithFeature plcCodeLensOn
516525

@@ -810,6 +819,9 @@ instance PluginRequestMethod Method_TextDocumentSemanticTokensFull where
810819
instance PluginRequestMethod Method_TextDocumentSemanticTokensFullDelta where
811820
combineResponses _ _ _ _ (x :| _) = x
812821

822+
instance PluginRequestMethod Method_TextDocumentInlayHint where
823+
combineResponses _ _ _ _ x = sconcat x
824+
813825
takeLefts :: [a |? b] -> [a]
814826
takeLefts = mapMaybe (\x -> [res | (InL res) <- Just x])
815827

hls-test-utils/src/Test/Hls/Util.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module Test.Hls.Util
77
( -- * Test Capabilities
88
codeActionResolveCaps
99
, codeActionNoResolveCaps
10+
, codeActionNoInlayHintsCaps
1011
, codeActionSupportCaps
1112
, expectCodeAction
1213
-- * Environment specifications
@@ -107,6 +108,12 @@ codeActionNoResolveCaps :: ClientCapabilities
107108
codeActionNoResolveCaps = Test.fullLatestClientCaps
108109
& (L.textDocument . _Just . L.codeAction . _Just . L.resolveSupport) .~ Nothing
109110
& (L.textDocument . _Just . L.codeAction . _Just . L.dataSupport . _Just) .~ False
111+
112+
codeActionNoInlayHintsCaps :: ClientCapabilities
113+
codeActionNoInlayHintsCaps = Test.fullLatestClientCaps
114+
& (L.textDocument . _Just . L.codeAction . _Just . L.resolveSupport) .~ Nothing
115+
& (L.textDocument . _Just . L.codeAction . _Just . L.dataSupport . _Just) .~ False
116+
& (L.textDocument . _Just . L.inlayHint) .~ Nothing
110117
-- ---------------------------------------------------------------------
111118
-- Environment specification for ignoring tests
112119
-- ---------------------------------------------------------------------

0 commit comments

Comments
 (0)