ruby-lsp 0.16.3 → 0.16.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 906f8ef7ff4c3c0da126b61e41772b36989c93e391575099121c7a31184de81c
4
- data.tar.gz: 67eb8cd92613348b9b2bf7163b458ed0ba7772e4c0304c01b80e3b0c4e8b34c7
3
+ metadata.gz: 94d4dfcda701bdf2ea1dd04e2a271572a139fe3d716e1bd535e2c05bcc9b3d23
4
+ data.tar.gz: b79dfc816bf027e733fa5f44db3e2d1039ae860f9dee88fe996ab1a27089d467
5
5
  SHA512:
6
- metadata.gz: e6b28979f399686bf62943bb49036ed26411a11439120f8ddf52f7c86310ecc8964d32de8fffe98c12686021f8d2b019c49347de4ced546a1a2e4e1b47726bfd
7
- data.tar.gz: 3339ddda6a9450cf4449a0336a38ec4bdd95b4d81e9b2aa834bfd87db11f3bb2d0caf02e5ad4d0366f040d4718046e36744750e46ef9638b78a4235f0dfad1b7
6
+ metadata.gz: 9de1f73feba2284c75294542a0e9ae1196f092004fe83ef815b2e08a1b404daceebc0b3f6f8f59149f936c8f7414821942556bee522776a909c071765dcc3443
7
+ data.tar.gz: b7617a6d508a94e5a06b8d39acb4d2bcc28d02832b19ab8567ed58b6b297aa3fc450dd0a116257fe91fc9545683550456c0d712fc32dc3f3ff716e2cdca2985e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.3
1
+ 0.16.4
@@ -59,9 +59,11 @@ module RubyLsp
59
59
  end
60
60
  end
61
61
 
62
- # We need to process shutdown and exit from the main thread in order to close queues and wait for other threads
63
- # to finish. Everything else is pushed into the incoming queue
62
+ # The following requests need to be executed in the main thread directly to avoid concurrency issues. Everything
63
+ # else is pushed into the incoming queue
64
64
  case method
65
+ when "initialize", "textDocument/didOpen", "textDocument/didClose", "textDocument/didChange"
66
+ process_message(message)
65
67
  when "shutdown"
66
68
  $stderr.puts("Shutting down Ruby LSP...")
67
69
 
@@ -20,6 +20,9 @@ module RubyLsp
20
20
  sig { returns(Encoding) }
21
21
  attr_reader :encoding
22
22
 
23
+ sig { returns(T::Boolean) }
24
+ attr_reader :supports_watching_files
25
+
23
26
  sig { void }
24
27
  def initialize
25
28
  @workspace_uri = T.let(URI::Generic.from_path(path: Dir.pwd), URI::Generic)
@@ -30,6 +33,7 @@ module RubyLsp
30
33
  @typechecker = T.let(detect_typechecker, T::Boolean)
31
34
  @index = T.let(RubyIndexer::Index.new, RubyIndexer::Index)
32
35
  @supported_formatters = T.let({}, T::Hash[String, Requests::Support::Formatter])
36
+ @supports_watching_files = T.let(false, T::Boolean)
33
37
  end
34
38
 
35
39
  sig { params(identifier: String, instance: Requests::Support::Formatter).void }
@@ -61,6 +65,11 @@ module RubyLsp
61
65
  else
62
66
  Encoding::UTF_32
63
67
  end
68
+
69
+ file_watching_caps = options.dig(:capabilities, :workspace, :didChangeWatchedFiles)
70
+ if file_watching_caps&.dig(:dynamicRegistration) && file_watching_caps&.dig(:relativePatternSupport)
71
+ @supports_watching_files = true
72
+ end
64
73
  end
65
74
 
66
75
  sig { returns(String) }
@@ -3,15 +3,12 @@
3
3
 
4
4
  return unless defined?(RubyLsp::Requests::Support::RuboCopRunner)
5
5
 
6
- require "singleton"
7
-
8
6
  module RubyLsp
9
7
  module Requests
10
8
  module Support
11
9
  class RuboCopFormatter
12
10
  extend T::Sig
13
11
  include Formatter
14
- include Singleton
15
12
 
16
13
  sig { void }
17
14
  def initialize
@@ -8,15 +8,12 @@ rescue LoadError
8
8
  return
9
9
  end
10
10
 
11
- require "singleton"
12
-
13
11
  module RubyLsp
14
12
  module Requests
15
13
  module Support
16
14
  # :nodoc:
17
15
  class SyntaxTreeFormatter
18
16
  extend T::Sig
19
- include Singleton
20
17
  include Support::Formatter
21
18
 
22
19
  sig { void }
@@ -187,11 +187,8 @@ module RubyLsp
187
187
 
188
188
  send_message(Result.new(id: message[:id], response: response))
189
189
 
190
- # Dynamically registered capabilities
191
- file_watching_caps = options.dig(:capabilities, :workspace, :didChangeWatchedFiles)
192
-
193
190
  # Not every client supports dynamic registration or file watching
194
- if file_watching_caps&.dig(:dynamicRegistration) && file_watching_caps&.dig(:relativePatternSupport)
191
+ if global_state.supports_watching_files
195
192
  send_message(
196
193
  Request.new(
197
194
  id: @current_request_id,
@@ -248,10 +245,10 @@ module RubyLsp
248
245
  end
249
246
 
250
247
  if defined?(Requests::Support::RuboCopFormatter)
251
- @global_state.register_formatter("rubocop", Requests::Support::RuboCopFormatter.instance)
248
+ @global_state.register_formatter("rubocop", Requests::Support::RuboCopFormatter.new)
252
249
  end
253
250
  if defined?(Requests::Support::SyntaxTreeFormatter)
254
- @global_state.register_formatter("syntax_tree", Requests::Support::SyntaxTreeFormatter.instance)
251
+ @global_state.register_formatter("syntax_tree", Requests::Support::SyntaxTreeFormatter.new)
255
252
  end
256
253
 
257
254
  perform_initial_indexing(indexing_config)
@@ -613,6 +610,7 @@ module RubyLsp
613
610
  uri = URI(change[:uri])
614
611
  file_path = uri.to_standardized_path
615
612
  next if file_path.nil? || File.directory?(file_path)
613
+ next unless file_path.end_with?(".rb")
616
614
 
617
615
  load_path_entry = $LOAD_PATH.find { |load_path| file_path.start_with?(load_path) }
618
616
  indexable = RubyIndexer::IndexablePath.new(load_path_entry, file_path)
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.16.3
4
+ version: 0.16.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-09 00:00:00.000000000 Z
11
+ date: 2024-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: language_server-protocol