ruby_language_server 0.3.5 → 0.3.6

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: fe7ed319d3b5378154def8fd97fb00114b8e593e60a130e8aa4b6effbd387733
4
- data.tar.gz: 25db085571e9a0fa2b2b840d9a6ade674bd3dd9f0aa962569c598ef0e2ffef62
3
+ metadata.gz: 6ab3ea4a4f1a9af05f36ddc55a19dc735a9b3d5b9bb4e63bcf7a5a5f3e281019
4
+ data.tar.gz: 2de48c7e9b78606a33507ad3439088a42671c3c2eed366708714b14137a968a8
5
5
  SHA512:
6
- metadata.gz: b021229bda8a598905d36c7c73bfec7a90dc77a75585646d8275ba8082719e67aae9e2229ac7f0b93cfaeb4a66fcfaf6ca46a2269865b14b4ca856de96ff1293
7
- data.tar.gz: 30103be3c703c9e7e45c663b6d00077cecb07066a88f796300ee3e88310ef05fb0ab1998ed1d45bce4f6c4dcd7b65cb4e1952d251d8855f18a7a71fd7b1bbb31
6
+ metadata.gz: 06e256c7dc709ef6343d22a8317b10aaa66175f781e7f08fb44703fbaeaa6c115850f53a557da260856c1c1f688c5403ee971349038a4da1e3b447890c8ea913
7
+ data.tar.gz: ae4832012bce5be577ad6224b1093a9fd20fb9403b4042444f460b9847004f01711d74e4235951edc9addfcca5ba1ee8c5e2fed7f229b1a3629b3c8a3274e942
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ #### 0.3.6 Mon Jan 13 22:48:31 PST 2020
4
+
5
+ * #51 Tweaks to support vs code
6
+
3
7
  #### 0.3.5 Fri Jan 10 08:37:02 PST 2020
4
8
 
5
9
  * #50 Don't use bundle exec in Dockerfile.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_language_server (0.3.5)
4
+ ruby_language_server (0.3.6)
5
5
  activerecord (~> 5.2)
6
6
  amatch
7
7
  bundler
@@ -59,7 +59,7 @@ module RubyLanguageServer
59
59
  RubyLanguageServer.logger.debug("scope_with_name: #{scope}")
60
60
  end
61
61
  scope ||= context_scope
62
- RubyLanguageServer.logger.debug("scope: #{scope}")
62
+ RubyLanguageServer.logger.debug("scope: #{scope.to_json}")
63
63
  scope_completions(context.last, [scope] + scopes.includes(:variables))
64
64
  end
65
65
 
@@ -64,10 +64,10 @@ module RubyLanguageServer
64
64
  end
65
65
  RubyLanguageServer.logger.debug 'UNLocking io'
66
66
  exit(true) if response == 'EXIT'
67
- return id, response
67
+ [id, response]
68
68
  else
69
69
  RubyLanguageServer.logger.warn "SERVER DOES NOT RESPOND TO #{method_name}"
70
- return nil
70
+ nil
71
71
  end
72
72
  end
73
73
 
@@ -3,27 +3,29 @@
3
3
  module RubyLanguageServer
4
4
  # Hash factories for the language server
5
5
  module Location
6
- def self.hash(uri, start_line, start_character = 0, end_line = nil, end_character = nil)
7
- {
8
- uri: uri,
9
- range: position_hash(start_line, start_character, end_line, end_character)
10
- }
11
- end
6
+ class << self
7
+ def hash(uri, start_line, start_character = 0, end_line = nil, end_character = nil)
8
+ {
9
+ uri: uri,
10
+ range: position_hash(start_line, start_character, end_line, end_character)
11
+ }
12
+ end
12
13
 
13
- def self.position_hash(start_line, start_character = 0, end_line = nil, end_character = nil)
14
- end_line ||= start_line
15
- end_character ||= start_character
16
- {
17
- start:
14
+ def position_hash(start_line, start_character = 0, end_line = nil, end_character = nil)
15
+ end_line ||= start_line
16
+ end_character ||= start_character
18
17
  {
19
- line: start_line - 1,
20
- character: start_character
21
- },
22
- 'end': {
23
- line: end_line - 1,
24
- character: end_character
18
+ start:
19
+ {
20
+ line: start_line - 1,
21
+ character: start_character
22
+ },
23
+ 'end': {
24
+ line: end_line - 1,
25
+ character: end_character
26
+ }
25
27
  }
26
- }
27
- end
28
+ end
29
+ end
28
30
  end
29
31
  end
@@ -186,13 +186,15 @@ module RubyLanguageServer
186
186
  project_ruby_files = Dir.glob("#{self.class.root_path}**/*.rb")
187
187
  Thread.new do
188
188
  RubyLanguageServer.logger.error('Threading up!')
189
+ root_uri = @root_uri
190
+ root_uri += '/' unless root_uri.end_with? '/'
189
191
  project_ruby_files.each do |container_path|
190
192
  # Let's not preload spec/test or vendor - yet..
191
193
  next if container_path.match?(/^(.?spec|test|vendor)/)
192
194
 
193
195
  text = File.read(container_path)
194
196
  relative_path = container_path.delete_prefix(self.class.root_path)
195
- host_uri = @root_uri + relative_path
197
+ host_uri = root_uri + relative_path
196
198
  RubyLanguageServer.logger.debug "Locking scan for #{container_path}"
197
199
  mutex.synchronize do
198
200
  RubyLanguageServer.logger.debug("Threading #{host_uri}")
@@ -244,6 +246,8 @@ module RubyLanguageServer
244
246
  project_definitions_for(name)
245
247
  end
246
248
 
249
+ # Return variables found in the current scope. After all, those are the important ones.
250
+ # Should probably be private...
247
251
  def scope_definitions_for(name, scope, uri)
248
252
  check_scope = scope
249
253
  return_array = []
@@ -253,7 +257,7 @@ module RubyLanguageServer
253
257
  end
254
258
  check_scope = check_scope.parent
255
259
  end
256
- RubyLanguageServer.logger.debug("scope_definitions_for(#{name}, #{scope}, #{uri}: #{return_array.uniq})")
260
+ RubyLanguageServer.logger.debug("==============>> scope_definitions_for(#{name}, #{scope.to_json}, #{uri}: #{return_array.uniq})")
257
261
  return_array.uniq
258
262
  end
259
263
 
@@ -261,7 +265,7 @@ module RubyLanguageServer
261
265
  scopes = RubyLanguageServer::ScopeData::Scope.where(name: name)
262
266
  variables = RubyLanguageServer::ScopeData::Variable.constant_variables.where(name: name)
263
267
  (scopes + variables).reject { |scope| scope.code_file.nil? }.map do |scope|
264
- Location.hash(scope.code_file.uri.delete_prefix(self.class.root_uri), scope.top_line, 1)
268
+ Location.hash(scope.code_file.uri, scope.top_line, 1)
265
269
  end
266
270
  end
267
271
 
@@ -14,7 +14,7 @@ module RubyLanguageServer
14
14
 
15
15
  scope :method_scopes, -> { where(class_type: TYPE_METHOD) }
16
16
  scope :for_line, ->(line) { where('top_line <= ? AND bottom_line >= ?', line, line).or(where(parent_id: nil)) }
17
- scope :by_path_length, -> { order('length(path) DESC') }
17
+ scope :by_path_length, -> { order(Arel.sql('length(path) DESC')) }
18
18
  # attr_accessor :top_line # first line
19
19
  # attr_accessor :bottom_line # last line
20
20
  # attr_accessor :parent # parent scope
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyLanguageServer
4
- VERSION = '0.3.5'
4
+ VERSION = '0.3.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_language_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Werle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-10 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -347,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
347
347
  - !ruby/object:Gem::Version
348
348
  version: '0'
349
349
  requirements: []
350
- rubygems_version: 3.0.3
350
+ rubygems_version: 3.1.2
351
351
  signing_key:
352
352
  specification_version: 4
353
353
  summary: Provide a language server implementation for ruby in ruby.