Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Upgrade to haskell-lsp 0.19 #254

Merged
merged 2 commits into from
Dec 16, 2019
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
4 changes: 2 additions & 2 deletions ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ library
extra,
filepath,
hashable,
haskell-lsp-types >= 0.18,
haskell-lsp >= 0.18,
haskell-lsp-types == 0.19.*,
haskell-lsp == 0.19.*,
mtl,
network-uri,
prettyprinter-ansi-terminal,
Expand Down
5 changes: 3 additions & 2 deletions src/Development/IDE/Core/FileStore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ makeVFSHandle = do
modifyVar_ vfsVar $ \(nextVersion, vfs) -> pure $ (nextVersion + 1, ) $
case content of
Nothing -> Map.delete uri vfs
Just content -> Map.insert uri (VirtualFile nextVersion (Rope.fromText content)) vfs
-- The second version number is only used in persistFileVFS which we do not use so we set it to 0.
Just content -> Map.insert uri (VirtualFile nextVersion 0 (Rope.fromText content)) vfs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this line is right. The first field is supposed to be a version number you get from the LSP request and the second number an auto-incrementing version. It seems you are not keeping track of the version number reported by haskell-lsp at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afaik the second number is only used for persistVirtualFile which we don’t use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve checked the haskell-lsp source again which seems to confirm this and I’ve added a comment to make it clear that we do not care about this field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note that this is the fake VFS handle that we use in some DAML tests that don’t use LSP, the proper VFS handle that you usually get is the one below in makeLSPVFSHandle.

}

makeLSPVFSHandle :: LspFuncs c -> VFSHandle
Expand Down Expand Up @@ -139,7 +140,7 @@ getModificationTimeRule vfs =
alwaysRerun
mbVirtual <- liftIO $ getVirtualFile vfs $ filePathToUri' file
case mbVirtual of
Just (VirtualFile ver _) -> pure (Just $ BS.pack $ show ver, ([], Just $ VFSVersion ver))
Just (virtualFileVersion -> ver) -> pure (Just $ BS.pack $ show ver, ([], Just $ VFSVersion ver))
Nothing -> liftIO $ fmap wrap (getModTime file')
`catch` \(e :: IOException) -> do
let err | isDoesNotExistError e = "File does not exist: " ++ file'
Expand Down
6 changes: 3 additions & 3 deletions stack-ghc-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ resolver: nightly-2019-09-16
packages:
- .
extra-deps:
- haskell-lsp-0.18.0.0
- haskell-lsp-types-0.18.0.0
- lsp-test-0.8.2.0
- haskell-lsp-0.19.0.0
- haskell-lsp-types-0.19.0.0
- lsp-test-0.9.0.0
- hie-bios-0.3.0
- ghc-lib-parser-8.8.1
- ghc-lib-8.8.1
Expand Down
6 changes: 3 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ resolver: nightly-2019-09-16
packages:
- .
extra-deps:
- haskell-lsp-0.18.0.0
- haskell-lsp-types-0.18.0.0
- lsp-test-0.8.2.0
- haskell-lsp-0.19.0.0
- haskell-lsp-types-0.19.0.0
- lsp-test-0.9.0.0
- hie-bios-0.3.0
nix:
packages: [zlib]
6 changes: 3 additions & 3 deletions stack84.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ packages:
- .

extra-deps:
- haskell-lsp-0.18.0.0
- haskell-lsp-types-0.18.0.0
- lsp-test-0.8.2.0
- haskell-lsp-0.19.0.0
- haskell-lsp-types-0.19.0.0
- lsp-test-0.9.0.0
- rope-utf16-splay-0.3.1.0
- shake-0.18.3
- filepattern-0.1.1
Expand Down
3 changes: 3 additions & 0 deletions stack88.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ resolver: nightly-2019-12-06
packages:
- .
extra-deps:
- haskell-lsp-0.19.0.0
- haskell-lsp-types-0.19.0.0
- lsp-test-0.9.0.0
- hie-bios-0.3.0
allow-newer: true
nix:
Expand Down