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 +4 -4
- data/CHANGELOG.txt +4 -0
- data/Gemfile.lock +1 -1
- data/lib/ruby_language_server/completion.rb +1 -1
- data/lib/ruby_language_server/io.rb +2 -2
- data/lib/ruby_language_server/location.rb +21 -19
- data/lib/ruby_language_server/project_manager.rb +7 -3
- data/lib/ruby_language_server/scope_data/scope.rb +1 -1
- data/lib/ruby_language_server/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ab3ea4a4f1a9af05f36ddc55a19dc735a9b3d5b9bb4e63bcf7a5a5f3e281019
|
4
|
+
data.tar.gz: 2de48c7e9b78606a33507ad3439088a42671c3c2eed366708714b14137a968a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06e256c7dc709ef6343d22a8317b10aaa66175f781e7f08fb44703fbaeaa6c115850f53a557da260856c1c1f688c5403ee971349038a4da1e3b447890c8ea913
|
7
|
+
data.tar.gz: ae4832012bce5be577ad6224b1093a9fd20fb9403b4042444f460b9847004f01711d74e4235951edc9addfcca5ba1ee8c5e2fed7f229b1a3629b3c8a3274e942
|
data/CHANGELOG.txt
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
-
|
67
|
+
[id, response]
|
68
68
|
else
|
69
69
|
RubyLanguageServer.logger.warn "SERVER DOES NOT RESPOND TO #{method_name}"
|
70
|
-
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
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 =
|
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
|
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
|
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.
|
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-
|
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.
|
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.
|