ruby-lsp-rspec 0.1.15 → 0.1.17
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43af0ed802cbfedcb5157150ca7a532347bd61d7f672bd3a3c70decb6460422b
|
4
|
+
data.tar.gz: 9a9a54650225821e7a5296090f6a546febfb4040eeecc3c8405040c3b8a390cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 184b40befc64cc43c53eef48838cdab685422e97c1e92207a6abe042ba8fd1df7bf6d43584f400ee43b91c8aa8bab6f7dfbba6fbc2f5e26616e05850cdc6d0a7
|
7
|
+
data.tar.gz: afc524ecaa9acdaaf1338828a8ebaee32bd5519473905d63ccd6715c6dfcac75da7db74c3e6a1b0534c3e58691f47e511ad5cb84f0712cf91461b3ed74993c14
|
data/README.md
CHANGED
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
Ruby LSP RSpec is a [Ruby LSP](https://github.com/Shopify/ruby-lsp) addon for displaying CodeLens for RSpec tests.
|
6
6
|
|
7
|
-

|
8
|
-
|
9
7
|
## Installation
|
10
8
|
|
11
9
|
To install, add the following line to your application's Gemfile:
|
@@ -19,14 +17,41 @@ end
|
|
19
17
|
|
20
18
|
After running `bundle install`, restart Ruby LSP and you should start seeing CodeLens in your RSpec test files.
|
21
19
|
|
22
|
-
##
|
20
|
+
## Features
|
21
|
+
|
22
|
+
### CodeLens
|
23
|
+
|
24
|
+
1. When clicking `Run`, the test(s) will be executed via the Test Explorer
|
25
|
+
- However, deeply nested tests may not be displayed correctly at the moment
|
26
|
+
2. When clicking `Run In Terminal`, a test command will be generated in the terminal
|
27
|
+
3. When clicking `Debug`, the test(s) will be executed with VS Code debugger enabled (requires the [`debug`](https://github.com/ruby/debug) gem)
|
28
|
+
- [Learn how to set breakpoints in VS Code](https://code.visualstudio.com/docs/editor/debugging#_breakpoints)
|
29
|
+
|
30
|
+
<img src="misc/code-lens.gif" alt="CodeLens" width="75%">
|
31
|
+
|
32
|
+
### Document Symbols
|
33
|
+
|
34
|
+
Document Symbols can be triggered by:
|
35
|
+
|
36
|
+
- Typing `@` in VS Code's command palette
|
37
|
+
- Pressing `Cmd+Shift+O`
|
38
|
+
|
39
|
+
<img src="misc/document-symbol.gif" alt="Document Symbols" width="75%">
|
40
|
+
|
41
|
+
### Go to definition
|
42
|
+
|
43
|
+
`ruby-lsp-rspec` supports go-to-definition on methods defined through `let` and `subject` DSLs in spec files.
|
44
|
+
|
45
|
+
In VS Code this feature can be triggered by one of the following methods:
|
46
|
+
|
47
|
+
- `Right click` on the target, and then select `Go to Definition`
|
48
|
+
- Placing the cursor on the target, and then hit `F12`
|
49
|
+
- `Command + click` the target
|
23
50
|
|
24
|
-
|
25
|
-
|
26
|
-
2. When clicking `Run In Terminal`, a test command will be generated in the terminal.
|
27
|
-
3. When clicking `Debug`, the test(s) will be executed with VS Code debugger enabled (requires the [`debug`](https://github.com/ruby/debug) gem).
|
28
|
-
- [Learn how to set breakpoints in VS Code](https://code.visualstudio.com/docs/editor/debugging#_breakpoints).
|
51
|
+
> [!Note]
|
52
|
+
> This feature requires indexing your spec files so they can't be excluded from Ruby LSP's indexing.
|
29
53
|
|
54
|
+
<img src="misc/go-to-definition.gif" alt="Go to definition" width="75%">
|
30
55
|
|
31
56
|
## Development
|
32
57
|
|
@@ -64,6 +64,8 @@ module RubyLsp
|
|
64
64
|
).void
|
65
65
|
end
|
66
66
|
def create_definition_listener(response_builder, uri, node_context, dispatcher)
|
67
|
+
return unless uri.to_standardized_path&.end_with?("_test.rb") || uri.to_standardized_path&.end_with?("_spec.rb")
|
68
|
+
|
67
69
|
Definition.new(response_builder, uri, node_context, T.must(@index), dispatcher)
|
68
70
|
end
|
69
71
|
|
@@ -13,9 +13,13 @@ module RubyLsp
|
|
13
13
|
owner: T.nilable(RubyIndexer::Entry::Namespace),
|
14
14
|
node: Prism::CallNode,
|
15
15
|
file_path: String,
|
16
|
+
code_units_cache: T.any(
|
17
|
+
T.proc.params(arg0: Integer).returns(Integer),
|
18
|
+
Prism::CodeUnitsCache,
|
19
|
+
),
|
16
20
|
).void
|
17
21
|
end
|
18
|
-
def on_call_node(index, owner, node, file_path)
|
22
|
+
def on_call_node(index, owner, node, file_path, code_units_cache)
|
19
23
|
return if node.receiver
|
20
24
|
|
21
25
|
name = node.name
|
@@ -44,10 +48,9 @@ module RubyLsp
|
|
44
48
|
index.add(RubyIndexer::Entry::Method.new(
|
45
49
|
method_name,
|
46
50
|
file_path,
|
47
|
-
block_node.location,
|
48
|
-
block_node.location,
|
51
|
+
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
|
52
|
+
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
|
49
53
|
nil,
|
50
|
-
index.configuration.encoding,
|
51
54
|
[RubyIndexer::Entry::Signature.new([])],
|
52
55
|
RubyIndexer::Entry::Visibility::PUBLIC,
|
53
56
|
owner,
|
@@ -78,10 +81,9 @@ module RubyLsp
|
|
78
81
|
index.add(RubyIndexer::Entry::Method.new(
|
79
82
|
method_name,
|
80
83
|
file_path,
|
81
|
-
block_node.location,
|
82
|
-
block_node.location,
|
84
|
+
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
|
85
|
+
RubyIndexer::Location.from_prism_location(block_node.location, code_units_cache),
|
83
86
|
nil,
|
84
|
-
index.configuration.encoding,
|
85
87
|
[RubyIndexer::Entry::Signature.new([])],
|
86
88
|
RubyIndexer::Entry::Visibility::PUBLIC,
|
87
89
|
owner,
|
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
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stan Lo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-lsp
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.20.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.20.1
|
27
27
|
description: RSpec addon for ruby-lsp
|
28
28
|
email:
|
29
29
|
- stan001212@gmail.com
|