Skip to content

Commit

Permalink
Consider that the project has a type checker if sorbet-static is pr…
Browse files Browse the repository at this point in the history
…esent as transitive dependency (#2443)
  • Loading branch information
vinistock authored Aug 14, 2024
1 parent ae13598 commit 262c34b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ruby_lsp/global_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def apply_options(options)
@test_library = detect_test_library(direct_dependencies)
notifications << Notification.window_log_message("Detected test library: #{@test_library}")

@has_type_checker = detect_typechecker(direct_dependencies)
@has_type_checker = detect_typechecker(all_dependencies)
if @has_type_checker
notifications << Notification.window_log_message(
"Ruby LSP detected this is a Sorbet project and will defer to the Sorbet LSP for some functionality",
Expand Down
10 changes: 10 additions & 0 deletions test/global_state_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ def test_apply_options_sets_experimental_features
assert_predicate(state, :experimental_features)
end

def test_type_checker_is_detected_based_on_transitive_sorbet_static
state = GlobalState.new

Bundler.locked_gems.stubs(dependencies: {})
stub_all_dependencies("sorbet-static")
state.apply_options({ initializationOptions: {} })

assert_predicate(state, :has_type_checker)
end

private

def stub_direct_dependencies(dependencies)
Expand Down

0 comments on commit 262c34b

Please sign in to comment.