Skip to content

Commit 3ad32c6

Browse files
authored
Update the metamodel (#556)
* Update the metamodel There are various changes: - Quite a lot of new "proposed" stuff. I adjusted the codegen to filter this stuff out, which is what we want I think. I had to make some PRs upstream, I hacked up our metamodel copy to mirror what I think will come out of that eventually. - They created named structs for a lot of the previously anonymous ones. This is generally pretty good, using `row-types` for that was always a bit awkward. However, I haven't been able to get them to commit to actually getting rid of anonymous structs entirely, so we have to keep the support :( - This change does generate most of the churn, though - Some random renamings 🤷 * Try to fix on 9.8
1 parent 2bba471 commit 3ad32c6

File tree

117 files changed

+6336
-2309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+6336
-2309
lines changed

lsp-test/src/Language/LSP/Test.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ runSessionWithHandles' serverProc serverIn serverOut config' caps rootDir sessio
289289
caps
290290
-- TODO: make this configurable?
291291
(Just $ Object $ lspConfig config')
292-
(Just TraceValues_Off)
292+
(Just TraceValue_Off)
293293
(fmap InL $ initialWorkspaceFolders config)
294294
runSession' serverIn serverOut serverProc listenServer config caps rootDir exitServer $ do
295295
-- Wrap the session around initialize and shutdown calls
@@ -546,7 +546,7 @@ createDoc ::
546546
-- | The path to the document to open, __relative to the root directory__.
547547
FilePath ->
548548
-- | The text document's language identifier, e.g. @"haskell"@.
549-
T.Text ->
549+
LanguageKind ->
550550
-- | The content of the text document to create.
551551
T.Text ->
552552
-- | The identifier of the document just created.
@@ -591,7 +591,7 @@ createDoc file languageId contents = do
591591
{- | Opens a text document that /exists on disk/, and sends a
592592
textDocument/didOpen notification to the server.
593593
-}
594-
openDoc :: FilePath -> T.Text -> Session TextDocumentIdentifier
594+
openDoc :: FilePath -> LanguageKind -> Session TextDocumentIdentifier
595595
openDoc file languageId = do
596596
context <- ask
597597
let fp = rootDir context </> file
@@ -601,7 +601,7 @@ openDoc file languageId = do
601601
{- | This is a variant of `openDoc` that takes the file content as an argument.
602602
Use this is the file exists /outside/ of the current workspace.
603603
-}
604-
openDoc' :: FilePath -> T.Text -> T.Text -> Session TextDocumentIdentifier
604+
openDoc' :: FilePath -> LanguageKind -> T.Text -> Session TextDocumentIdentifier
605605
openDoc' file languageId contents = do
606606
context <- ask
607607
let fp = rootDir context </> file

lsp-test/src/Language/LSP/Test/Compat.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE CPP #-}
22
{-# LANGUAGE DataKinds #-}
3+
{-# LANGUAGE DuplicateRecordFields #-}
34
{-# LANGUAGE OverloadedLabels #-}
45
{-# LANGUAGE OverloadedStrings #-}
56
-- For some reason ghc warns about not using
@@ -10,8 +11,7 @@
1011
module Language.LSP.Test.Compat where
1112

1213
import Data.Maybe
13-
import Data.Row
14-
import Data.Text qualified as T
14+
import Language.LSP.Protocol.Types qualified as L
1515
import System.IO
1616

1717
#if MIN_VERSION_process(1,6,3)
@@ -118,5 +118,5 @@ withCreateProcess c action =
118118

119119
#endif
120120

121-
lspTestClientInfo :: Rec ("name" .== T.Text .+ "version" .== Maybe T.Text)
122-
lspTestClientInfo = #name .== "lsp-test" .+ #version .== (Just CURRENT_PACKAGE_VERSION)
121+
lspTestClientInfo :: L.ClientInfo
122+
lspTestClientInfo = L.ClientInfo{L._name = "lsp-test", L._version = Just CURRENT_PACKAGE_VERSION}

lsp-test/src/Language/LSP/Test/Session.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
{-# LANGUAGE CPP #-}
44
{-# LANGUAGE GADTs #-}
5+
{-# LANGUAGE DuplicateRecordFields #-}
56
{-# LANGUAGE OverloadedStrings #-}
67
{-# LANGUAGE OverloadedLabels #-}
78
{-# LANGUAGE TypeInType #-}
@@ -80,7 +81,6 @@ import System.Process (waitForProcess)
8081
import System.Timeout ( timeout )
8182
import Data.IORef
8283
import Colog.Core (LogAction (..), WithSeverity (..), Severity (..))
83-
import Data.Row
8484
import Data.String (fromString)
8585
import Data.Either (partitionEithers)
8686

@@ -472,8 +472,8 @@ updateState (FromServerMess SMethod_WorkspaceApplyEdit r) = do
472472

473473
-- TODO: move somewhere reusable
474474
editToChangeEvent :: TextEdit |? AnnotatedTextEdit -> TextDocumentContentChangeEvent
475-
editToChangeEvent (InR e) = TextDocumentContentChangeEvent $ InL $ #range .== (e ^. L.range) .+ #rangeLength .== Nothing .+ #text .== (e ^. L.newText)
476-
editToChangeEvent (InL e) = TextDocumentContentChangeEvent $ InL $ #range .== (e ^. L.range) .+ #rangeLength .== Nothing .+ #text .== (e ^. L.newText)
475+
editToChangeEvent (InR e) = TextDocumentContentChangeEvent $ InL $ TextDocumentContentChangePartial { _range = (e ^. L.range) , _rangeLength = Nothing , _text = (e ^. L.newText) }
476+
editToChangeEvent (InL e) = TextDocumentContentChangeEvent $ InL $ TextDocumentContentChangePartial { _range = (e ^. L.range) , _rangeLength = Nothing , _text = (e ^. L.newText) }
477477

478478
getParamsFromDocumentChange :: DocumentChange -> Maybe DidChangeTextDocumentParams
479479
getParamsFromDocumentChange (InL textDocumentEdit) = getParamsFromTextDocumentEdit textDocumentEdit

lsp-types/ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Revision history for lsp-types
22

3+
## Unreleased
4+
5+
- Update the metamodel. This results in a number of breaking changes to the generated code, mostly replacing
6+
anonymous structs with named ones.
7+
38
## 2.1.1.0 -- 2024-02-24
49

510
- Require aeson 2

lsp-types/generated/Language/LSP/Protocol/Internal/Meta.hs

Lines changed: 59 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lsp-types/generated/Language/LSP/Protocol/Internal/Method.hs

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)