ruby-lsp-rails 0.3.14 → 0.3.15

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: '030969e625bedc49a1365d04226c7f8d63bafaf2ad211438e4c438f8977630da'
4
- data.tar.gz: af273b69dc8d2d86e08709e25a3b8d5f7c549bbeefd9003a6fa43951a7dc7eee
3
+ metadata.gz: 8864e641f204eaafb608b703228bd98d5a2234413f48ee1d1232f277b7385144
4
+ data.tar.gz: 3db424bb7e32fbd1a1dce231d56b9d98d92e23b0c9ef70f56cbab86b878f9133
5
5
  SHA512:
6
- metadata.gz: 4dfdfee466a27d8f1f4c9a2b8baba4fb43cab15a4f59a164c3fb65d9e22532e334f31e1d46c8394d898099340707c581ec0d096c06be7dadef50ad98a638a2df
7
- data.tar.gz: 9608fa839313f2438827b4e64fbda19ce090b4d79109002f003ceb8ee24689bddea454a0c0e21f736275488548cd72b5f57df4b915f37c4af2ee4b5d19f8a674
6
+ metadata.gz: 3820483222f6b082c3f939e9b797a71e775776fd3e5a3d9422a99ab1c3af992dce883a69781cf4b2a07e8492c87e3054a351df4f22c398fd12cb20c6a4472ff8
7
+ data.tar.gz: 72e7715cefc65926b7d8011933e0152f90ee896b6530cea5edec0b41c70be701ae55619ea9c73dbb60e4becaf73df9f48ce122448ab2f6688204eda1d85edfb8
@@ -151,7 +151,7 @@ module RubyLsp
151
151
  @group_id += 1
152
152
  end
153
153
 
154
- if superclass_name&.start_with?("ActiveRecord::Migration")
154
+ if @path && superclass_name&.start_with?("ActiveRecord::Migration")
155
155
  command = "#{migrate_command} VERSION=#{migration_version}"
156
156
  add_migrate_code_lens(node, name: class_name, command: command)
157
157
  end
@@ -12,10 +12,22 @@ module RubyLsp
12
12
  VOID = Object.new
13
13
 
14
14
  def initialize
15
- $stdin.sync = true
16
- $stdout.sync = true
17
- $stdin.binmode
18
- $stdout.binmode
15
+ # Grab references to the original pipes so that we can change the default output device further down
16
+ @stdin = $stdin
17
+ @stdout = $stdout
18
+ @stderr = $stderr
19
+ @stdin.sync = true
20
+ @stdout.sync = true
21
+ @stderr.sync = true
22
+ @stdin.binmode
23
+ @stdout.binmode
24
+ @stderr.binmode
25
+
26
+ # # Set the default output device to be $stderr. This means that using `puts` by itself will default to printing
27
+ # # to $stderr and only explicit `$stdout.puts` will go to $stdout. This reduces the chance that output coming
28
+ # # from the Rails app will be accidentally sent to the client
29
+ $> = $stderr
30
+
19
31
  @running = true
20
32
  end
21
33
 
@@ -25,18 +37,18 @@ module RubyLsp
25
37
  routes_reloader.execute_unless_loaded if routes_reloader&.respond_to?(:execute_unless_loaded)
26
38
 
27
39
  initialize_result = { result: { message: "ok", root: ::Rails.root.to_s } }.to_json
28
- $stdout.write("Content-Length: #{initialize_result.length}\r\n\r\n#{initialize_result}")
40
+ @stdout.write("Content-Length: #{initialize_result.length}\r\n\r\n#{initialize_result}")
29
41
 
30
42
  while @running
31
- headers = $stdin.gets("\r\n\r\n")
32
- json = $stdin.read(headers[/Content-Length: (\d+)/i, 1].to_i)
43
+ headers = @stdin.gets("\r\n\r\n")
44
+ json = @stdin.read(headers[/Content-Length: (\d+)/i, 1].to_i)
33
45
 
34
46
  request = JSON.parse(json, symbolize_names: true)
35
47
  response = execute(request.fetch(:method), request[:params])
36
48
  next if response == VOID
37
49
 
38
50
  json_response = response.to_json
39
- $stdout.write("Content-Length: #{json_response.length}\r\n\r\n#{json_response}")
51
+ @stdout.write("Content-Length: #{json_response.length}\r\n\r\n#{json_response}")
40
52
  end
41
53
  end
42
54
 
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module Rails
6
- VERSION = "0.3.14"
6
+ VERSION = "0.3.15"
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.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-12 00:00:00.000000000 Z
11
+ date: 2024-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lsp