Skip to content

Commit 424bcf9

Browse files
authored
Upgrade to Ruby LSP v0.10.0 (#149)
* Upgrade ruby-lsp requirement to v0.10.0 * Re-generate ruby-lsp and yarp RBIs * Use _response for listeners * Bump cache version
1 parent 06c170a commit 424bcf9

File tree

9 files changed

+14128
-595
lines changed

9 files changed

+14128
-595
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
ruby-version: ${{ matrix.ruby }}
2525
bundler-cache: true
26-
cache-version: 3
26+
cache-version: 4
2727

2828
- name: Check if documentation is up to date
2929
run: bundle exec rake ruby_lsp:check_docs

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ PATH
104104
specs:
105105
ruby-lsp-rails (0.2.4)
106106
rails (>= 6.0)
107-
ruby-lsp (>= 0.9.1, < 0.11.0)
107+
ruby-lsp (>= 0.10.0, < 0.11.0)
108108
sorbet-runtime (>= 0.5.9897)
109109

110110
GEM

lib/ruby_lsp/ruby_lsp_rails/code_lens.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ class CodeLens < ::RubyLsp::Listener
4040
BASE_COMMAND = "bin/rails test"
4141

4242
sig { override.returns(ResponseType) }
43-
attr_reader :response
43+
attr_reader :_response
4444

4545
sig { params(uri: URI::Generic, emitter: EventEmitter, message_queue: Thread::Queue).void }
4646
def initialize(uri, emitter, message_queue)
47-
@response = T.let([], ResponseType)
47+
@_response = T.let([], ResponseType)
4848
@path = T.let(uri.to_standardized_path, T.nilable(String))
4949
emitter.register(self, :on_command, :on_class, :on_def)
5050

@@ -121,23 +121,23 @@ def add_test_code_lens(node, name:, command:, kind:)
121121
},
122122
]
123123

124-
@response << create_code_lens(
124+
@_response << create_code_lens(
125125
node,
126126
title: "Run",
127127
command_name: "rubyLsp.runTest",
128128
arguments: arguments,
129129
data: { type: "test", kind: kind },
130130
)
131131

132-
@response << create_code_lens(
132+
@_response << create_code_lens(
133133
node,
134134
title: "Run In Terminal",
135135
command_name: "rubyLsp.runTestInTerminal",
136136
arguments: arguments,
137137
data: { type: "test_in_terminal", kind: kind },
138138
)
139139

140-
@response << create_code_lens(
140+
@_response << create_code_lens(
141141
node,
142142
title: "Debug",
143143
command_name: "rubyLsp.debugTest",

lib/ruby_lsp/ruby_lsp_rails/hover.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ class Hover < ::RubyLsp::Listener
2323
ResponseType = type_member { { fixed: T.nilable(::RubyLsp::Interface::Hover) } }
2424

2525
sig { override.returns(ResponseType) }
26-
attr_reader :response
26+
attr_reader :_response
2727

2828
sig { params(client: RailsClient, emitter: RubyLsp::EventEmitter, message_queue: Thread::Queue).void }
2929
def initialize(client, emitter, message_queue)
3030
super(emitter, message_queue)
3131

32-
@response = T.let(nil, ResponseType)
32+
@_response = T.let(nil, ResponseType)
3333
@client = client
3434
emitter.register(self, :on_const, :on_command, :on_const_path_ref, :on_call)
3535
end
@@ -46,26 +46,26 @@ def on_const(node)
4646
end
4747
content << model[:columns].map { |name, type| "**#{name}**: #{type}\n" }.join("\n")
4848
contents = RubyLsp::Interface::MarkupContent.new(kind: "markdown", value: content)
49-
@response = RubyLsp::Interface::Hover.new(range: range_from_syntax_tree_node(node), contents: contents)
49+
@_response = RubyLsp::Interface::Hover.new(range: range_from_syntax_tree_node(node), contents: contents)
5050
end
5151

5252
sig { params(node: SyntaxTree::Command).void }
5353
def on_command(node)
5454
message = node.message
55-
@response = generate_rails_document_link_hover(message.value, message)
55+
@_response = generate_rails_document_link_hover(message.value, message)
5656
end
5757

5858
sig { params(node: SyntaxTree::ConstPathRef).void }
5959
def on_const_path_ref(node)
60-
@response = generate_rails_document_link_hover(full_constant_name(node), node)
60+
@_response = generate_rails_document_link_hover(full_constant_name(node), node)
6161
end
6262

6363
sig { params(node: SyntaxTree::CallNode).void }
6464
def on_call(node)
6565
message = node.message
6666
return if message.is_a?(Symbol)
6767

68-
@response = generate_rails_document_link_hover(message.value, message)
68+
@_response = generate_rails_document_link_hover(message.value, message)
6969
end
7070

7171
private

ruby-lsp-rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
2222
end
2323

2424
spec.add_dependency("rails", ">= 6.0")
25-
spec.add_dependency("ruby-lsp", ">= 0.9.1", "< 0.11.0")
25+
spec.add_dependency("ruby-lsp", ">= 0.10.0", "< 0.11.0")
2626
spec.add_dependency("sorbet-runtime", ">= 0.5.9897")
2727
end

sorbet/rbi/gems/[email protected]

Lines changed: 0 additions & 272 deletions
This file was deleted.

0 commit comments

Comments
 (0)