Skip to content

Commit b5e2040

Browse files
committed
Consider that the project has a type checker if sorbet-static is present as transitive dependency
1 parent 6c4702c commit b5e2040

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/ruby_lsp/global_state.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def apply_options(options)
9393
@test_library = detect_test_library(direct_dependencies)
9494
notifications << Notification.window_log_message("Detected test library: #{@test_library}")
9595

96-
@has_type_checker = detect_typechecker(direct_dependencies)
96+
@has_type_checker = detect_typechecker(all_dependencies)
9797
if @has_type_checker
9898
notifications << Notification.window_log_message(
9999
"Ruby LSP detected this is a Sorbet project and will defer to the Sorbet LSP for some functionality",

test/global_state_test.rb

+10
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@ def test_apply_options_sets_experimental_features
199199
assert_predicate(state, :experimental_features)
200200
end
201201

202+
def test_type_checker_is_detected_based_on_transitive_sorbet_static
203+
state = GlobalState.new
204+
205+
Bundler.locked_gems.stubs(dependencies: {})
206+
stub_all_dependencies("sorbet-static")
207+
state.apply_options({ initializationOptions: {} })
208+
209+
assert_predicate(state, :has_type_checker)
210+
end
211+
202212
private
203213

204214
def stub_direct_dependencies(dependencies)

0 commit comments

Comments
 (0)