Skip to content
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: 0 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Sorbet/TrueSigil:
- "test/**/*.rb"
- "lib/ruby_indexer/test/**/*.rb"
- "lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb"
- "lib/ruby_lsp/load_sorbet.rb"
- "lib/ruby_lsp/scripts/compose_bundle.rb"
- "lib/ruby_lsp/test_reporters/test_unit_reporter.rb"
Exclude:
Expand All @@ -64,7 +63,6 @@ Sorbet/StrictSigil:
- "lib/ruby_indexer/test/**/*.rb"
- "lib/ruby-lsp.rb"
- "lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb"
- "lib/ruby_lsp/load_sorbet.rb"
- "lib/ruby_lsp/scripts/compose_bundle.rb"
- "lib/ruby_lsp/test_helper.rb"
- "lib/ruby_lsp/test_reporters/test_unit_reporter.rb"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ group :development do

platforms :ruby do # C Ruby (MRI), Rubinius or TruffleRuby, but NOT Windows
# sorbet-static is not available on Windows. We also skip Tapioca since it depends on sorbet-static-and-runtime
gem "sorbet-static-and-runtime"
gem "sorbet-static"
gem "tapioca", "~> 0.16", require: false
end
end
3 changes: 1 addition & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ PATH
language_server-protocol (~> 3.17.0)
prism (>= 1.2, < 2.0)
rbs (>= 3, < 5)
sorbet-runtime (>= 0.5.10782)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -146,7 +145,7 @@ DEPENDENCIES
rubocop-shopify (~> 2.15)
rubocop-sorbet (~> 0.8)
ruby-lsp!
sorbet-static-and-runtime
sorbet-static
syntax_tree (>= 6.1.1, < 7)
tapioca (~> 0.16)
test-unit
Expand Down
3 changes: 0 additions & 3 deletions exe/ruby-lsp
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ end

$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))

require "ruby_lsp/load_sorbet"
require "ruby_lsp/internal"

T::Utils.run_all_sig_blocks

if options[:debug]
if ["x64-mingw-ucrt", "x64-mingw32"].include?(RUBY_PLATFORM)
$stderr.puts "Debugging is not supported on Windows"
Expand Down
4 changes: 0 additions & 4 deletions exe/ruby-lsp-check
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@

# This executable checks if all automatic LSP requests run successfully on every Ruby file under the current directory

require "ruby_lsp/load_sorbet"

$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "ruby_lsp/internal"

T::Utils.run_all_sig_blocks

files = Dir.glob("#{Dir.pwd}/**/*.rb")

puts "Verifying that all automatic LSP requests execute successfully. This may take a while..."
Expand Down
3 changes: 0 additions & 3 deletions exe/ruby-lsp-launcher
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,8 @@ end
# Now that the bundle is set up, we can begin actually launching the server. Note that `Bundler.setup` will have already
# configured the load path using the version of the Ruby LSP present in the composed bundle. Do not push any Ruby LSP
# paths into the load path manually or we may end up requiring the wrong version of the gem
require "ruby_lsp/load_sorbet"
require "ruby_lsp/internal"

T::Utils.run_all_sig_blocks

if ARGV.include?("--debug")
if ["x64-mingw-ucrt", "x64-mingw32"].include?(RUBY_PLATFORM)
$stderr.puts "Debugging is not supported on Windows"
Expand Down
1 change: 0 additions & 1 deletion lib/rubocop/cop/ruby_lsp/use_language_server_aliases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# frozen_string_literal: true

require "rubocop"
require "sorbet-runtime"

module RuboCop
module Cop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# frozen_string_literal: true

require "rubocop"
require "sorbet-runtime"

module RuboCop
module Cop
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_indexer/test/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_load_configuration_executes_configure_block
assert(uris.none? { |uri| uri.full_path.include?("test/fixtures") })
assert(uris.none? { |uri| uri.full_path.include?(bundle_path.join("minitest-reporters").to_s) })
assert(uris.none? { |uri| uri.full_path.include?(bundle_path.join("ansi").to_s) })
assert(uris.any? { |uri| uri.full_path.include?(bundle_path.join("sorbet-runtime").to_s) })
assert(uris.any? { |uri| uri.full_path.include?(bundle_path.join("prism").to_s) })
assert(uris.none? { |uri| uri.full_path == __FILE__ })
end

Expand Down
5 changes: 1 addition & 4 deletions lib/ruby_lsp/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ module RubyLsp
# @abstract
#: [ParseResultType]
class Document
extend T::Generic

class InvalidLocationError < StandardError; end

# This maximum number of characters for providing expensive features, like semantic highlighting and diagnostics.
# This is the same number used by the TypeScript extension in VS Code
MAXIMUM_CHARACTERS_FOR_EXPENSIVE_FEATURES = 100_000
Expand Down Expand Up @@ -177,8 +176,6 @@ class Delete < Edit; end
# See https://microsoft.github.io/language-server-protocol/specification/#positionEncodingKind for more information
# @abstract
class Scanner
extend T::Sig

LINE_BREAK = 0x0A #: Integer
# After character 0xFFFF, UTF-16 considers characters to have length 2 and we have to account for that
SURROGATE_PAIR_START = 0xFFFF #: Integer
Expand Down
2 changes: 0 additions & 2 deletions lib/ruby_lsp/internal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
yarp_require_paths = Gem.loaded_specs["yarp"]&.full_require_paths
$LOAD_PATH.delete_if { |path| yarp_require_paths.include?(path) } if yarp_require_paths

require "sorbet-runtime"

# Set Bundler's UI level to silent as soon as possible to prevent any prints to STDOUT
require "bundler"
Bundler.ui.level = :silent
Expand Down
62 changes: 0 additions & 62 deletions lib/ruby_lsp/load_sorbet.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/ruby_lsp/response_builders/response_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module RubyLsp
module ResponseBuilders
# @abstract
class ResponseBuilder
extend T::Generic

# @abstract
#: -> top
def response; end
Expand Down
20 changes: 8 additions & 12 deletions lib/ruby_lsp/setup_bundler.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# typed: strict
# frozen_string_literal: true

require "sorbet-runtime"
require "bundler"
require "bundler/cli"
require "bundler/cli/install"
Expand All @@ -20,11 +19,16 @@

module RubyLsp
class SetupBundler
extend T::Sig

class BundleNotLocked < StandardError; end
class BundleInstallFailure < StandardError; end

module ThorPatch
#: -> IO
def stdout
$stderr
end
end

FOUR_HOURS = 4 * 60 * 60 #: Integer

#: (String project_path, **untyped options) -> void
Expand Down Expand Up @@ -440,15 +444,7 @@ def rails_app?
def patch_thor_to_print_progress_to_stderr!
return unless defined?(Bundler::Thor::Shell::Basic)

Bundler::Thor::Shell::Basic.prepend(Module.new do
extend T::Sig

sig { returns(IO) }
def stdout
$stderr
end
end)

Bundler::Thor::Shell::Basic.prepend(ThorPatch)
Bundler.ui.level = :info
end
end
Expand Down
1 change: 0 additions & 1 deletion rakelib/index.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "sorbet-runtime"
require "ruby_lsp/internal"

# Based on https://github.com/ruby/prism/blob/main/rakelib/lex.rake
Expand Down
1 change: 0 additions & 1 deletion ruby-lsp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Gem::Specification.new do |s|
s.add_dependency("language_server-protocol", "~> 3.17.0")
s.add_dependency("prism", ">= 1.2", "< 2.0")
s.add_dependency("rbs", ">= 3", "< 5")
s.add_dependency("sorbet-runtime", ">= 0.5.10782")

s.required_ruby_version = ">= 3.0"
end
24 changes: 2 additions & 22 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# typed: strict
# frozen_string_literal: true

require "sorbet-runtime"

ENV["RUBY_LSP_ENV"] = "test"

$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
Expand All @@ -18,19 +16,8 @@
require "tempfile"
require "mocha/minitest"

# Do not require minitest-reporters when running tests via the Ruby LSP's test explorer. Invoking
# `Minitest::Reporters.use!` overrides our reporter customizations and breaks the integrations.
#
# We also don't need debug related things
unless ENV["RUBY_LSP_TEST_RUNNER"]
SORBET_PATHS = Gem.loaded_specs["sorbet-runtime"].full_require_paths.freeze #: Array[String]

# Define breakpoint methods without actually activating the debugger
require "debug/prelude"
# Load the debugger configuration to skip Sorbet paths. But this still doesn't activate the debugger
require "debug/config"
DEBUGGER__::CONFIG[:skip_path] = Array(DEBUGGER__::CONFIG[:skip_path]) + SORBET_PATHS
end
# Define breakpoint methods without actually activating the debugger
require "debug/prelude"

module Minitest
class Test
Expand All @@ -39,10 +26,3 @@ class Test
Minitest::Test.make_my_diffs_pretty!
end
end

begin
require "spoom/backtrace_filter/minitest"
Minitest.backtrace_filter = Spoom::BacktraceFilter::Minitest.new
rescue LoadError
# Tapioca (and thus Spoom) is not available on Windows
end
1 change: 0 additions & 1 deletion vscode/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ export class Workspace implements WorkspaceInterface {
"language_server-protocol",
"prism",
"rbs",
"sorbet-runtime",
];

const { stdout } = await asyncExec(`gem list ${dependencies.join(" ")}`, {
Expand Down
Loading