Skip to content

Commit

Permalink
Merge pull request #496 from haskell/mpj/no-deprecate-fields
Browse files Browse the repository at this point in the history
Don't deprecate fields
  • Loading branch information
michaelpj authored Jul 2, 2023
2 parents e9d2cff + 25d2eb4 commit a1c7dff
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
8 changes: 8 additions & 0 deletions lsp-types/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Revision history for lsp-types

## 2.0.0.2

* Removed deprecation pragmas from fields, as these cannot currently be avoided.

## 2.0.0.1

* Fixed missing `extra-source-files` for `metamodel.json`.

## 2.0.0.0

* Breaking change: major restructure to generate types and methods from the LSP metamodel.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import qualified Language.LSP.Protocol.Internal.Types.MarkupContent
import qualified Language.LSP.Protocol.Internal.Types.TextEdit
import qualified Language.LSP.Protocol.Types.Common

{-# DEPRECATED _deprecated "Use `tags` instead." #-}
{-|
A completion item represents a text snippet that is
proposed to complete text that is being typed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import qualified Language.LSP.Protocol.Internal.Types.SymbolKind
import qualified Language.LSP.Protocol.Internal.Types.SymbolTag
import qualified Language.LSP.Protocol.Types.Common

{-# DEPRECATED _deprecated "Use tags instead" #-}
{-|
Represents programming constructs like variables, classes, interfaces etc.
that appear in a document. Document symbols can be hierarchical and they
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import qualified Language.LSP.Protocol.Internal.Types.WorkspaceFolder
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri

{-# DEPRECATED _rootPath "in favour of rootUri." #-}
{-# DEPRECATED _rootUri "in favour of workspaceFolders." #-}
{-|
-}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import qualified Language.LSP.Protocol.Internal.Types.SymbolKind
import qualified Language.LSP.Protocol.Internal.Types.SymbolTag
import qualified Language.LSP.Protocol.Types.Common

{-# DEPRECATED _deprecated "Use tags instead" #-}
{-|
Represents information about programming constructs like variables, classes,
interfaces etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import qualified Language.LSP.Protocol.Internal.Types.TraceValues
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri

{-# DEPRECATED _rootPath "in favour of rootUri." #-}
{-# DEPRECATED _rootUri "in favour of workspaceFolders." #-}
{-|
The initialize parameters
-}
Expand Down
8 changes: 6 additions & 2 deletions lsp-types/generator/CodeGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,12 @@ printStruct tn s@Structure{name, documentation, since, proposed, deprecated} = d
propDoc <- multilineHaddock . pretty <$> mkDocumentation documentation since proposed
pure $ hardvcat [propDoc, pretty n <+> "::" <+> mty]

-- Annoyingly, this won't deprecate the lens, which is defined somewhere else entirely. Unclear what to do about that.
let deprecations = optDeprecated tn deprecated ++ (flip concatMap props $ \Property{name, deprecated} -> optDeprecated (makeFieldName name) deprecated)
-- We do *not* deprecate fields. We can't really represent this properly: typically a deprecated field
-- is optional, and the "correct" thing to do is to omit it. But in our representaiton that means passing
-- Nothing as the value, which counts as "using" the field. So there is no way for users to avoid the
-- deprecation warning, which is silly. To do this properly we'd need to do something clever with
-- pattern synonyms maybe?
let deprecations = optDeprecated tn deprecated

ensureImport "GHC.Generics" Unqual
ensureImport "Control.DeepSeq" Unqual
Expand Down
2 changes: 1 addition & 1 deletion lsp-types/lsp-types.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: lsp-types
version: 2.0.0.1
version: 2.0.0.2
synopsis:
Haskell library for the Microsoft Language Server Protocol, data types

Expand Down

0 comments on commit a1c7dff

Please sign in to comment.