@@ -436,21 +436,25 @@ hover ide _ msgParam = do
436
436
437
437
lens :: PluginMethodHandler IdeState LSP. Method_TextDocumentCodeLens
438
438
lens state _plId clp = do
439
- let uri = clp ^. JL. textDocument . JL. uri
439
+ if not $ isInlayHintsSupported state
440
+ then do
441
+ let uri = clp ^. JL. textDocument . JL. uri
440
442
441
- nfp <- getNormalizedFilePathE uri
442
- cabalFields <- runActionE " cabal.cabal-lens" state $ useE ParseCabalFields nfp
443
- let positionedDeps = concatMap parseDeps cabalFields
443
+ nfp <- getNormalizedFilePathE uri
444
+ cabalFields <- runActionE " cabal.cabal-lens" state $ useE ParseCabalFields nfp
445
+ let positionedDeps = concatMap parseDeps cabalFields
444
446
445
- let rfp = rootDir state
446
- let planJson = toNormalizedFilePath $ rfp </> planJsonPath
447
- planDeps <- runActionE " cabal.cabal-lens" state $ useE BuildDependencyVersionMapping planJson
447
+ let rfp = rootDir state
448
+ let planJson = toNormalizedFilePath $ rfp </> planJsonPath
449
+ planDeps <- runActionE " cabal.cabal-lens" state $ useE BuildDependencyVersionMapping planJson
448
450
449
- let lenses = Maybe. mapMaybe
450
- (\ p@ (PositionedDependency _ name) -> getCodeLens . Versioned p <$> Map. lookup name planDeps)
451
- positionedDeps
451
+ let lenses = Maybe. mapMaybe
452
+ (\ p@ (PositionedDependency _ name) -> getCodeLens . Versioned p <$> Map. lookup name planDeps)
453
+ positionedDeps
452
454
453
- pure $ InL lenses
455
+ pure $ InL lenses
456
+ else
457
+ pure $ InL []
454
458
where
455
459
getCodeLens :: Versioned PositionedDependency -> CodeLens
456
460
getCodeLens (Versioned (PositionedDependency pos _) v) =
@@ -477,23 +481,27 @@ hint state _plId clp =
477
481
if isInlayHintsSupported state
478
482
then do
479
483
let uri = clp ^. JL. textDocument . JL. uri
480
- let rfp = toNormalizedFilePath $ rootDir state
481
484
482
485
nfp <- getNormalizedFilePathE uri
483
- cabalFields <- runActionE " cabal.cabal-inlayhint " state $ useE ParseCabalFields nfp
486
+ cabalFields <- runActionE " cabal.cabal-lens " state $ useE ParseCabalFields nfp
484
487
let positionedDeps = concatMap parseDeps cabalFields
485
- let hints = map getInlayHint positionedDeps
486
-
487
- let testDep = PositionedDependency (Syntax. Position 1 1 ) " test"
488
488
489
- pure $ InL (getInlayHint testDep : hints)
489
+ let rfp = rootDir state
490
+ let planJson = toNormalizedFilePath $ rfp </> planJsonPath
491
+ planDeps <- runActionE " cabal.cabal-lens" state $ useE BuildDependencyVersionMapping planJson
492
+
493
+ let hints = Maybe. mapMaybe
494
+ (\ p@ (PositionedDependency _ name) -> getInlayHint . Versioned p <$> Map. lookup name planDeps)
495
+ positionedDeps
496
+
497
+ pure $ InL hints
490
498
else
491
499
pure $ InL []
492
500
where
493
- getInlayHint :: PositionedDependency -> InlayHint
494
- getInlayHint (PositionedDependency pos dep ) = InlayHint
501
+ getInlayHint :: Versioned PositionedDependency -> InlayHint
502
+ getInlayHint (Versioned ( PositionedDependency pos _) v ) = InlayHint
495
503
{ _position = Types. cabalPositionToLSPPosition pos
496
- , _label = InL dep
504
+ , _label = InL v
497
505
, _kind = Nothing
498
506
, _textEdits = Nothing
499
507
, _tooltip = Nothing
0 commit comments