ruby-lsp 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ruby_lsp/check_docs.rb +22 -4
- data/lib/ruby_lsp/requests/code_lens.rb +7 -3
- data/lib/ruby_lsp/requests/inlay_hints.rb +1 -1
- 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: 11dd3401d408ed456da9b4dd0aca906b991a45a0103ca8786eafbf34d4659c85
|
4
|
+
data.tar.gz: 8469dd62a3660965daee589835e1481fe09e17b55cbd9d61c461d4ba94db833e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d2e0c3d9c5bf11068b1d5e3092d4b5f3b233066a33b7e74ea218f115fbb8b154798a8b8b0634569781245f1dedcb6da3e5ca3a23db04f78fc105c496d2a3280
|
7
|
+
data.tar.gz: 529ce841833605ac40c67536bbca1eb1a9568b742de854f4698ced147813ec63569fd926d4035d518f7bb0ab54d2bbd4665e7ad2564923b49036573a0d4625e7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
data/lib/ruby_lsp/check_docs.rb
CHANGED
@@ -6,23 +6,26 @@ require "objspace"
|
|
6
6
|
|
7
7
|
module RubyLsp
|
8
8
|
# This rake task checks that all requests or extensions are fully documented. Add the rake task to your Rakefile and
|
9
|
-
# specify the absolute path for all files that must be required in order to discover all listeners
|
9
|
+
# specify the absolute path for all files that must be required in order to discover all listeners and their
|
10
|
+
# related GIFs
|
10
11
|
#
|
11
12
|
# # Rakefile
|
12
13
|
# request_files = FileList.new("#{__dir__}/lib/ruby_lsp/requests/*.rb") do |fl|
|
13
14
|
# fl.exclude(/base_request\.rb/)
|
14
15
|
# end
|
15
|
-
#
|
16
|
+
# gif_files = FileList.new("#{__dir__}/**/*.gif")
|
17
|
+
# RubyLsp::CheckDocs.new(request_files, gif_files)
|
16
18
|
# # Run with bundle exec rake ruby_lsp:check_docs
|
17
19
|
class CheckDocs < Rake::TaskLib
|
18
20
|
extend T::Sig
|
19
21
|
|
20
|
-
sig { params(require_files: Rake::FileList).void }
|
21
|
-
def initialize(require_files)
|
22
|
+
sig { params(require_files: Rake::FileList, gif_files: Rake::FileList).void }
|
23
|
+
def initialize(require_files, gif_files)
|
22
24
|
super()
|
23
25
|
|
24
26
|
@name = T.let("ruby_lsp:check_docs", String)
|
25
27
|
@file_list = require_files
|
28
|
+
@gif_list = gif_files
|
26
29
|
define_task
|
27
30
|
end
|
28
31
|
|
@@ -34,6 +37,13 @@ module RubyLsp
|
|
34
37
|
task(@name) { run_task }
|
35
38
|
end
|
36
39
|
|
40
|
+
sig { params(request_path: String).returns(T::Boolean) }
|
41
|
+
def gif_exists?(request_path)
|
42
|
+
request_gif = request_path.gsub(".rb", ".gif").split("/").last
|
43
|
+
|
44
|
+
@gif_list.any? { |gif_path| gif_path.end_with?(request_gif) }
|
45
|
+
end
|
46
|
+
|
37
47
|
sig { void }
|
38
48
|
def run_task
|
39
49
|
# Require all files configured to make sure all listeners are loaded
|
@@ -93,6 +103,14 @@ module RubyLsp
|
|
93
103
|
|
94
104
|
# [Inlay hint demo](../../inlay_hint.gif)
|
95
105
|
DOCS
|
106
|
+
elsif !gif_exists?(file_path)
|
107
|
+
T.must(missing_docs[class_name]) << <<~DOCS
|
108
|
+
The GIF for the request documentation does not exist. Make sure to add it,
|
109
|
+
with the same naming as the request. For example:
|
110
|
+
|
111
|
+
# lib/ruby_lsp/requests/code_lens.rb
|
112
|
+
# foo/bar/code_lens.gif
|
113
|
+
DOCS
|
96
114
|
end
|
97
115
|
end
|
98
116
|
|
@@ -80,11 +80,13 @@ module RubyLsp
|
|
80
80
|
|
81
81
|
sig { params(node: SyntaxTree::DefNode).void }
|
82
82
|
def on_def(node)
|
83
|
+
class_name = @class_stack.last
|
84
|
+
return unless class_name
|
85
|
+
|
83
86
|
visibility, _ = @visibility_stack.last
|
84
87
|
if visibility == "public"
|
85
88
|
method_name = node.name.value
|
86
89
|
if method_name.start_with?("test_")
|
87
|
-
class_name = T.must(@class_stack.last)
|
88
90
|
add_test_code_lens(
|
89
91
|
node,
|
90
92
|
name: method_name,
|
@@ -193,8 +195,10 @@ module RubyLsp
|
|
193
195
|
|
194
196
|
sig { params(node: SyntaxTree::Command).returns(T.nilable(String)) }
|
195
197
|
def resolve_gem_remote(node)
|
196
|
-
|
197
|
-
|
198
|
+
gem_statement = node.arguments.parts.flat_map(&:child_nodes).first
|
199
|
+
return unless gem_statement
|
200
|
+
|
201
|
+
spec = Gem::Specification.stubs.find { |gem| gem.name == gem_statement.value }&.to_spec
|
198
202
|
return if spec.nil?
|
199
203
|
|
200
204
|
[spec.homepage, spec.metadata["source_code_uri"]].compact.find do |page|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module RubyLsp
|
5
5
|
module Requests
|
6
|
-
# 
|
7
7
|
#
|
8
8
|
# [Inlay hints](https://microsoft.github.io/language-server-protocol/specification#textDocument_inlayHint)
|
9
9
|
# are labels added directly in the code that explicitly show the user something that might
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: language_server-protocol
|