@@ -15,7 +15,9 @@ import Language.LSP.Types.Utils
1515
1616-- ---------------------------------------------------------------------
1717
18- makeExtendingDatatype " DocumentSymbolOptions" [''WorkDoneProgressOptions] []
18+ makeExtendingDatatype " DocumentSymbolOptions"
19+ [''WorkDoneProgressOptions]
20+ [ (" _label" , [t | Maybe Bool |])]
1921deriveJSON lspOptions ''DocumentSymbolOptions
2022
2123makeExtendingDatatype " DocumentSymbolRegistrationOptions"
@@ -123,6 +125,25 @@ instance FromJSON SymbolKind where
123125 parseJSON (Number 26 ) = pure SkTypeParameter
124126 parseJSON (Number x) = pure (SkUnknown x)
125127 parseJSON _ = mempty
128+
129+ {-|
130+ Symbol tags are extra annotations that tweak the rendering of a symbol.
131+
132+ @since 3.16.0
133+ -}
134+ data SymbolTag =
135+ StDeprecated -- ^ Render a symbol as obsolete, usually using a strike-out.
136+ | StUnknown Scientific
137+ deriving (Read , Show , Eq )
138+
139+ instance ToJSON SymbolTag where
140+ toJSON StDeprecated = Number 1
141+ toJSON (StUnknown x) = Number x
142+
143+ instance FromJSON SymbolTag where
144+ parseJSON (Number 1 ) = pure StDeprecated
145+ parseJSON (Number x) = pure (StUnknown x)
146+ parseJSON _ = mempty
126147
127148-- -------------------------------------
128149
@@ -142,18 +163,36 @@ data DocumentSymbolKindClientCapabilities =
142163
143164deriveJSON lspOptions ''DocumentSymbolKindClientCapabilities
144165
166+ data DocumentSymbolTagClientCapabilities =
167+ DocumentSymbolTagClientCapabilities
168+ { -- | The tags supported by the client.
169+ _valueSet :: Maybe (List SymbolTag )
170+ }
171+ deriving (Show , Read , Eq )
172+
173+ deriveJSON lspOptions ''DocumentSymbolTagClientCapabilities
174+
145175data DocumentSymbolClientCapabilities =
146176 DocumentSymbolClientCapabilities
147177 { -- | Whether document symbol supports dynamic registration.
148178 _dynamicRegistration :: Maybe Bool
149179 -- | Specific capabilities for the `SymbolKind`.
150180 , _symbolKind :: Maybe DocumentSymbolKindClientCapabilities
151181 , _hierarchicalDocumentSymbolSupport :: Maybe Bool
182+ -- | The client supports tags on `SymbolInformation`.
183+ -- Clients supporting tags have to handle unknown tags gracefully.
184+ --
185+ -- @since 3.16.0
186+ , _tagSupport :: Maybe DocumentSymbolTagClientCapabilities
187+ -- | The client supports an additional label presented in the UI when
188+ -- registering a document symbol provider.
189+ --
190+ -- @since 3.16.0
191+ , _labelSupport :: Maybe Bool
152192 } deriving (Show , Read , Eq )
153193
154194deriveJSON lspOptions ''DocumentSymbolClientCapabilities
155195
156-
157196-- ---------------------------------------------------------------------
158197
159198-- | Represents programming constructs like variables, classes, interfaces etc.
@@ -167,7 +206,8 @@ data DocumentSymbol =
167206 -- provided the name is used.
168207 , _detail :: Maybe Text
169208 , _kind :: SymbolKind -- ^ The kind of this symbol.
170- , _deprecated :: Maybe Bool -- ^ Indicates if this symbol is deprecated.
209+ , _tags :: Maybe (List SymbolTag ) -- ^ Tags for this document symbol.
210+ , _deprecated :: Maybe Bool -- ^ Indicates if this symbol is deprecated. Deprecated, use tags instead.
171211 -- | The range enclosing this symbol not including leading/trailing
172212 -- whitespace but everything else like comments. This information is
173213 -- typically used to determine if the the clients cursor is inside the symbol
@@ -190,7 +230,8 @@ data SymbolInformation =
190230 SymbolInformation
191231 { _name :: Text -- ^ The name of this symbol.
192232 , _kind :: SymbolKind -- ^ The kind of this symbol.
193- , _deprecated :: Maybe Bool -- ^ Indicates if this symbol is deprecated.
233+ , _tags :: Maybe (List SymbolTag ) -- ^ Tags for this symbol.
234+ , _deprecated :: Maybe Bool -- ^ Indicates if this symbol is deprecated. Deprecated, use tags instead.
194235 -- | The location of this symbol. The location's range is used by a tool
195236 -- to reveal the location in the editor. If the symbol is selected in the
196237 -- tool the range's start information is used to position the cursor. So
@@ -207,5 +248,6 @@ data SymbolInformation =
207248 -- symbols.
208249 , _containerName :: Maybe Text
209250 } deriving (Read ,Show ,Eq )
251+ {-# DEPRECATED _deprecated "Use tags instead" #-}
210252
211253deriveJSON lspOptions ''SymbolInformation
0 commit comments