Skip to content

Commit 2898689

Browse files
Update to upstream 2841d4ac
Breaking change to `ApplyKind` from LSP Spec
1 parent 55bbbff commit 2898689

File tree

2 files changed

+54
-42
lines changed

2 files changed

+54
-42
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
git+https://github.com/microsoft/lsprotocol@53a0c4910dd052fb6c9b1e35e7aaa170f270ce1b
1+
git+https://github.com/microsoft/lsprotocol@2841d4acfe5cd8eaef31658da50a838a0e92c0c7

src/lsprotocol/types.cr

Lines changed: 53 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3147,14 +3147,14 @@ module LSProtocol
31473147
# Specifies how fields from a completion item should be combined with those
31483148
# from `completionList.itemDefaults`.
31493149
#
3150-
# If unspecified, all fields will be treated as "replace".
3150+
# If unspecified, all fields will be treated as ApplyKind.Replace.
31513151
#
3152-
# If a field's value is "replace", the value from a completion item (if
3153-
# provided and not `null`) will always be used instead of the value from
3154-
# `completionItem.itemDefaults`.
3152+
# If a field's value is ApplyKind.Replace, the value from a completion item
3153+
# (if provided and not `null`) will always be used instead of the value
3154+
# from `completionItem.itemDefaults`.
31553155
#
3156-
# If a field's value is "merge", the values will be merged using the rules
3157-
# defined against each field below.
3156+
# If a field's value is ApplyKind.Merge, the values will be merged using
3157+
# the rules defined against each field below.
31583158
#
31593159
# Servers are only allowed to return `applyKind` if the client
31603160
# signals support for this via the `completionList.applyKindSupport`
@@ -3179,7 +3179,7 @@ module LSProtocol
31793179
# If a completion list specifies a default value and a completion item
31803180
# also specifies a corresponding value, the rules for combining these are
31813181
# defined by `applyKinds` (if the client supports it), defaulting to
3182-
# "replace".
3182+
# ApplyKind.Replace.
31833183
#
31843184
# Servers are only allowed to return default values if the client
31853185
# signals support for this via the `completionList.itemDefaults`
@@ -6469,7 +6469,7 @@ module LSProtocol
64696469
# If a completion list specifies a default value and a completion item
64706470
# also specifies a corresponding value, the rules for combining these are
64716471
# defined by `applyKinds` (if the client supports it), defaulting to
6472-
# "replace".
6472+
# ApplyKind.Replace.
64736473
#
64746474
# Servers are only allowed to return default values if the client
64756475
# signals support for this via the `completionList.itemDefaults`
@@ -6521,13 +6521,13 @@ module LSProtocol
65216521
# Specifies how fields from a completion item should be combined with those
65226522
# from `completionList.itemDefaults`.
65236523
#
6524-
# If unspecified, all fields will be treated as "replace".
6524+
# If unspecified, all fields will be treated as ApplyKind.Replace.
65256525
#
6526-
# If a field's value is "replace", the value from a completion item (if
6526+
# If a field's value is ApplyKind.Replace, the value from a completion item (if
65276527
# provided and not `null`) will always be used instead of the value from
65286528
# `completionItem.itemDefaults`.
65296529
#
6530-
# If a field's value is "merge", the values will be merged using the rules
6530+
# If a field's value is ApplyKind.Merge, the values will be merged using the rules
65316531
# defined against each field below.
65326532
#
65336533
# Servers are only allowed to return `applyKind` if the client
@@ -6541,15 +6541,15 @@ module LSProtocol
65416541
# Specifies whether commitCharacters on a completion will replace or be
65426542
# merged with those in `completionList.itemDefaults.commitCharacters`.
65436543
#
6544-
# If "replace", the commit characters from the completion item will
6544+
# If ApplyKind.Replace, the commit characters from the completion item will
65456545
# always be used unless not provided, in which case those from
65466546
# `completionList.itemDefaults.commitCharacters` will be used. An
65476547
# empty list can be used if a completion item does not have any commit
65486548
# characters and also should not use those from
65496549
# `completionList.itemDefaults.commitCharacters`.
65506550
#
6551-
# If "merge" the commitCharacters for the completion will be the union
6552-
# of all values in both `completionList.itemDefaults.commitCharacters`
6551+
# If ApplyKind.Merge the commitCharacters for the completion will be the
6552+
# union of all values in both `completionList.itemDefaults.commitCharacters`
65536553
# and the completion's own `commitCharacters`.
65546554
#
65556555
# @since 3.18.0
@@ -6559,13 +6559,13 @@ module LSProtocol
65596559
# Specifies whether the `data` field on a completion will replace or
65606560
# be merged with data from `completionList.itemDefaults.data`.
65616561
#
6562-
# If "replace", the data from the completion item will be used if
6562+
# If ApplyKind.Replace, the data from the completion item will be used if
65636563
# provided (and not `null`), otherwise
65646564
# `completionList.itemDefaults.data` will be used. An empty object can
65656565
# be used if a completion item does not have any data but also should
65666566
# not use the value from `completionList.itemDefaults.data`.
65676567
#
6568-
# If "merge", a shallow merge will be performed between
6568+
# If ApplyKind.Merge, a shallow merge will be performed between
65696569
# `completionList.itemDefaults.data` and the completion's own data
65706570
# using the following rules:
65716571
#
@@ -7800,6 +7800,11 @@ module LSProtocol
78007800
@[JSON::Field(key: "documentSymbol")]
78017801
getter document_symbol : DocumentSymbolClientCapabilities?
78027802

7803+
# Defines which filters the client supports.
7804+
#
7805+
# @since 3.18.0
7806+
getter filters : TextDocumentFilterClientCapabilities?
7807+
78037808
# Capabilities specific to the `textDocument/foldingRange` request.
78047809
#
78057810
# @since 3.10.0
@@ -7908,6 +7913,7 @@ module LSProtocol
79087913
@document_highlight : DocumentHighlightClientCapabilities? = nil,
79097914
@document_link : DocumentLinkClientCapabilities? = nil,
79107915
@document_symbol : DocumentSymbolClientCapabilities? = nil,
7916+
@filters : TextDocumentFilterClientCapabilities? = nil,
79117917
@folding_range : FoldingRangeClientCapabilities? = nil,
79127918
@formatting : DocumentFormattingClientCapabilities? = nil,
79137919
@hover : HoverClientCapabilities? = nil,
@@ -8138,7 +8144,9 @@ module LSProtocol
81388144

81398145
# A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
81408146
#
8141-
# @since 3.18.0 - support for relative patterns.
8147+
# @since 3.18.0 - support for relative patterns. Whether clients support
8148+
# relative patterns depends on the client capability
8149+
# `textDocuments.filters.relativePatternSupport`.
81428150
getter pattern : GlobPattern?
81438151

81448152
# A Uri `Uri#scheme`, like `file` or `untitled`.
@@ -8163,7 +8171,9 @@ module LSProtocol
81638171

81648172
# A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
81658173
#
8166-
# @since 3.18.0 - support for relative patterns.
8174+
# @since 3.18.0 - support for relative patterns. Whether clients support
8175+
# relative patterns depends on the client capability
8176+
# `textDocuments.filters.relativePatternSupport`.
81678177
getter pattern : GlobPattern?
81688178

81698179
# A Uri `Uri#scheme`, like `file` or `untitled`.
@@ -8188,7 +8198,9 @@ module LSProtocol
81888198

81898199
# A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples.
81908200
#
8191-
# @since 3.18.0 - support for relative patterns.
8201+
# @since 3.18.0 - support for relative patterns. Whether clients support
8202+
# relative patterns depends on the client capability
8203+
# `textDocuments.filters.relativePatternSupport`.
81928204
getter pattern : GlobPattern
81938205

81948206
# A Uri `Uri#scheme`, like `file` or `untitled`.
@@ -8677,6 +8689,21 @@ module LSProtocol
86778689
end
86788690
end
86798691

8692+
class TextDocumentFilterClientCapabilities
8693+
include JSON::Serializable
8694+
8695+
# The client supports Relative Patterns.
8696+
#
8697+
# @since 3.18.0
8698+
@[JSON::Field(key: "relativePatternSupport")]
8699+
getter relative_pattern_support : Bool?
8700+
8701+
def initialize(
8702+
@relative_pattern_support : Bool? = nil,
8703+
)
8704+
end
8705+
end
8706+
86808707
# Completion client capabilities
86818708
class CompletionClientCapabilities
86828709
include JSON::Serializable
@@ -11457,42 +11484,27 @@ module LSProtocol
1145711484
# merged.
1145811485
#
1145911486
# @since 3.18.0
11460-
enum ApplyKind
11487+
enum ApplyKind : UInt32
1146111488
# The value from the individual item (if provided and not `null`) will be
1146211489
# used instead of the default.
11463-
Replace
11490+
Replace = 1
1146411491

1146511492
# The value from the item will be merged with the default.
1146611493
#
1146711494
# The specific rules for mergeing values are defined against each field
1146811495
# that supports merging.
11469-
Merge
11496+
Merge = 2
1147011497

1147111498
def self.new(pull : JSON::PullParser) : self
1147211499
self.from_json(pull)
1147311500
end
1147411501

1147511502
def self.from_json(pull : JSON::PullParser) : self
11476-
case pull.kind
11477-
when .int?
11478-
from_value(pull.read_int)
11479-
when .string?
11480-
parse(pull.read_string)
11481-
else
11482-
{% if @type.annotation(Flags) %}
11483-
pull.raise "Expecting int, string or array in JSON for #{self.class}, not #{pull.kind}"
11484-
{% else %}
11485-
pull.raise "Expecting int or string in JSON for #{self.class}, not #{pull.kind}"
11486-
{% end %}
11487-
end
11488-
end
11489-
11490-
def to_json(builder : JSON::Builder)
11491-
builder.string self.to_s
11503+
self.from_value?(pull.read_int) || pull.raise "Unknown enum #{self} value: #{pull.int_value}"
1149211504
end
1149311505

11494-
def to_s(io : IO) : Nil
11495-
io << self.to_s
11506+
def to_json(json : JSON::Builder)
11507+
json.number(value)
1149611508
end
1149711509
end
1149811510

@@ -11839,7 +11851,7 @@ module LSProtocol
1183911851
# A document filter describes a top level text document or
1184011852
# a notebook cell document.
1184111853
#
11842-
# @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
11854+
# @since 3.17.0 - support for NotebookCellTextDocumentFilter.
1184311855
alias DocumentFilter = NotebookCellTextDocumentFilter | TextDocumentFilter
1184411856

1184511857
# LSP object definition.

0 commit comments

Comments
 (0)