rubydex 0.2.4-aarch64-linux → 0.2.5-aarch64-linux

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.
@@ -1,20 +1,34 @@
1
1
  use super::normalize_indentation;
2
2
  #[cfg(test)]
3
3
  use crate::diagnostic::Rule;
4
- use crate::indexing::{self, LanguageId};
4
+ use crate::indexing::{self, IndexerBackend, LanguageId};
5
5
  use crate::model::graph::{Graph, NameDependent};
6
6
  use crate::model::ids::{NameId, StringId};
7
7
  use crate::resolution::Resolver;
8
8
 
9
- #[derive(Default)]
10
9
  pub struct GraphTest {
11
10
  graph: Graph,
11
+ backend: IndexerBackend,
12
+ }
13
+
14
+ impl Default for GraphTest {
15
+ fn default() -> Self {
16
+ Self::new()
17
+ }
12
18
  }
13
19
 
14
20
  impl GraphTest {
15
21
  #[must_use]
16
22
  pub fn new() -> Self {
17
- Self { graph: Graph::new() }
23
+ Self::new_with_backend(IndexerBackend::RubyIndexer)
24
+ }
25
+
26
+ #[must_use]
27
+ pub fn new_with_backend(backend: IndexerBackend) -> Self {
28
+ Self {
29
+ graph: Graph::new(),
30
+ backend,
31
+ }
18
32
  }
19
33
 
20
34
  #[must_use]
@@ -30,7 +44,8 @@ impl GraphTest {
30
44
  /// Indexes a Ruby source
31
45
  pub fn index_uri(&mut self, uri: &str, source: &str) {
32
46
  let source = normalize_indentation(source);
33
- indexing::index_source(&mut self.graph, uri, &source, &LanguageId::Ruby);
47
+ let local_graph = indexing::build_local_graph(uri.to_string(), &source, &LanguageId::Ruby, self.backend);
48
+ self.graph.consume_document_changes(local_graph);
34
49
  }
35
50
 
36
51
  /// Indexes an RBS source
@@ -1,7 +1,7 @@
1
1
  use super::normalize_indentation;
2
2
  use crate::indexing::local_graph::LocalGraph;
3
3
  use crate::indexing::rbs_indexer::RBSIndexer;
4
- use crate::indexing::ruby_indexer::RubyIndexer;
4
+ use crate::indexing::{IndexerBackend, LanguageId, build_local_graph};
5
5
  use crate::model::definitions::Definition;
6
6
  use crate::model::graph::NameDependent;
7
7
  use crate::model::ids::{NameId, StringId, UriId};
@@ -19,13 +19,14 @@ pub struct LocalGraphTest {
19
19
  impl LocalGraphTest {
20
20
  #[must_use]
21
21
  pub fn new(uri: &str, source: &str) -> Self {
22
+ Self::new_with_backend(uri, source, IndexerBackend::RubyIndexer)
23
+ }
24
+
25
+ #[must_use]
26
+ pub fn new_with_backend(uri: &str, source: &str, backend: IndexerBackend) -> Self {
22
27
  let uri = uri.to_string();
23
28
  let source = normalize_indentation(source);
24
-
25
- let mut indexer = RubyIndexer::new(uri.clone(), &source);
26
- indexer.index();
27
- let graph = indexer.local_graph();
28
-
29
+ let graph = build_local_graph(uri.clone(), &source, &LanguageId::Ruby, backend);
29
30
  Self { uri, source, graph }
30
31
  }
31
32
 
@@ -54,7 +54,11 @@ impl RubydexServer {
54
54
  }
55
55
 
56
56
  let mut graph = Graph::new();
57
- let errors = rubydex::indexing::index_files(&mut graph, file_paths);
57
+ let errors = rubydex::indexing::index_files(
58
+ &mut graph,
59
+ file_paths,
60
+ rubydex::indexing::IndexerBackend::RubyIndexer,
61
+ );
58
62
  for error in &errors {
59
63
  eprintln!("Indexing error: {error}");
60
64
  }
@@ -276,6 +276,30 @@ pub unsafe extern "C" fn rdx_definition_declaration(pointer: GraphPointer, defin
276
276
  })
277
277
  }
278
278
 
279
+ /// Returns the lexical nesting definition id for the given definition, or NULL if there is no lexical nesting.
280
+ /// Caller must free the returned pointer with `free_u64`.
281
+ ///
282
+ /// # Safety
283
+ /// - `pointer` must be a valid pointer previously returned by `rdx_graph_new`.
284
+ /// - `definition_id` must be a valid definition id.
285
+ ///
286
+ /// # Panics
287
+ /// This function will panic if the definition cannot be found.
288
+ #[unsafe(no_mangle)]
289
+ pub unsafe extern "C" fn rdx_definition_lexical_nesting_id(pointer: GraphPointer, definition_id: u64) -> *const u64 {
290
+ with_graph(pointer, |graph| {
291
+ let def_id = DefinitionId::new(definition_id);
292
+ let Some(defn) = graph.definitions().get(&def_id) else {
293
+ panic!("Definition not found: {definition_id:?}");
294
+ };
295
+
296
+ match defn.lexical_nesting_id() {
297
+ Some(lexical_nesting_id) => Box::into_raw(Box::new(**lexical_nesting_id)).cast_const(),
298
+ None => ptr::null(),
299
+ }
300
+ })
301
+ }
302
+
279
303
  /// Creates a new iterator over definition IDs for a given declaration by snapshotting the current set of IDs.
280
304
  ///
281
305
  /// # Panics
@@ -233,7 +233,7 @@ pub unsafe extern "C" fn rdx_index_all(
233
233
 
234
234
  with_mut_graph(pointer, |graph| {
235
235
  let (file_paths, listing_errors) = listing::collect_file_paths(file_paths, graph.excluded_paths());
236
- let indexing_errors = indexing::index_files(graph, file_paths);
236
+ let indexing_errors = indexing::index_files(graph, file_paths, indexing::IndexerBackend::RubyIndexer);
237
237
 
238
238
  let all_errors: Vec<String> = listing_errors
239
239
  .into_iter()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-26 00:00:00.000000000 Z
11
+ date: 2026-05-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A high-performance static analysis suite for Ruby, built in Rust with
14
14
  Ruby APIs
@@ -16,6 +16,7 @@ email:
16
16
  - ruby@shopify.com
17
17
  executables:
18
18
  - rdx
19
+ - rubydex_mcp
19
20
  extensions: []
20
21
  extra_rdoc_files: []
21
22
  files:
@@ -23,6 +24,7 @@ files:
23
24
  - README.md
24
25
  - THIRD_PARTY_LICENSES.html
25
26
  - exe/rdx
27
+ - exe/rubydex_mcp
26
28
  - ext/rubydex/declaration.c
27
29
  - ext/rubydex/declaration.h
28
30
  - ext/rubydex/definition.c
@@ -49,6 +51,7 @@ files:
49
51
  - lib/rubydex/3.3/rubydex.so
50
52
  - lib/rubydex/3.4/rubydex.so
51
53
  - lib/rubydex/4.0/rubydex.so
54
+ - lib/rubydex/bin/rubydex_mcp
52
55
  - lib/rubydex/comment.rb
53
56
  - lib/rubydex/declaration.rb
54
57
  - lib/rubydex/diagnostic.rb
@@ -118,6 +121,10 @@ files:
118
121
  - rust/rubydex/src/model/string_ref.rs
119
122
  - rust/rubydex/src/model/visibility.rs
120
123
  - rust/rubydex/src/offset.rs
124
+ - rust/rubydex/src/operation/applier.rs
125
+ - rust/rubydex/src/operation/mod.rs
126
+ - rust/rubydex/src/operation/printer.rs
127
+ - rust/rubydex/src/operation/ruby_builder.rs
121
128
  - rust/rubydex/src/position.rs
122
129
  - rust/rubydex/src/query.rs
123
130
  - rust/rubydex/src/resolution.rs