diff --git a/lib/ruby_lsp/global_state.rb b/lib/ruby_lsp/global_state.rb index df0eee261..004df40d9 100644 --- a/lib/ruby_lsp/global_state.rb +++ b/lib/ruby_lsp/global_state.rb @@ -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) } diff --git a/test/global_state_test.rb b/test/global_state_test.rb index 02dc0ee66..b655dcbfe 100644 --- a/test/global_state_test.rb +++ b/test/global_state_test.rb @@ -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)