ruby-lsp 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -101,15 +101,15 @@ module RubyLsp
101
101
  def add_edit_with_text(text)
102
102
  position = Interface::Position.new(
103
103
  line: @position[:line],
104
- character: @position[:character]
104
+ character: @position[:character],
105
105
  )
106
106
 
107
107
  @edits << Interface::TextEdit.new(
108
108
  range: Interface::Range.new(
109
109
  start: position,
110
- end: position
110
+ end: position,
111
111
  ),
112
- new_text: text
112
+ new_text: text,
113
113
  )
114
114
  end
115
115
 
@@ -117,7 +117,7 @@ module RubyLsp
117
117
  def move_cursor_to(line, character)
118
118
  position = Interface::Position.new(
119
119
  line: line,
120
- character: character
120
+ character: character,
121
121
  )
122
122
 
123
123
  # The $0 is a special snippet anchor that moves the cursor to that given position. See the snippets
@@ -126,9 +126,9 @@ module RubyLsp
126
126
  @edits << Interface::TextEdit.new(
127
127
  range: Interface::Range.new(
128
128
  start: position,
129
- end: position
129
+ end: position,
130
130
  ),
131
- new_text: "$0"
131
+ new_text: "$0",
132
132
  )
133
133
  end
134
134
 
@@ -70,13 +70,13 @@ module RubyLsp
70
70
 
71
71
  sig { override.returns(T.all(T::Array[Support::SelectionRange], Object)) }
72
72
  def run
73
- visit(@document.tree)
73
+ visit(@document.tree) if @document.parsed?
74
74
  @ranges.reverse!
75
75
  end
76
76
 
77
77
  private
78
78
 
79
- sig { params(node: T.nilable(SyntaxTree::Node)).void }
79
+ sig { override.params(node: T.nilable(SyntaxTree::Node)).void }
80
80
  def visit(node)
81
81
  return if node.nil?
82
82
 
@@ -93,7 +93,7 @@ module RubyLsp
93
93
  sig do
94
94
  params(
95
95
  location: SyntaxTree::Location,
96
- parent: T.nilable(Support::SelectionRange)
96
+ parent: T.nilable(Support::SelectionRange),
97
97
  ).returns(Support::SelectionRange)
98
98
  end
99
99
  def create_selection_range(location, parent = nil)
@@ -108,7 +108,7 @@ module RubyLsp
108
108
  character: location.end_column,
109
109
  ),
110
110
  ),
111
- parent: parent
111
+ parent: parent,
112
112
  )
113
113
  end
114
114
  end
@@ -90,22 +90,19 @@ module RubyLsp
90
90
  T.any(
91
91
  LanguageServer::Protocol::Interface::SemanticTokens,
92
92
  T.all(T::Array[SemanticToken], Object),
93
- )
93
+ ),
94
94
  )
95
95
  end
96
96
  def run
97
+ return @tokens unless @document.parsed?
98
+
97
99
  visit(@tree)
98
100
  return @tokens unless @encoder
99
101
 
100
102
  @encoder.encode(@tokens)
101
103
  end
102
104
 
103
- sig { params(node: SyntaxTree::ARefField).void }
104
- def visit_a_ref_field(node)
105
- add_token(node.collection.value.location, :variable)
106
- end
107
-
108
- sig { params(node: SyntaxTree::Call).void }
105
+ sig { override.params(node: SyntaxTree::Call).void }
109
106
  def visit_call(node)
110
107
  visit(node.receiver)
111
108
 
@@ -115,32 +112,32 @@ module RubyLsp
115
112
  visit(node.arguments)
116
113
  end
117
114
 
118
- sig { params(node: SyntaxTree::Command).void }
115
+ sig { override.params(node: SyntaxTree::Command).void }
119
116
  def visit_command(node)
120
117
  add_token(node.message.location, :method) unless special_method?(node.message.value)
121
118
  visit(node.arguments)
122
119
  end
123
120
 
124
- sig { params(node: SyntaxTree::CommandCall).void }
121
+ sig { override.params(node: SyntaxTree::CommandCall).void }
125
122
  def visit_command_call(node)
126
123
  visit(node.receiver)
127
124
  add_token(node.message.location, :method)
128
125
  visit(node.arguments)
129
126
  end
130
127
 
131
- sig { params(node: SyntaxTree::Const).void }
128
+ sig { override.params(node: SyntaxTree::Const).void }
132
129
  def visit_const(node)
133
130
  add_token(node.location, :namespace)
134
131
  end
135
132
 
136
- sig { params(node: SyntaxTree::Def).void }
133
+ sig { override.params(node: SyntaxTree::Def).void }
137
134
  def visit_def(node)
138
135
  add_token(node.name.location, :method, [:declaration])
139
136
  visit(node.params)
140
137
  visit(node.bodystmt)
141
138
  end
142
139
 
143
- sig { params(node: SyntaxTree::DefEndless).void }
140
+ sig { override.params(node: SyntaxTree::DefEndless).void }
144
141
  def visit_def_endless(node)
145
142
  add_token(node.name.location, :method, [:declaration])
146
143
  visit(node.paren)
@@ -148,7 +145,7 @@ module RubyLsp
148
145
  visit(node.statement)
149
146
  end
150
147
 
151
- sig { params(node: SyntaxTree::Defs).void }
148
+ sig { override.params(node: SyntaxTree::Defs).void }
152
149
  def visit_defs(node)
153
150
  visit(node.target)
154
151
  visit(node.operator)
@@ -157,13 +154,13 @@ module RubyLsp
157
154
  visit(node.bodystmt)
158
155
  end
159
156
 
160
- sig { params(node: SyntaxTree::FCall).void }
157
+ sig { override.params(node: SyntaxTree::FCall).void }
161
158
  def visit_fcall(node)
162
159
  add_token(node.value.location, :method) unless special_method?(node.value.value)
163
160
  visit(node.arguments)
164
161
  end
165
162
 
166
- sig { params(node: SyntaxTree::Kw).void }
163
+ sig { override.params(node: SyntaxTree::Kw).void }
167
164
  def visit_kw(node)
168
165
  case node.value
169
166
  when "self"
@@ -171,14 +168,7 @@ module RubyLsp
171
168
  end
172
169
  end
173
170
 
174
- sig { params(node: SyntaxTree::MAssign).void }
175
- def visit_m_assign(node)
176
- node.target.parts.each do |var_ref|
177
- add_token(var_ref.value.location, :variable)
178
- end
179
- end
180
-
181
- sig { params(node: SyntaxTree::Params).void }
171
+ sig { override.params(node: SyntaxTree::Params).void }
182
172
  def visit_params(node)
183
173
  node.keywords.each do |keyword,|
184
174
  location = keyword.location
@@ -196,7 +186,7 @@ module RubyLsp
196
186
  add_token(name.location, :variable) if name
197
187
  end
198
188
 
199
- sig { params(node: SyntaxTree::VarField).void }
189
+ sig { override.params(node: SyntaxTree::VarField).void }
200
190
  def visit_var_field(node)
201
191
  case node.value
202
192
  when SyntaxTree::Ident
@@ -206,7 +196,7 @@ module RubyLsp
206
196
  end
207
197
  end
208
198
 
209
- sig { params(node: SyntaxTree::VarRef).void }
199
+ sig { override.params(node: SyntaxTree::VarRef).void }
210
200
  def visit_var_ref(node)
211
201
  case node.value
212
202
  when SyntaxTree::Ident
@@ -216,19 +206,19 @@ module RubyLsp
216
206
  end
217
207
  end
218
208
 
219
- sig { params(node: SyntaxTree::VCall).void }
209
+ sig { override.params(node: SyntaxTree::VCall).void }
220
210
  def visit_vcall(node)
221
211
  add_token(node.value.location, :method) unless special_method?(node.value.value)
222
212
  end
223
213
 
224
- sig { params(node: SyntaxTree::ClassDeclaration).void }
214
+ sig { override.params(node: SyntaxTree::ClassDeclaration).void }
225
215
  def visit_class(node)
226
216
  add_token(node.constant.location, :class, [:declaration])
227
217
  add_token(node.superclass.location, :class) if node.superclass
228
218
  visit(node.bodystmt)
229
219
  end
230
220
 
231
- sig { params(node: SyntaxTree::ModuleDeclaration).void }
221
+ sig { override.params(node: SyntaxTree::ModuleDeclaration).void }
232
222
  def visit_module(node)
233
223
  add_token(node.constant.location, :class, [:declaration])
234
224
  visit(node.bodystmt)
@@ -243,8 +233,8 @@ module RubyLsp
243
233
  location: location,
244
234
  length: length,
245
235
  type: T.must(TOKEN_TYPES[type]),
246
- modifier: modifiers_indices
247
- )
236
+ modifier: modifiers_indices,
237
+ ),
248
238
  )
249
239
  end
250
240
 
@@ -0,0 +1,114 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "net/http"
5
+
6
+ module RubyLsp
7
+ module Requests
8
+ module Support
9
+ class RailsDocumentClient
10
+ RAILS_DOC_HOST = "https://api.rubyonrails.org"
11
+ SUPPORTED_RAILS_DOC_NAMESPACES = T.let(
12
+ Regexp.union(
13
+ /ActionDispatch/, /ActionController/, /AbstractController/, /ActiveRecord/, /ActiveModel/, /ActiveStorage/,
14
+ /ActionText/, /ActiveJob/
15
+ ).freeze,
16
+ Regexp,
17
+ )
18
+
19
+ RAILTIES_VERSION = T.let(
20
+ [*::Gem::Specification.default_stubs, *::Gem::Specification.stubs].find do |s|
21
+ s.name == "railties"
22
+ end&.version&.to_s, T.nilable(String)
23
+ )
24
+
25
+ class << self
26
+ extend T::Sig
27
+ sig do
28
+ params(name: String).returns(T::Array[String])
29
+ end
30
+ def generate_rails_document_urls(name)
31
+ docs = T.must(search_index)[name]
32
+
33
+ return [] unless docs
34
+
35
+ docs.map do |doc|
36
+ owner = doc[:owner]
37
+
38
+ link_name =
39
+ # class/module name
40
+ if owner == name
41
+ name
42
+ else
43
+ "#{owner}##{name}"
44
+ end
45
+
46
+ "[Rails Document: `#{link_name}`](#{doc[:url]})"
47
+ end
48
+ end
49
+
50
+ sig { returns(T.nilable(T::Hash[String, T::Array[T::Hash[Symbol, String]]])) }
51
+ private def search_index
52
+ @rails_documents ||= T.let(
53
+ build_search_index,
54
+ T.nilable(T::Hash[String, T::Array[T::Hash[Symbol, String]]]),
55
+ )
56
+ end
57
+
58
+ sig { returns(T.nilable(T::Hash[String, T::Array[T::Hash[Symbol, String]]])) }
59
+ private def build_search_index
60
+ return unless RAILTIES_VERSION
61
+
62
+ $stderr.puts "Fetching Rails Documents..."
63
+ # If the version's doc is not found, e.g. Rails main, it'll be redirected
64
+ # In this case, we just fetch the latest doc
65
+ response = if Gem::Version.new(RAILTIES_VERSION).prerelease?
66
+ Net::HTTP.get_response(URI("#{RAILS_DOC_HOST}/js/search_index.js"))
67
+ else
68
+ Net::HTTP.get_response(URI("#{RAILS_DOC_HOST}/v#{RAILTIES_VERSION}/js/search_index.js"))
69
+ end
70
+
71
+ if response.code == "200"
72
+ process_search_index(response.body)
73
+ else
74
+ $stderr.puts("Response failed: #{response.inspect}")
75
+ nil
76
+ end
77
+ rescue StandardError => e
78
+ $stderr.puts("Exception occurred when fetching Rails document index: #{e.inspect}")
79
+ end
80
+
81
+ sig { params(js: String).returns(T::Hash[String, T::Array[T::Hash[Symbol, String]]]) }
82
+ private def process_search_index(js)
83
+ raw_data = js.sub("var search_data = ", "")
84
+ info = JSON.parse(raw_data).dig("index", "info")
85
+
86
+ # An entry looks like this:
87
+ #
88
+ # ["belongs_to", # method or module/class
89
+ # "ActiveRecord::Associations::ClassMethods", # method owner
90
+ # "classes/ActiveRecord/Associations/ClassMethods.html#method-i-belongs_to", # path to the document
91
+ # "(name, scope = nil, **options)", # method's parameters
92
+ # "<p>Specifies a one-to-one association with another class..."] # document preview
93
+ #
94
+ info.each_with_object({}) do |(method_or_class, method_owner, doc_path, _, doc_preview), table|
95
+ # If a method doesn't have documentation, there's no need to generate the link to it.
96
+ next if doc_preview.nil? || doc_preview.empty?
97
+
98
+ # If the method or class/module is not from the supported namespace, reject it
99
+ next unless [method_or_class, method_owner].any? do |elem|
100
+ elem.match?(SUPPORTED_RAILS_DOC_NAMESPACES)
101
+ end
102
+
103
+ owner = method_owner.empty? ? method_or_class : method_owner
104
+ table[method_or_class] ||= []
105
+ # It's possible to have multiple modules defining the same method name. For example,
106
+ # both `ActiveRecord::FinderMethods` and `ActiveRecord::Associations::CollectionProxy` defines `#find`
107
+ table[method_or_class] << { owner: owner, url: "#{RAILS_DOC_HOST}/v#{RAILTIES_VERSION}/#{doc_path}" }
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
@@ -25,7 +25,7 @@ module RubyLsp
25
25
  @uri = uri
26
26
  @replacements = T.let(
27
27
  offense.correctable? ? offense_replacements : [],
28
- T::Array[LanguageServer::Protocol::Interface::TextEdit]
28
+ T::Array[LanguageServer::Protocol::Interface::TextEdit],
29
29
  )
30
30
  end
31
31
 
@@ -49,11 +49,11 @@ module RubyLsp
49
49
  LanguageServer::Protocol::Interface::TextDocumentEdit.new(
50
50
  text_document: LanguageServer::Protocol::Interface::OptionalVersionedTextDocumentIdentifier.new(
51
51
  uri: @uri,
52
- version: nil
52
+ version: nil,
53
53
  ),
54
- edits: @replacements
54
+ edits: @replacements,
55
55
  ),
56
- ]
56
+ ],
57
57
  ),
58
58
  is_preferred: true,
59
59
  )
@@ -76,13 +76,13 @@ module RubyLsp
76
76
  range: LanguageServer::Protocol::Interface::Range.new(
77
77
  start: LanguageServer::Protocol::Interface::Position.new(
78
78
  line: @offense.line - 1,
79
- character: @offense.column
79
+ character: @offense.column,
80
80
  ),
81
81
  end: LanguageServer::Protocol::Interface::Position.new(
82
82
  line: @offense.last_line - 1,
83
- character: @offense.last_column
84
- )
85
- )
83
+ character: @offense.last_column,
84
+ ),
85
+ ),
86
86
  )
87
87
  end
88
88
 
@@ -95,9 +95,9 @@ module RubyLsp
95
95
  range: LanguageServer::Protocol::Interface::Range.new(
96
96
  start: LanguageServer::Protocol::Interface::Position.new(line: range.line - 1, character: range.column),
97
97
  end: LanguageServer::Protocol::Interface::Position.new(line: range.last_line - 1,
98
- character: range.last_column)
98
+ character: range.last_column),
99
99
  ),
100
- new_text: replacement
100
+ new_text: replacement,
101
101
  )
102
102
  end
103
103
  end
@@ -7,6 +7,12 @@ rescue LoadError
7
7
  return
8
8
  end
9
9
 
10
+ begin
11
+ gem("rubocop", ">= 1.4.0")
12
+ rescue LoadError
13
+ raise StandardError, "Incompatible RuboCop version. Ruby LSP requires >= 1.4.0"
14
+ end
15
+
10
16
  module RubyLsp
11
17
  module Requests
12
18
  module Support
@@ -15,7 +15,7 @@ module RubyLsp
15
15
 
16
16
  sig do
17
17
  params(
18
- tokens: T::Array[SemanticHighlighting::SemanticToken]
18
+ tokens: T::Array[SemanticHighlighting::SemanticToken],
19
19
  ).returns(LanguageServer::Protocol::Interface::SemanticTokens)
20
20
  end
21
21
  def encode(tokens)
@@ -30,7 +30,7 @@ module URI
30
30
  gem_name: String,
31
31
  gem_version: T.nilable(String),
32
32
  path: String,
33
- line_number: T.nilable(String)
33
+ line_number: T.nilable(String),
34
34
  ).returns(URI::Source)
35
35
  end
36
36
  def build(gem_name:, gem_version:, path:, line_number:)
@@ -23,7 +23,7 @@ module RubyLsp
23
23
  message: "Syntax error",
24
24
  source: "SyntaxTree",
25
25
  severity: LanguageServer::Protocol::Constant::DiagnosticSeverity::ERROR,
26
- range: @edit[:range]
26
+ range: @edit[:range],
27
27
  )
28
28
  end
29
29
  end
@@ -6,6 +6,7 @@ module RubyLsp
6
6
  #
7
7
  # - {RubyLsp::Requests::DocumentSymbol}
8
8
  # - {RubyLsp::Requests::DocumentLink}
9
+ # - {RubyLsp::Requests::Hover}
9
10
  # - {RubyLsp::Requests::FoldingRanges}
10
11
  # - {RubyLsp::Requests::SelectionRanges}
11
12
  # - {RubyLsp::Requests::SemanticHighlighting}
@@ -14,10 +15,13 @@ module RubyLsp
14
15
  # - {RubyLsp::Requests::Diagnostics}
15
16
  # - {RubyLsp::Requests::CodeActions}
16
17
  # - {RubyLsp::Requests::DocumentHighlight}
18
+ # - {RubyLsp::Requests::InlayHints}
19
+
17
20
  module Requests
18
21
  autoload :BaseRequest, "ruby_lsp/requests/base_request"
19
22
  autoload :DocumentSymbol, "ruby_lsp/requests/document_symbol"
20
23
  autoload :DocumentLink, "ruby_lsp/requests/document_link"
24
+ autoload :Hover, "ruby_lsp/requests/hover"
21
25
  autoload :FoldingRanges, "ruby_lsp/requests/folding_ranges"
22
26
  autoload :SelectionRanges, "ruby_lsp/requests/selection_ranges"
23
27
  autoload :SemanticHighlighting, "ruby_lsp/requests/semantic_highlighting"
@@ -26,6 +30,7 @@ module RubyLsp
26
30
  autoload :Diagnostics, "ruby_lsp/requests/diagnostics"
27
31
  autoload :CodeActions, "ruby_lsp/requests/code_actions"
28
32
  autoload :DocumentHighlight, "ruby_lsp/requests/document_highlight"
33
+ autoload :InlayHints, "ruby_lsp/requests/inlay_hints"
29
34
 
30
35
  # :nodoc:
31
36
  module Support
@@ -15,7 +15,7 @@ module RubyLsp
15
15
  hierarchical_document_symbol_support: true,
16
16
  symbol_kind: {
17
17
  value_set: Requests::DocumentSymbol::SYMBOL_KIND.values,
18
- }
18
+ },
19
19
  )
20
20
  end
21
21
 
@@ -23,6 +23,10 @@ module RubyLsp
23
23
  Interface::DocumentLinkOptions.new(resolve_provider: false)
24
24
  end
25
25
 
26
+ hover_provider = if enabled_features.include?("hover")
27
+ Interface::HoverClientCapabilities.new(dynamic_registration: false)
28
+ end
29
+
26
30
  folding_ranges_provider = if enabled_features.include?("foldingRanges")
27
31
  Interface::FoldingRangeClientCapabilities.new(line_folding_only: true)
28
32
  end
@@ -32,12 +36,12 @@ module RubyLsp
32
36
  document_selector: { scheme: "file", language: "ruby" },
33
37
  legend: Interface::SemanticTokensLegend.new(
34
38
  token_types: Requests::SemanticHighlighting::TOKEN_TYPES.keys,
35
- token_modifiers: Requests::SemanticHighlighting::TOKEN_MODIFIERS.keys
39
+ token_modifiers: Requests::SemanticHighlighting::TOKEN_MODIFIERS.keys,
36
40
  ),
37
41
  range: false,
38
42
  full: {
39
43
  delta: true,
40
- }
44
+ },
41
45
  )
42
46
  end
43
47
 
@@ -51,10 +55,14 @@ module RubyLsp
51
55
  on_type_formatting_provider = if enabled_features.include?("onTypeFormatting")
52
56
  Interface::DocumentOnTypeFormattingOptions.new(
53
57
  first_trigger_character: "{",
54
- more_trigger_character: ["\n", "|"]
58
+ more_trigger_character: ["\n", "|"],
55
59
  )
56
60
  end
57
61
 
62
+ inlay_hint_provider = if enabled_features.include?("inlayHint")
63
+ Interface::InlayHintOptions.new(resolve_provider: false)
64
+ end
65
+
58
66
  Interface::InitializeResult.new(
59
67
  capabilities: Interface::ServerCapabilities.new(
60
68
  text_document_sync: Interface::TextDocumentSyncOptions.new(
@@ -62,6 +70,7 @@ module RubyLsp
62
70
  open_close: true,
63
71
  ),
64
72
  selection_range_provider: enabled_features.include?("selectionRanges"),
73
+ hover_provider: hover_provider,
65
74
  document_symbol_provider: document_symbol_provider,
66
75
  document_link_provider: document_link_provider,
67
76
  folding_range_provider: folding_ranges_provider,
@@ -71,7 +80,8 @@ module RubyLsp
71
80
  code_action_provider: enabled_features.include?("codeActions"),
72
81
  document_on_type_formatting_provider: on_type_formatting_provider,
73
82
  diagnostic_provider: diagnostics_provider,
74
- )
83
+ inlay_hint_provider: inlay_hint_provider,
84
+ ),
75
85
  )
76
86
  end
77
87
 
@@ -111,6 +121,13 @@ module RubyLsp
111
121
  end
112
122
  end
113
123
 
124
+ on("textDocument/hover") do |request|
125
+ position = request.dig(:params, :position)
126
+ document = store.get(request.dig(:params, :textDocument, :uri))
127
+
128
+ RubyLsp::Requests::Hover.new(document, position).run
129
+ end
130
+
114
131
  on("textDocument/foldingRange", parallel: true) do |request|
115
132
  store.cache_fetch(request.dig(:params, :textDocument, :uri), :folding_ranges) do |document|
116
133
  Requests::FoldingRanges.new(document).run
@@ -144,9 +161,9 @@ module RubyLsp
144
161
  T.cast(
145
162
  Requests::SemanticHighlighting.new(
146
163
  document,
147
- encoder: Requests::Support::SemanticTokenEncoder.new
164
+ encoder: Requests::Support::SemanticTokenEncoder.new,
148
165
  ).run,
149
- LanguageServer::Protocol::Interface::SemanticTokens
166
+ LanguageServer::Protocol::Interface::SemanticTokens,
150
167
  )
151
168
  end
152
169
  end
@@ -170,9 +187,7 @@ module RubyLsp
170
187
  on("textDocument/documentHighlight", parallel: true) do |request|
171
188
  document = store.get(request.dig(:params, :textDocument, :uri))
172
189
 
173
- if document.parsed?
174
- Requests::DocumentHighlight.new(document, request.dig(:params, :position)).run
175
- end
190
+ Requests::DocumentHighlight.new(document, request.dig(:params, :position)).run
176
191
  end
177
192
 
178
193
  on("textDocument/codeAction", parallel: true) do |request|
@@ -186,6 +201,15 @@ module RubyLsp
186
201
  end
187
202
  end
188
203
 
204
+ on("textDocument/inlayHint", parallel: true) do |request|
205
+ document = store.get(request.dig(:params, :textDocument, :uri))
206
+ range = request.dig(:params, :range)
207
+ start_line = range.dig(:start, :line)
208
+ end_line = range.dig(:end, :line)
209
+
210
+ Requests::InlayHints.new(document, start_line..end_line).run
211
+ end
212
+
189
213
  on("$/cancelRequest") do |request|
190
214
  cancel_request(request[:params][:id])
191
215
  Handler::VOID
@@ -54,14 +54,11 @@ module RubyLsp
54
54
  .params(
55
55
  uri: String,
56
56
  request_name: Symbol,
57
- block: T.proc.params(document: Document).returns(T.type_parameter(:T))
58
- ).returns(T.nilable(T.type_parameter(:T)))
57
+ block: T.proc.params(document: Document).returns(T.type_parameter(:T)),
58
+ ).returns(T.type_parameter(:T))
59
59
  end
60
60
  def cache_fetch(uri, request_name, &block)
61
- document = get(uri)
62
- return unless document.parsed?
63
-
64
- document.cache_fetch(request_name, &block)
61
+ get(uri).cache_fetch(request_name, &block)
65
62
  end
66
63
  end
67
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-07 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: language_server-protocol
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.4'
47
+ version: 3.6.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.4'
54
+ version: 3.6.3
55
55
  description: An opinionated language server for Ruby
56
56
  email:
57
57
  - ruby@shopify.com
@@ -60,7 +60,6 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - CHANGELOG.md
64
63
  - LICENSE.txt
65
64
  - README.md
66
65
  - VERSION
@@ -79,10 +78,13 @@ files:
79
78
  - lib/ruby_lsp/requests/document_symbol.rb
80
79
  - lib/ruby_lsp/requests/folding_ranges.rb
81
80
  - lib/ruby_lsp/requests/formatting.rb
81
+ - lib/ruby_lsp/requests/hover.rb
82
+ - lib/ruby_lsp/requests/inlay_hints.rb
82
83
  - lib/ruby_lsp/requests/on_type_formatting.rb
83
84
  - lib/ruby_lsp/requests/selection_ranges.rb
84
85
  - lib/ruby_lsp/requests/semantic_highlighting.rb
85
86
  - lib/ruby_lsp/requests/support/highlight_target.rb
87
+ - lib/ruby_lsp/requests/support/rails_document_client.rb
86
88
  - lib/ruby_lsp/requests/support/rubocop_diagnostic.rb
87
89
  - lib/ruby_lsp/requests/support/rubocop_diagnostics_runner.rb
88
90
  - lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb