ruby-lsp-rspec 0.1.6 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94c72f8fcd6ded9ad2ce93a0d55b9358bd96f82d8bd33fcffe7bc0a8e871fe49
4
- data.tar.gz: d91f21f2f77423d171239cb4a030447d2ab930f95b50209c6672cdb6c9bd1601
3
+ metadata.gz: b1ad8f1f88836c6c7cb084237b83d36b7b8d73edf94eebe765f0fba6bb32e1a3
4
+ data.tar.gz: 632cc2d492f00b07d966aaa53b8534721e17753b258edfaa43205a96e6bab906
5
5
  SHA512:
6
- metadata.gz: 5ba68d0ac94f0fdd1ca3c738899c7f6fb3b4bf19af6fefd2c8fd8cc8eeb85192c6a8268cd60bd7b638fbee9008cefd8bdfefe7b50d99de4bd8ecb92d726e7818
7
- data.tar.gz: 3271d7a453a7cd4623b69626a49b9de22c32d6fdd04b714fea4a8d6b0d2afc4ce4b11046169e79eff4b97f8b172b303378167c0a52b5d5a600a18c09b005f80f
6
+ metadata.gz: 9de20795a46221eeab3932fe830c25f019d940b757fbfd5e8dfe88bfae922e7658791747ae361ab51a6c30dbfdd30bbf97708cdb7b144414fecdb8e477c7c7c1
7
+ data.tar.gz: e2c796c111cdba975216f7856fdcbd0765e2d898cc0389f2fb2df7898a5a2d58d1a8f4a64bd98afb4de556a0df6e48e2a610d005db520993becbeaa2dd877529
@@ -3,7 +3,6 @@
3
3
 
4
4
  require "sorbet-runtime"
5
5
  require "ruby_lsp_rspec/version"
6
- require "ruby_lsp/ruby_lsp_rspec/addon"
7
6
 
8
7
  module RubyLsp
9
8
  module RSpec
@@ -19,7 +19,9 @@ module RubyLsp
19
19
  @_response = T.let([], ResponseType)
20
20
  # Listener is only initialized if uri.to_standardized_path is valid
21
21
  @path = T.let(T.must(uri.to_standardized_path), String)
22
- dispatcher.register(self, :on_call_node_enter)
22
+ @group_id = T.let(1, Integer)
23
+ @group_id_stack = T.let([], T::Array[Integer])
24
+ dispatcher.register(self, :on_call_node_enter, :on_call_node_leave)
23
25
 
24
26
  @base_command = T.let(
25
27
  begin
@@ -52,6 +54,19 @@ module RubyLsp
52
54
 
53
55
  name = generate_name(node)
54
56
  add_test_code_lens(node, name: name, kind: :group)
57
+
58
+ @group_id_stack.push(@group_id)
59
+ @group_id += 1
60
+ end
61
+ end
62
+
63
+ sig { params(node: Prism::CallNode).void }
64
+ def on_call_node_leave(node)
65
+ case node.message
66
+ when "context", "describe"
67
+ return if node.receiver && node.receiver.name.to_s != "RSpec"
68
+
69
+ @group_id_stack.pop
55
70
  end
56
71
  end
57
72
 
@@ -82,6 +97,9 @@ module RubyLsp
82
97
  line_number = node.location.start_line
83
98
  command = "#{@base_command} #{@path}:#{line_number}"
84
99
 
100
+ grouping_data = { group_id: @group_id_stack.last, kind: kind }
101
+ grouping_data[:id] = @group_id if kind == :group
102
+
85
103
  arguments = [
86
104
  @path,
87
105
  name,
@@ -99,7 +117,7 @@ module RubyLsp
99
117
  title: "Run",
100
118
  command_name: "rubyLsp.runTest",
101
119
  arguments: arguments,
102
- data: { type: "test", kind: kind },
120
+ data: { type: "test", **grouping_data },
103
121
  )
104
122
 
105
123
  @_response << create_code_lens(
@@ -107,7 +125,7 @@ module RubyLsp
107
125
  title: "Run In Terminal",
108
126
  command_name: "rubyLsp.runTestInTerminal",
109
127
  arguments: arguments,
110
- data: { type: "test_in_terminal", kind: kind },
128
+ data: { type: "test_in_terminal", **grouping_data },
111
129
  )
112
130
 
113
131
  @_response << create_code_lens(
@@ -115,7 +133,7 @@ module RubyLsp
115
133
  title: "Debug",
116
134
  command_name: "rubyLsp.debugTest",
117
135
  arguments: arguments,
118
- data: { type: "debug", kind: kind },
136
+ data: { type: "debug", **grouping_data },
119
137
  )
120
138
  end
121
139
  end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module RSpec
6
- VERSION = "0.1.6"
6
+ VERSION = "0.1.7"
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.6
4
+ version: 0.1.7
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-11-28 00:00:00.000000000 Z
11
+ date: 2023-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lsp