Conversation
When `enabledFeatures` is an array, absent features resolve to `false` and are passed as-is to `Interface::ServerCapabilities.new`. The test asserted the exact number of keys, relying on language_server-protocol dropping `false` values from the serialized capabilities. A future version of the language_server-protocol gem will keep `false` for optional properties and only omit `nil`, which is valid per the specification but changes the number of keys. Count only the capabilities that are not `false` so the test passes with either behavior.
mtsmfm
force-pushed
the
count-enabled-capabilities
branch
from
September 17, 2026 03:17
4445f4c to
1267727
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Hi! Thank you for maintaining this great project.
LSP 3.18 is no longer marked as under development (microsoft/language-server-protocol@9b3b38b), so I'm updating the language_server-protocol gem to 3.18. Here is the work in progress: mtsmfm/language_server-protocol-ruby#151
While doing that, I'm considering taking the opportunity to fix a long-standing behavior that was my own mistake in the gem, and I'd like to hear your thoughts.
Currently, passing
falseexplicitly to an optional interface property is treated the same as not passing it at all:I'd like to change the result to
{"definitionProvider":false}.For capability flags such as
definitionProvider,falseand an omitted key mean the same thing, so I don't expect any runtime impact there. However, the specification does have optional boolean properties where an explicitfalsecarries meaning, e.g.WorkDoneProgressReport.cancellable(omitted: leave the cancel button as is,false: disable it) andExecutionSummary.success(omitted: unknown,false: failed). These have existed since 3.17, so the gem has been silently dropping those values. As a gem behavior, I believe an explicitfalseshould be respected. None of the major dependents pass these properties through the gem's interfaces today, so nothing changes for them in practice.I ran the test suites of the major dependents (ruby-lsp, rubocop, steep, standard) against the 3.18 branch, and
test_initialize_enabled_features_with_arrayis the only failure.I'm planning to release a pre-release version of 3.18 first just in case. Please let me know if you have any concerns.
Implementation
test_initialize_enabled_features_with_arrayasserts the exact number of keys in the serialized capabilities. WithenabledFeaturesgiven as an array, disabled features resolve tofalse(viaHash.new(false)inServer#run_initialize) and are passed straight toInterface::ServerCapabilities.new. With the 3.18 gem thosefalsevalues are kept, so the key count grows from 5 to 10.This PR makes the test count only the enabled capabilities, so it passes with both the current and the upcoming gem version.
Automated Tests
This PR only changes an existing test. I ran
test/server_test.rbagainst both language_server-protocol 3.17.0.5 and the 3.18 branch, and it passes with both.Manual Tests
No manual testing is needed since only a test is changed.
Note that even after the new SDK gem version is released, the current gemspec (
~> 3.17.0) won't allow installing 3.18, so the runtime behavior of the Ruby LSP is unaffected until the dependency is bumped:ruby-lsp/ruby-lsp.gemspec
Line 24 in 7111db0