ruby-lsp 0.16.0 → 0.16.2

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: faf267ef6ce1eb7c9471d0a63b07c8da3d60ae1aeb656b63eedb64c493746e18
4
- data.tar.gz: 56cd98100e674d8e3de391cb107efb7c4b713715494f212f879e687d2c26cda4
3
+ metadata.gz: a3b197d35d03d1b5b78894bce8b03c6aa76be7586fc7034422415d0656ddea7a
4
+ data.tar.gz: 2fd148c0ab5d8b3ac55784722ab49a3be6b1b4885c8b284e8a6cf40c503b4066
5
5
  SHA512:
6
- metadata.gz: 75077a56844015e9915c1232102eca5e5bcc40687207579367b9ce836525a369e4d87e2a3e89223ca4af3bad1b8fdf09648d2839a756d171fefdc2c7d38c9df4
7
- data.tar.gz: '025321865d6799a4ca874296d2552d8ec71f7ffa3023a104f74633ae9b858ab757dd5babee429aa38b04c1820ce64c4f7416aa626267189ac43d262744698369'
6
+ metadata.gz: 1994f1d014bc3f70ff96e90d5b3961c279166e5f58be6b38415ec1e2515b7557c6a00f4cde45ba3a66e0d9dd6c1402f7e4754c6f8addb6efb848ec7a65fbadc7
7
+ data.tar.gz: ffec2a6c5321eb159ea4d505f9b6c6dd56b64cb16d2f052666b9c15f406d59fa478d9e7f7c9734219874c3ca3bb8dcae9b2cbdd683576a3d74b523cf769298e4
data/README.md CHANGED
@@ -29,7 +29,7 @@ The Ruby LSP features include
29
29
  - Debugging support
30
30
  - Running and debugging tests through VS Code's UI
31
31
  - Go to definition for classes, modules, constants and required files
32
- - Showing documentaton on hover for classes, modules and constants
32
+ - Showing documentation on hover for classes, modules and constants
33
33
  - Completion for classes, modules, constants and require paths
34
34
  - Fuzzy search classes, modules and constants anywhere in the project and its dependencies (workspace symbol)
35
35
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.0
1
+ 0.16.2
@@ -21,7 +21,7 @@ module RubyLsp
21
21
  def initialize
22
22
  @workspace_uri = T.let(URI::Generic.from_path(path: Dir.pwd), URI::Generic)
23
23
 
24
- @formatter = T.let(detect_formatter, String)
24
+ @formatter = T.let("auto", String)
25
25
  @test_library = T.let(detect_test_library, String)
26
26
  @typechecker = T.let(detect_typechecker, T::Boolean)
27
27
  @index = T.let(RubyIndexer::Index.new, RubyIndexer::Index)
@@ -42,6 +42,10 @@ module RubyLsp
42
42
  def apply_options(options)
43
43
  workspace_uri = options.dig(:workspaceFolders, 0, :uri)
44
44
  @workspace_uri = URI(workspace_uri) if workspace_uri
45
+
46
+ specified_formatter = options.dig(:initializationOptions, :formatter)
47
+ @formatter = specified_formatter if specified_formatter
48
+ @formatter = detect_formatter if @formatter == "auto"
45
49
  end
46
50
 
47
51
  sig { returns(String) }
@@ -63,17 +67,17 @@ module RubyLsp
63
67
 
64
68
  sig { returns(String) }
65
69
  def detect_test_library
70
+ if direct_dependency?(/^rspec/)
71
+ "rspec"
66
72
  # A Rails app may have a dependency on minitest, but we would instead want to use the Rails test runner provided
67
73
  # by ruby-lsp-rails.
68
- if direct_dependency?(/^rails$/)
74
+ elsif direct_dependency?(/^rails$/)
69
75
  "rails"
70
76
  # NOTE: Intentionally ends with $ to avoid mis-matching minitest-reporters, etc. in a Rails app.
71
77
  elsif direct_dependency?(/^minitest$/)
72
78
  "minitest"
73
79
  elsif direct_dependency?(/^test-unit/)
74
80
  "test-unit"
75
- elsif direct_dependency?(/^rspec/)
76
- "rspec"
77
81
  else
78
82
  "unknown"
79
83
  end
@@ -68,17 +68,22 @@ module RubyLsp
68
68
  command: generate_test_command(group_stack: @group_stack),
69
69
  kind: :group,
70
70
  )
71
- end
72
71
 
73
- @group_id_stack.push(@group_id)
74
- @group_id += 1
72
+ @group_id_stack.push(@group_id)
73
+ @group_id += 1
74
+ end
75
75
  end
76
76
 
77
77
  sig { params(node: Prism::ClassNode).void }
78
78
  def on_class_node_leave(node)
79
79
  @visibility_stack.pop
80
80
  @group_stack.pop
81
- @group_id_stack.pop
81
+
82
+ class_name = node.constant_path.slice
83
+
84
+ if @path && class_name.end_with?("Test")
85
+ @group_id_stack.pop
86
+ end
82
87
  end
83
88
 
84
89
  sig { params(node: Prism::DefNode).void }
@@ -129,8 +129,6 @@ module RubyLsp
129
129
 
130
130
  progress = options.dig(:capabilities, :window, :workDoneProgress)
131
131
  @store.supports_progress = progress.nil? ? true : progress
132
- formatter = options.dig(:initializationOptions, :formatter) || "auto"
133
-
134
132
  configured_features = options.dig(:initializationOptions, :enabledFeatures)
135
133
  @store.experimental_features = options.dig(:initializationOptions, :experimentalFeaturesEnabled) || false
136
134
 
@@ -177,7 +175,7 @@ module RubyLsp
177
175
  document_link_provider: document_link_provider,
178
176
  folding_range_provider: folding_ranges_provider,
179
177
  semantic_tokens_provider: semantic_tokens_provider,
180
- document_formatting_provider: enabled_features["formatting"] && formatter != "none",
178
+ document_formatting_provider: enabled_features["formatting"] && @global_state.formatter != "none",
181
179
  document_highlight_provider: enabled_features["documentHighlights"],
182
180
  code_action_provider: code_action_provider,
183
181
  document_on_type_formatting_provider: on_type_formatting_provider,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-02 00:00:00.000000000 Z
11
+ date: 2024-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: language_server-protocol