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

Consider that the project has a type checker if sorbet-static is present as transitive dependency #2443

Merged
merged 1 commit into from
Aug 14, 2024
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 @@ -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
Loading