ruby-lsp-rspec 0.1.0 → 0.1.1

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: c36d67cb9d922ed7bcbd2e485bcac49fa2ea74aa460d7161bc224f55e3cecb00
4
- data.tar.gz: 48925c65752d53395dd31dd8b335ea5b62eb5182fffb4202384ddc05a609ff9a
3
+ metadata.gz: 74150c02942b6d08897dfd6a7f71ffe940c5188a9859d16f8955046ba3a4e3b0
4
+ data.tar.gz: 1c2971333a4f29057b52da192da119bc0c4aada607e215c2dc9b21ae0bb0c4e7
5
5
  SHA512:
6
- metadata.gz: f7b82553a837b8ea44a62a85c387e1f3c3b770fd9c239328a989aaf66a15496391338859c657b51b4403320f89b55e14ddc555d798f31fbab4395c137d5341d0
7
- data.tar.gz: 1c400c09903e197e5b0a727359a6f9d35e7b5c03f18c5ea6261647dbf63e760bcdf70e106fe726617712bf7ffeae3dc79dfa7db6ec5ff390c0d6aa1c0cf6e5d2
6
+ metadata.gz: 1adba0097a7596eba873dd0e5d664817b59c8c34dc6952acc9355907a87d232952447a7573e3d6462f2134a65ed38f667a14e19ea0dd231f66b10d726cc4eea1
7
+ data.tar.gz: b6a3bbfb962f5d2ac3307a12841478626189b6d07f586e096da408740ddfd134fedf3edec54298c9a002e9515f6ef05d804915ff50ac6006e361f087c9e6c378
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Ruby LSP RSpec
2
2
 
3
- Ruby LSP RSpec is a [Ruby LSP](https://github.com/Shopify/ruby-lsp) extension for displaying code-lenses for RSpec tests.
3
+ [![Gem Version](https://badge.fury.io/rb/ruby-lsp-rspec.svg)](https://badge.fury.io/rb/ruby-lsp-rspec)
4
4
 
5
- ![Screenshot of the code lenses](/misc/example.png)
5
+ Ruby LSP RSpec is a [Ruby LSP](https://github.com/Shopify/ruby-lsp) extension for displaying CodeLens for RSpec tests.
6
+
7
+ ![Screenshot of the code lenses](/misc/example.gif)
6
8
 
7
9
  ## Installation
8
10
 
@@ -15,7 +17,7 @@ group :development do
15
17
  end
16
18
  ```
17
19
 
18
- After running `bundle install`, restart Ruby LSP and you should start seeing code-lenses in your RSpec test files.
20
+ After running `bundle install`, restart Ruby LSP and you should start seeing CodeLens in your RSpec test files.
19
21
 
20
22
  ## Usages (with VS Code)
21
23
 
@@ -10,7 +10,6 @@ module RubyLsp
10
10
  include ::RubyLsp::Requests::Support::Common
11
11
 
12
12
  ResponseType = type_member { { fixed: T::Array[::RubyLsp::Interface::CodeLens] } }
13
- BASE_COMMAND = T.let((File.exist?("Gemfile.lock") ? "bundle exec rspec" : "rspec"), String)
14
13
 
15
14
  sig { override.returns(ResponseType) }
16
15
  attr_reader :_response
@@ -21,6 +20,23 @@ module RubyLsp
21
20
  @path = T.let(uri.to_standardized_path, T.nilable(String))
22
21
  emitter.register(self, :on_command, :on_command_call, :on_call)
23
22
 
23
+ @base_command = T.let(
24
+ begin
25
+ cmd = if File.exist?(File.join(Dir.pwd, "bin", "rspec"))
26
+ "bin/rspec"
27
+ else
28
+ "rspec"
29
+ end
30
+
31
+ if File.exist?("Gemfile.lock")
32
+ "bundle exec #{cmd}"
33
+ else
34
+ cmd
35
+ end
36
+ end,
37
+ String,
38
+ )
39
+
24
40
  super(emitter, message_queue)
25
41
  end
26
42
 
@@ -103,7 +119,7 @@ module RubyLsp
103
119
  return unless @path
104
120
 
105
121
  line_number = node.location.start_line
106
- command = "#{BASE_COMMAND} #{@path}:#{line_number}"
122
+ command = "#{@base_command} #{@path}:#{line_number}"
107
123
 
108
124
  arguments = [
109
125
  @path,
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module RSpec
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.1"
7
7
  end
8
8
  end
data/misc/example.gif ADDED
Binary file
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.0
4
+ version: 0.1.1
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-09-17 00:00:00.000000000 Z
11
+ date: 2023-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lsp
@@ -42,7 +42,7 @@ files:
42
42
  - lib/ruby_lsp/ruby_lsp_rspec/code_lens.rb
43
43
  - lib/ruby_lsp/ruby_lsp_rspec/extension.rb
44
44
  - lib/ruby_lsp_rspec/version.rb
45
- - misc/example.png
45
+ - misc/example.gif
46
46
  - sorbet/config
47
47
  - sorbet/rbi/annotations/rainbow.rbi
48
48
  - sorbet/rbi/gems/ast@2.4.2.rbi
data/misc/example.png DELETED
Binary file