ruby-lsp-mongoid 0.1.2 → 0.1.3
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: 8fbccb41fea414098880ead42297015e17b7f8e375efd0a389fcf6ffc9f50ac8
|
|
4
|
+
data.tar.gz: f3e1eb7a9271a97b00f314f88e755a5aabfde5f9fb700d031e0709eb20bae9c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f28b770bf135a4e1c1eddeeb3368ad05793054f535dd2ae8f08c07a6d2bbab75b2732227950cdb784e89d98ccf8747581eceff8fd347956eeda247aac21213a8
|
|
7
|
+
data.tar.gz: 17c8daf234ffb9ee7d3587437ae6439dd098018b4521dfc11ccb8315a20c2662e204f6385b66a065f2cf6e12f4184cdf2f433eb72fc23bc69f68a8722bc7905e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- Fix "can't add a new key into hash during iteration" error caused by concurrent hash modification when background signature update thread iterates while ruby-lsp modifies the index
|
|
6
|
+
- Fix compatibility with ruby-lsp 0.26.5+ by using `@listener.add_method` instead of directly calling `Entry::Method.new`
|
|
7
|
+
|
|
3
8
|
## [0.1.2] - 2025-12-15
|
|
4
9
|
|
|
5
10
|
### Added
|
|
@@ -89,7 +89,10 @@ module RubyLsp
|
|
|
89
89
|
|
|
90
90
|
# Find all classes that have this method registered by our addon
|
|
91
91
|
# We look for methods that were registered with empty signatures
|
|
92
|
-
|
|
92
|
+
# Use dup to avoid "can't add a new key into hash during iteration" error
|
|
93
|
+
# when ruby-lsp modifies the index concurrently
|
|
94
|
+
entries_snapshot = index.instance_variable_get(:@entries).dup
|
|
95
|
+
entries_snapshot.each do |_name, entries|
|
|
93
96
|
entries.each do |entry|
|
|
94
97
|
next unless entry.is_a?(RubyIndexer::Entry::Method)
|
|
95
98
|
next unless entry.name == method_name
|
|
@@ -107,7 +110,9 @@ module RubyLsp
|
|
|
107
110
|
def update_singleton_method_signatures_for_mongoid_models(index, method_name, new_signatures)
|
|
108
111
|
updated = 0
|
|
109
112
|
|
|
110
|
-
|
|
113
|
+
# Use dup to avoid "can't add a new key into hash during iteration" error
|
|
114
|
+
entries_snapshot = index.instance_variable_get(:@entries).dup
|
|
115
|
+
entries_snapshot.each do |_name, entries|
|
|
111
116
|
entries.each do |entry|
|
|
112
117
|
next unless entry.is_a?(RubyIndexer::Entry::Method)
|
|
113
118
|
next unless entry.name == method_name
|
|
@@ -254,22 +254,14 @@ module RubyLsp
|
|
|
254
254
|
|
|
255
255
|
def add_singleton_method_with_signatures(name, node_location, owner, signatures)
|
|
256
256
|
index = @listener.instance_variable_get(:@index)
|
|
257
|
-
|
|
258
|
-
uri = @listener.instance_variable_get(:@uri)
|
|
257
|
+
owner_stack = @listener.instance_variable_get(:@owner_stack)
|
|
259
258
|
|
|
260
|
-
location = RubyIndexer::Location.from_prism_location(node_location, code_units_cache)
|
|
261
259
|
singleton = index.existing_or_new_singleton_class(owner.name)
|
|
260
|
+
owner_stack << singleton
|
|
262
261
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
location,
|
|
267
|
-
location,
|
|
268
|
-
"",
|
|
269
|
-
signatures,
|
|
270
|
-
:public,
|
|
271
|
-
singleton,
|
|
272
|
-
))
|
|
262
|
+
@listener.add_method(name, node_location, signatures)
|
|
263
|
+
|
|
264
|
+
owner_stack.pop
|
|
273
265
|
end
|
|
274
266
|
|
|
275
267
|
def extract_lambda_node(call_node)
|