ruby-lsp-rails 0.3.12 → 0.3.13

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: 9c4bfe664b0783f9ae11cc912ec6eff3cd8c2d9c5c9c51731a85d0ed7de2fbf1
4
- data.tar.gz: 1f3f74de8ec6891464b84a8d88fd339e33ce1ddcdc770a6a34177c60d4001ebe
3
+ metadata.gz: e2543aa7d39f0a6b231112f9ddb365692c7e8d06eb14681da551ab55fd8f5a4d
4
+ data.tar.gz: e466ccd6d90934e083e638efdcedfb5d6b8f85fbce70b139e1542eeb2ab8a139
5
5
  SHA512:
6
- metadata.gz: 2e4493fb0f18638b208e3d9f40671846e351670936214420131ae0482fe7d6410f74afc5b808a707dd616471f83233eb201be51a25e29152817daa1ec0380e73
7
- data.tar.gz: 9eb01978fc74c0d212a65240ff2f5874d38768abf85b647943c7eba0aee84116912a0ebe9c6206ddf84b6ee7b48f60535f1a288cd66c538ff56a40c501adc4ee
6
+ metadata.gz: 8f7c82462682d93fd6b944c2705c8b62b424b4abc3636d1f2540eeee1ab9f7e2896eb77d338697bb65a0a64752529085f38e49bd5a75bfc668fa9d31dd5b0d10
7
+ data.tar.gz: a8978fdebb07ba8b76dd10a725b3b3c736961f103cefa806fbc0302b494516e0a196105bf7fac9d114c963a62c8a706959d53f1509a4ed343e2e9d24633c4372
@@ -51,7 +51,7 @@ module RubyLsp
51
51
  # class AddFirstNameToUsers < ActiveRecord::Migration[7.1]
52
52
  # # ...
53
53
  # end
54
- # ````
54
+ # ```
55
55
  #
56
56
  # The code lenses will be displayed above the class and above each test method.
57
57
  #
@@ -41,6 +41,7 @@ module RubyLsp
41
41
 
42
42
  sig { void }
43
43
  def initialize
44
+ @mutex = T.let(Mutex.new, Mutex)
44
45
  # Spring needs a Process session ID. It uses this ID to "attach" itself to the parent process, so that when the
45
46
  # parent ends, the spring process ends as well. If this is not set, Spring will throw an error while trying to
46
47
  # set its own session ID
@@ -176,7 +177,9 @@ module RubyLsp
176
177
  message[:params] = params if params
177
178
  json = message.to_json
178
179
 
179
- @stdin.write("Content-Length: #{json.length}\r\n\r\n", json)
180
+ @mutex.synchronize do
181
+ @stdin.write("Content-Length: #{json.length}\r\n\r\n", json)
182
+ end
180
183
  rescue Errno::EPIPE
181
184
  # The server connection died
182
185
  end
@@ -187,13 +190,16 @@ module RubyLsp
187
190
 
188
191
  sig { overridable.returns(T.nilable(T::Hash[Symbol, T.untyped])) }
189
192
  def read_response
190
- headers = @stdout.gets("\r\n\r\n")
191
- raise IncompleteMessageError unless headers
193
+ raw_response = @mutex.synchronize do
194
+ headers = @stdout.gets("\r\n\r\n")
195
+ raise IncompleteMessageError unless headers
196
+
197
+ content_length = headers[/Content-Length: (\d+)/i, 1].to_i
198
+ raise EmptyMessageError if content_length.zero?
192
199
 
193
- content_length = headers[/Content-Length: (\d+)/i, 1].to_i
194
- raise EmptyMessageError if content_length.zero?
200
+ @stdout.read(content_length)
201
+ end
195
202
 
196
- raw_response = @stdout.read(content_length)
197
203
  response = JSON.parse(T.must(raw_response), symbolize_names: true)
198
204
 
199
205
  if response[:error]
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module Rails
6
- VERSION = "0.3.12"
6
+ VERSION = "0.3.13"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-08 00:00:00.000000000 Z
11
+ date: 2024-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lsp
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.5.16
83
+ rubygems_version: 3.5.17
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: A Ruby LSP addon for Rails