ruby-lsp-rspec 0.1.4 → 0.1.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: '069b0b51df97131fda2b2f12ae5c60b121e137264ebfed035f7598109b6736d6'
4
- data.tar.gz: ef08e13d94031ddb243085a85f24cf53ec57d67bcd32ef2feeae44c7c6e672a7
3
+ metadata.gz: 94c72f8fcd6ded9ad2ce93a0d55b9358bd96f82d8bd33fcffe7bc0a8e871fe49
4
+ data.tar.gz: d91f21f2f77423d171239cb4a030447d2ab930f95b50209c6672cdb6c9bd1601
5
5
  SHA512:
6
- metadata.gz: 9f09130b66123ed6d61f9857e7da3bcc575d5b154b53b331c77dfd0a578c46b5bb92276e53778b0148500986190da677efb2afea20804732b58e687f4933ddfa
7
- data.tar.gz: 6b33d00c07a2ec17fc3fc9c77f6efcb3fda86481b40357f32e7cb5b9f045a6928c47ec2bc0d2d0781f11de9156cc72cf881b6f06f6179d5174d0b3204387b1e5
6
+ metadata.gz: 5ba68d0ac94f0fdd1ca3c738899c7f6fb3b4bf19af6fefd2c8fd8cc8eeb85192c6a8268cd60bd7b638fbee9008cefd8bdfefe7b50d99de4bd8ecb92d726e7818
7
+ data.tar.gz: 3271d7a453a7cd4623b69626a49b9de22c32d6fdd04b714fea4a8d6b0d2afc4ce4b11046169e79eff4b97f8b172b303378167c0a52b5d5a600a18c09b005f80f
data/README.md CHANGED
@@ -13,7 +13,7 @@ To install, add the following line to your application's Gemfile:
13
13
  ```ruby
14
14
  # Gemfile
15
15
  group :development do
16
- gem "ruby-lsp-rspec"
16
+ gem "ruby-lsp-rspec", require: false
17
17
  end
18
18
  ```
19
19
 
@@ -26,6 +26,8 @@ module RubyLsp
26
26
  ).returns(T.nilable(Listener[T::Array[Interface::CodeLens]]))
27
27
  end
28
28
  def create_code_lens_listener(uri, emitter, message_queue)
29
+ return unless uri.to_standardized_path&.end_with?("_test.rb") || uri.to_standardized_path&.end_with?("_spec.rb")
30
+
29
31
  CodeLens.new(uri, emitter, message_queue)
30
32
  end
31
33
 
@@ -17,7 +17,8 @@ module RubyLsp
17
17
  sig { params(uri: URI::Generic, dispatcher: Prism::Dispatcher, message_queue: Thread::Queue).void }
18
18
  def initialize(uri, dispatcher, message_queue)
19
19
  @_response = T.let([], ResponseType)
20
- @path = T.let(uri.to_standardized_path, T.nilable(String))
20
+ # Listener is only initialized if uri.to_standardized_path is valid
21
+ @path = T.let(T.must(uri.to_standardized_path), String)
21
22
  dispatcher.register(self, :on_call_node_enter)
22
23
 
23
24
  @base_command = T.let(
@@ -42,11 +43,11 @@ module RubyLsp
42
43
 
43
44
  sig { params(node: Prism::CallNode).void }
44
45
  def on_call_node_enter(node)
45
- message_value = node.message
46
- if message_value == "it"
46
+ case node.message
47
+ when "example", "it", "specify"
47
48
  name = generate_name(node)
48
49
  add_test_code_lens(node, name: name, kind: :example)
49
- elsif message_value == "describe" || message_value == "context"
50
+ when "context", "describe"
50
51
  return if node.receiver && node.receiver.name.to_s != "RSpec"
51
52
 
52
53
  name = generate_name(node)
@@ -78,8 +79,6 @@ module RubyLsp
78
79
 
79
80
  sig { params(node: Prism::Node, name: String, kind: Symbol).void }
80
81
  def add_test_code_lens(node, name:, kind:)
81
- return unless @path
82
-
83
82
  line_number = node.location.start_line
84
83
  command = "#{@base_command} #{@path}:#{line_number}"
85
84
 
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module RSpec
6
- VERSION = "0.1.4"
6
+ VERSION = "0.1.6"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Lo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2023-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lsp