ruby-lsp-rspec 0.1.15 → 0.1.16

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: 79c44a257a6397dd3c0fc255c4bcc32b8766d1430f6c5f3e8fb31349615b549a
4
- data.tar.gz: 31f87a129243a71c60759e239a7e48b0333dfdb85da5e48b34c6dfa48fea53d8
3
+ metadata.gz: 8ee975e071dae85f67f651eae432c395c5e1e11ce0e49d3287a109f4b6bb4015
4
+ data.tar.gz: fe19cccd32213234a643ed076809a9dda8a5e732c5df4a3f692cc8b48976dc82
5
5
  SHA512:
6
- metadata.gz: 1ab1b4fb860e5cc8793b46e6c18d5dd819f97288530ad8ed37f6fc975e3ad3e8ac36e25a77ce7665f85a805a3926f4adf9e8a352d8112f68d958588d50cbb3b8
7
- data.tar.gz: ddb9bd8072cff3153d2db93af3bef525127b4c4a1dff871dd75dd4265e7959c1c8f944e9b81084c0d99dd2ddd406cfdeabd33f3663d548472413822725a4cf79
6
+ metadata.gz: b413a288abc15b33c20447eea18e8c6825b3ec27c16e3919c9012c492062491b628952d7b3507b5067751f6ae4cba30de1baa069e087e3f6c30940c10835135b
7
+ data.tar.gz: ff98f027f9d7be1a9d2db2ddde55dc5fce4039a22ce406e34afd6beeadc526bd412ed0e57343bf36a712db23d4b9aff393bf5f555918da6884d5847d7770ff30
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
- ![Screenshot of the code lenses](/misc/example.gif)
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
- ## Usages (with VS Code)
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
- 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).
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
 
@@ -74,7 +74,7 @@ module RubyLsp
74
74
 
75
75
  case argument
76
76
  when Prism::StringNode
77
- argument.content.dump
77
+ argument.unescaped
78
78
  when Prism::CallNode
79
79
  "<#{argument.name}>"
80
80
  when nil
@@ -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,
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module RSpec
6
- VERSION = "0.1.15"
6
+ VERSION = "0.1.16"
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.15
4
+ version: 0.1.16
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-06 00:00:00.000000000 Z
11
+ date: 2024-10-19 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.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.19.0
26
+ version: 0.20.1
27
27
  description: RSpec addon for ruby-lsp
28
28
  email:
29
29
  - stan001212@gmail.com