ruby-lsp 0.14.4 → 0.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ruby_lsp/addon.rb +6 -0
- data/lib/ruby_lsp/executor.rb +1 -0
- data/lib/ruby_lsp/listeners/completion.rb +8 -7
- data/lib/ruby_lsp/requests/completion.rb +1 -1
- data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +6 -3
- data/lib/ruby_lsp/requests/support/rubocop_runner.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '046081e0caf521f948f3952bd7a356ef6f0beb80c5a9ff72930a6d0c9fd8d9f4'
|
4
|
+
data.tar.gz: e65b5224342c412a0b28198af0e56b17a421eaacc7748a17d2ed30890c0a2d86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 682219fbef2c6e1483c0e6b0c36bf2ce8c3bd15aed88e53ee1a05623f5569c7e52227300b1a6fb4968a6ba2b0844a7e985a0b134af9e9498036199673d660117
|
7
|
+
data.tar.gz: a13eb33a1a41514819f4d0612a5d50eb170a0adb36158b799cebffae34781a5d41c1b07922f0bec8310cf6439ea8356305224bcf1de7423b96ff6e28c9e744c8
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
1
|
+
0.14.5
|
data/lib/ruby_lsp/addon.rb
CHANGED
@@ -27,6 +27,8 @@ module RubyLsp
|
|
27
27
|
|
28
28
|
@addons = T.let([], T::Array[Addon])
|
29
29
|
@addon_classes = T.let([], T::Array[T.class_of(Addon)])
|
30
|
+
# Addon instances that have declared a handler to accept file watcher events
|
31
|
+
@file_watcher_addons = T.let([], T::Array[Addon])
|
30
32
|
|
31
33
|
class << self
|
32
34
|
extend T::Sig
|
@@ -34,6 +36,9 @@ module RubyLsp
|
|
34
36
|
sig { returns(T::Array[Addon]) }
|
35
37
|
attr_accessor :addons
|
36
38
|
|
39
|
+
sig { returns(T::Array[Addon]) }
|
40
|
+
attr_accessor :file_watcher_addons
|
41
|
+
|
37
42
|
sig { returns(T::Array[T.class_of(Addon)]) }
|
38
43
|
attr_reader :addon_classes
|
39
44
|
|
@@ -57,6 +62,7 @@ module RubyLsp
|
|
57
62
|
|
58
63
|
# Instantiate all discovered addon classes
|
59
64
|
self.addons = addon_classes.map(&:new)
|
65
|
+
self.file_watcher_addons = addons.select { |addon| addon.respond_to?(:workspace_did_change_watched_files) }
|
60
66
|
|
61
67
|
# Activate each one of the discovered addons. If any problems occur in the addons, we don't want to
|
62
68
|
# fail to boot the server
|
data/lib/ruby_lsp/executor.rb
CHANGED
@@ -100,8 +100,6 @@ module RubyLsp
|
|
100
100
|
|
101
101
|
sig { params(node: Prism::CallNode).void }
|
102
102
|
def on_call_node_enter(node)
|
103
|
-
return if @typechecker_enabled
|
104
|
-
|
105
103
|
name = node.message
|
106
104
|
return unless name
|
107
105
|
|
@@ -111,7 +109,7 @@ module RubyLsp
|
|
111
109
|
when "require_relative"
|
112
110
|
complete_require_relative(node)
|
113
111
|
else
|
114
|
-
complete_self_receiver_method(node, name) if self_receiver?(node)
|
112
|
+
complete_self_receiver_method(node, name) if !@typechecker_enabled && self_receiver?(node)
|
115
113
|
end
|
116
114
|
end
|
117
115
|
|
@@ -142,14 +140,17 @@ module RubyLsp
|
|
142
140
|
|
143
141
|
origin_dir = Pathname.new(@uri.to_standardized_path).dirname
|
144
142
|
|
145
|
-
|
143
|
+
content = path_node_to_complete.content
|
146
144
|
# if the path is not a directory, glob all possible next characters
|
147
145
|
# for example ../somethi| (where | is the cursor position)
|
148
146
|
# should find files for ../somethi*/
|
149
|
-
path_query
|
150
|
-
|
147
|
+
path_query = if content.end_with?("/") || content.empty?
|
148
|
+
"#{content}**/*.rb"
|
149
|
+
else
|
150
|
+
"{#{content}*/**/*.rb,**/#{content}*.rb}"
|
151
|
+
end
|
151
152
|
|
152
|
-
Dir.glob(path_query, base: origin_dir).sort!.each do |path|
|
153
|
+
Dir.glob(path_query, File::FNM_PATHNAME | File::FNM_EXTGLOB, base: origin_dir).sort!.each do |path|
|
153
154
|
@response_builder << build_completion(
|
154
155
|
path.delete_suffix(".rb"),
|
155
156
|
path_node_to_complete,
|
@@ -40,6 +40,9 @@ module RubyLsp
|
|
40
40
|
|
41
41
|
sig { returns(Interface::Diagnostic) }
|
42
42
|
def to_lsp_diagnostic
|
43
|
+
# highlighted_area contains the begin and end position of the first line
|
44
|
+
# This ensures that multiline offenses don't clutter the editor
|
45
|
+
highlighted = @offense.highlighted_area
|
43
46
|
Interface::Diagnostic.new(
|
44
47
|
message: message,
|
45
48
|
source: "RuboCop",
|
@@ -49,11 +52,11 @@ module RubyLsp
|
|
49
52
|
range: Interface::Range.new(
|
50
53
|
start: Interface::Position.new(
|
51
54
|
line: @offense.line - 1,
|
52
|
-
character:
|
55
|
+
character: highlighted.begin_pos,
|
53
56
|
),
|
54
57
|
end: Interface::Position.new(
|
55
|
-
line: @offense.
|
56
|
-
character:
|
58
|
+
line: @offense.line - 1,
|
59
|
+
character: highlighted.end_pos,
|
57
60
|
),
|
58
61
|
),
|
59
62
|
data: {
|
@@ -13,6 +13,10 @@ rescue LoadError
|
|
13
13
|
raise StandardError, "Incompatible RuboCop version. Ruby LSP requires >= 1.4.0"
|
14
14
|
end
|
15
15
|
|
16
|
+
if RuboCop.const_defined?(:LSP) # This condition will be removed when requiring RuboCop >= 1.61.
|
17
|
+
RuboCop::LSP.enable
|
18
|
+
end
|
19
|
+
|
16
20
|
module RubyLsp
|
17
21
|
module Requests
|
18
22
|
module Support
|
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.14.
|
4
|
+
version: 0.14.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: language_server-protocol
|