Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make enabled_feature? return true when all flags are enabled #2900

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ruby_lsp/global_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def apply_options(options)

sig { params(flag: Symbol).returns(T.nilable(T::Boolean)) }
def enabled_feature?(flag)
@enabled_feature_flags[flag]
@enabled_feature_flags[:all] || @enabled_feature_flags[flag]
end

sig { returns(String) }
Expand Down
14 changes: 14 additions & 0 deletions test/global_state_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,20 @@ def test_feature_flags_are_processed_by_apply_options
assert_nil(state.enabled_feature?(:unknown_flag))
end

def test_enabled_feature_always_returns_true_if_all_are_enabled
state = GlobalState.new

state.apply_options({
initializationOptions: {
enabledFeatureFlags: {
all: true,
},
},
})

assert(state.enabled_feature?(:whatever))
end

private

def stub_direct_dependencies(dependencies)
Expand Down
Loading