Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 8 additions & 11 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ packages:
./hls-plugin-api
./hls-test-utils


index-state: 2026-02-02T09:03:26Z
index-state: 2026-02-24T00:00:00Z

tests: True
test-show-details: direct
Expand Down Expand Up @@ -41,6 +40,7 @@ constraints:
-- We want to be able to benefit from the performance optimisations
-- in the future, thus: TODO: remove this flag.
bitvec -simd,
monad-control >=1.0.3,


-- Some of the formatters need the latest Cabal-syntax version,
Expand All @@ -59,15 +59,11 @@ if impl(ghc >= 9.11)

if impl(ghc >= 9.14)
allow-newer:
lsp-types:containers,
lsp:containers,
indexed-traversable:containers,
quickcheck-instances:containers,
dependent-map:containers,
aeson:containers,
semialign:containers,
lsp-test:containers,
hie-bios:ghc,
string-interpolate:template-haskell,
tasty-hspec:base,
tagged:template-haskell,
Expand All @@ -79,19 +75,20 @@ if impl(ghc >= 9.14)
some:base,
boring:base,
indexed-traversable-instances:base,
lsp-types:template-haskell,
uuid-types:template-haskell,
hie-compat:base,
hie-bios:time,
hie-bios:template-haskell,
ghc-trace-events:base,
constraints-extras:template-haskell,
aeson:time,
text-iso8601:time,
semialign:base,
aeson:template-haskell,
lsp-test:time,
lukko:base,
binary-instances:base,
binary-orphans:base,
cabal-install-parsers:containers
cabal-install-parsers:containers,
haddock-library:base,
websockets:containers,
monad-control:transformers,
mmorph:transformers-compat,
binary-instances:tagged,
9 changes: 8 additions & 1 deletion ghcide-test/exe/InitializeResponseTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ tests = withResource acquire release tests where
{ _supported = Just True
, _changeNotifications = Just (InR True)
}
, _fileOperations = Nothing
, _fileOperations = Just $ FileOperationOptions
{ _didCreate = Nothing
, _willCreate = Nothing
, _didRename = Nothing
, _willRename = Nothing
, _didDelete = Nothing
, _willDelete = Nothing
}
})
, chk "NO experimental" (^. L.experimental) Nothing
] where
Expand Down
6 changes: 3 additions & 3 deletions ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ library
, Glob
, haddock-library >=1.8 && <1.12
, hashable
, hie-bios ^>=0.17.0
, hie-bios ^>= 0.18.0
, hiedb ^>= 0.8.0.0
, hls-graph == 2.13.0.0
, hls-plugin-api == 2.13.0.0
, implicit-hie >= 0.1.4.0 && < 0.1.5
, lens
, lens-aeson
, list-t
, lsp ^>=2.7
, lsp-types ^>=2.3
, lsp ^>=2.8
, lsp-types ^>=2.4
, mtl
, opentelemetry >=0.6.1
, optparse-applicative
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Core/FileStore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ getVersionedTextDoc doc = do
maybe (pure Nothing) getVirtualFile $
uriToNormalizedFilePath $ toNormalizedUri uri
let ver = case mvf of
Just (VirtualFile lspver _ _) -> lspver
Nothing -> 0
Just (VirtualFile lspver _ _ _) -> lspver
Nothing -> 0
return (VersionedTextDocumentIdentifier uri ver)

fileStoreRules :: Recorder (WithPriority Log) -> (NormalizedFilePath -> Action Bool) -> Rules ()
Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ import Ide.Plugin.Properties (HasProperty,
useProperty,
usePropertyByPath)
import Ide.Types (DynFlagsModifications (dynFlagsModifyGlobal, dynFlagsModifyParser),
PluginId)
PluginId, getVirtualFileFromVFS)
import qualified Language.LSP.Protocol.Lens as JL
import Language.LSP.Protocol.Message (SMethod (SMethod_CustomMethod, SMethod_WindowShowMessage))
import Language.LSP.Protocol.Types (MessageType (MessageType_Info),
Expand Down Expand Up @@ -525,7 +525,7 @@ persistentHieFileRule recorder = addPersistentRule GetHieAst $ \file -> runMaybe
res <- readHieFileForSrcFromDisk recorder file
vfsRef <- asks vfsVar
vfsData <- liftIO $ _vfsMap <$> readTVarIO vfsRef
(currentSource, ver) <- liftIO $ case M.lookup (filePathToUri' file) vfsData of
(currentSource, ver) <- liftIO $ case getVirtualFileFromVFS (VFS vfsData) (filePathToUri' file) of
Nothing -> (,Nothing) . T.decodeUtf8 <$> BS.readFile (fromNormalizedFilePath file)
Just vf -> pure (virtualFileText vf, Just $ virtualFileVersion vf)
let refmap = generateReferencesMap . getAsts . Compat.hie_asts $ res
Expand Down
4 changes: 3 additions & 1 deletion ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ import Development.IDE.Core.RuleTypes
import Development.IDE.Types.Options as Options
import qualified Language.LSP.Protocol.Message as LSP
import qualified Language.LSP.Server as LSP
import qualified Language.LSP.VFS as VFS

import Development.IDE.Core.Tracing
import Development.IDE.Core.WorkerThread
Expand Down Expand Up @@ -401,7 +402,8 @@ class Typeable a => IsIdeGlobal a where
getVirtualFile :: NormalizedFilePath -> Action (Maybe VirtualFile)
getVirtualFile nf = do
vfs <- fmap _vfsMap . liftIO . readTVarIO . vfsVar =<< getShakeExtras
pure $! Map.lookup (filePathToUri' nf) vfs -- Don't leak a reference to the entire map
pure $! -- Don't leak a reference to the entire map
getVirtualFileFromVFS (VFS vfs) $ filePathToUri' nf

-- Take a snapshot of the current LSP VFS
vfsSnapshot :: Maybe (LSP.LanguageContextEnv a) -> IO VFS
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ mergeListsBy cmp all_lists = merge_lists all_lists

-- |From the given cursor position, gets the prefix module or record for autocompletion
getCompletionPrefix :: Position -> VFS.VirtualFile -> PosPrefixInfo
getCompletionPrefix pos (VFS.VirtualFile _ _ ropetext) = getCompletionPrefixFromRope pos ropetext
getCompletionPrefix pos (VFS.VirtualFile _ _ ropetext _) = getCompletionPrefixFromRope pos ropetext

getCompletionPrefixFromRope :: Position -> Rope.Rope -> PosPrefixInfo
getCompletionPrefixFromRope pos@(Position l c) ropetext =
Expand Down
10 changes: 6 additions & 4 deletions ghcide/src/Development/IDE/Plugin/HLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ import qualified Language.LSP.Server as LSP
import Language.LSP.VFS
import Prettyprinter.Render.String (renderString)
import Text.Regex.TDFA.Text ()
import UnliftIO (MonadUnliftIO, liftIO)
import UnliftIO (MonadUnliftIO, liftIO,
readTVarIO)
import UnliftIO.Async (forConcurrently)
import UnliftIO.Exception (catchAny)

Expand Down Expand Up @@ -251,11 +252,12 @@ extensiblePlugins recorder plugins = mempty { P.pluginHandlers = handlers }
handlers = mconcat $ do
(IdeMethod m :=> IdeHandler fs') <- DMap.assocs handlers'
pure $ requestHandler m $ \ide params -> do
vfs <- readTVarIO $ vfsVar $ shakeExtras ide
config <- Ide.PluginUtils.getClientConfig
-- Only run plugins that are allowed to run on this request, save the
-- list of disabled plugins incase that's all we have
let (fs, dfs) = List.partition (\(_, desc, _) -> handlesRequest m params desc config == HandlesRequest) fs'
let disabledPluginsReason = (\(x, desc, _) -> (x, handlesRequest m params desc config)) <$> dfs
let (fs, dfs) = List.partition (\(_, desc, _) -> handlesRequest vfs m params desc config == HandlesRequest) fs'
let disabledPluginsReason = (\(x, desc, _) -> (x, handlesRequest vfs m params desc config)) <$> dfs
-- Clients generally don't display ResponseErrors so instead we log any that we come across
-- However, some clients do display ResponseErrors! See for example the issues:
-- https://github.com/haskell/haskell-language-server/issues/4467
Expand Down Expand Up @@ -370,7 +372,7 @@ extensibleNotificationPlugins recorder xs = mempty { P.pluginHandlers = handlers
pure $ notificationHandler m $ \ide vfs params -> do
config <- Ide.PluginUtils.getClientConfig
-- Only run plugins that are enabled for this request
let fs = filter (\(_, desc, _) -> handlesRequest m params desc config == HandlesRequest) fs'
let fs = filter (\(_, desc, _) -> handlesRequest vfs m params desc config == HandlesRequest) fs'
case nonEmpty fs of
Nothing -> do
logWith recorder Warning (LogNoPluginForMethod $ Some m)
Expand Down
18 changes: 9 additions & 9 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ library hls-cabal-plugin
, hls-plugin-api == 2.13.0.0
, hls-graph == 2.13.0.0
, lens
, lsp ^>=2.7
, lsp-types ^>=2.3
, lsp ^>=2.8
, lsp-types ^>=2.4
, mtl
, regex-tdfa ^>=1.3.1
, text
Expand Down Expand Up @@ -415,7 +415,7 @@ library hls-call-hierarchy-plugin
, hiedb ^>= 0.8.0.0
, hls-plugin-api == 2.13.0.0
, lens
, lsp >=2.7
, lsp >=2.8
, sqlite-simple
, text

Expand Down Expand Up @@ -1040,7 +1040,7 @@ library hls-alternate-number-format-plugin
, hls-graph
, hls-plugin-api == 2.13.0.0
, lens
, lsp ^>=2.7
, lsp ^>=2.8
, mtl
, syb
, text
Expand Down Expand Up @@ -1268,7 +1268,7 @@ library hls-gadt-plugin
, hls-plugin-api == 2.13.0.0
, haskell-language-server:hls-refactor-plugin
, lens
, lsp >=2.7
, lsp >=2.8
, mtl
, text
, transformers
Expand Down Expand Up @@ -1315,7 +1315,7 @@ library hls-explicit-fixity-plugin
, ghcide == 2.13.0.0
, hashable
, hls-plugin-api == 2.13.0.0
, lsp >=2.7
, lsp >=2.8
, text

default-extensions: DataKinds
Expand Down Expand Up @@ -1799,7 +1799,7 @@ library hls-notes-plugin
, hls-graph == 2.13.0.0
, hls-plugin-api == 2.13.0.0
, lens
, lsp >=2.7
, lsp >=2.8
, mtl >= 2.2
, regex-tdfa >= 1.3.1
, text
Expand Down Expand Up @@ -2104,7 +2104,7 @@ test-suite ghcide-tests
, lens
, list-t
, lsp
, lsp-test ^>=0.17.1
, lsp-test ^>=0.18.0
, lsp-types
, mtl
, network-uri
Expand Down Expand Up @@ -2261,7 +2261,7 @@ test-suite ghcide-bench-test
build-depends:
extra,
haskell-language-server:ghcide-bench-lib,
lsp-test ^>= 0.17,
lsp-test ^>= 0.18,
tasty,
tasty-hunit >= 0.10,
tasty-rerun
Expand Down
2 changes: 1 addition & 1 deletion hls-plugin-api/hls-plugin-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ library
, hls-graph == 2.13.0.0
, lens
, lens-aeson
, lsp ^>=2.7
, lsp ^>=2.8
, megaparsec >=9.0
, mtl
, opentelemetry >=0.4
Expand Down
Loading
Loading