Skip to content

Fix #3574 and support resolve in explicit records #3750

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

Merged
merged 17 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 9 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
11 changes: 9 additions & 2 deletions ghcide/src/Development/IDE/GHC/Orphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Development.IDE.GHC.Orphans() where
#if MIN_VERSION_ghc(9,2,0)
import GHC.Parser.Annotation
#endif

#if MIN_VERSION_ghc(9,0,0)
import GHC.Data.Bag
import GHC.Data.FastString
Expand All @@ -23,7 +24,7 @@ import GHC.Unit.Info
import GHC.Utils.Outputable
#else
import Bag
import GhcPlugins
import GhcPlugins hiding (UniqFM)
import qualified StringBuffer as SB
import Unique (getKey)
#endif
Expand All @@ -39,8 +40,8 @@ import Data.Hashable
import Data.String (IsString (fromString))
import Data.Text (unpack)
#if MIN_VERSION_ghc(9,0,0)
import GHC (ModuleGraph)
import GHC.ByteCode.Types
import GHC (ModuleGraph)
#else
import ByteCodeTypes
#endif
Expand Down Expand Up @@ -244,5 +245,11 @@ instance NFData HomeModLinkable where
instance NFData (HsExpr (GhcPass 'Renamed)) where
rnf = rwhnf

instance NFData (Pat (GhcPass 'Renamed)) where
rnf = rwhnf

instance NFData Extension where
rnf = rwhnf

instance NFData (UniqFM Name [Name]) where
rnf (ufmToIntMap -> m) = rnf m
12 changes: 12 additions & 0 deletions hls-plugin-api/src/Ide/Plugin/Resolve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-| This module currently includes helper functions to provide fallback support
to code actions that use resolve in HLS. The difference between the two
functions for code actions that don't support resolve is that
mkCodeActionHandlerWithResolve will immediately resolve your code action before
sending it on to the client, while mkCodeActionWithResolveAndCommand will turn
your resolve into a command.

General support for resolve in HLS can be used with mkResolveHandler from
Ide.Types. Resolve theoretically should allow us to delay computation of parts
of the request till the client needs it, allowing us to answer requests faster
and with less resource usage.
-}
module Ide.Plugin.Resolve
(mkCodeActionHandlerWithResolve,
mkCodeActionWithResolveAndCommand) where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ source-repository head
type: git
location: https://github.com/haskell/haskell-language-server

flag pedantic
description: Enable -Werror
default: False
manual: True

common warnings
ghc-options: -Wall

Expand All @@ -29,6 +34,7 @@ library
-- other-extensions:
build-depends:
, base >=4.12 && <5
, ghc
, ghcide == 2.1.0.0
, hls-plugin-api == 2.1.0.0
, lsp
Expand All @@ -40,9 +46,13 @@ library
, ghc-boot-th
, unordered-containers
, containers
, aeson
hs-source-dirs: src
default-language: Haskell2010

if flag(pedantic)
ghc-options: -Werror

test-suite tests
import: warnings
default-language: Haskell2010
Expand Down
Loading