rubydex 0.2.5-aarch64-linux → 0.2.7-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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -16
  3. data/THIRD_PARTY_LICENSES.html +45 -12
  4. data/exe/rdx +2 -0
  5. data/ext/rubydex/declaration.c +115 -106
  6. data/ext/rubydex/definition.c +123 -72
  7. data/ext/rubydex/diagnostic.c +5 -0
  8. data/ext/rubydex/document.c +51 -23
  9. data/ext/rubydex/extconf.rb +1 -1
  10. data/ext/rubydex/graph.c +253 -66
  11. data/ext/rubydex/handle.h +34 -5
  12. data/ext/rubydex/location.c +5 -0
  13. data/ext/rubydex/reference.c +51 -46
  14. data/ext/rubydex/rubydex.c +5 -0
  15. data/ext/rubydex/signature.c +5 -0
  16. data/ext/rubydex/utils.c +13 -0
  17. data/ext/rubydex/utils.h +4 -0
  18. data/lib/rubydex/3.2/rubydex.so +0 -0
  19. data/lib/rubydex/3.3/rubydex.so +0 -0
  20. data/lib/rubydex/3.4/rubydex.so +0 -0
  21. data/lib/rubydex/4.0/rubydex.so +0 -0
  22. data/lib/rubydex/bin/rubydex_mcp +0 -0
  23. data/lib/rubydex/errors.rb +11 -0
  24. data/lib/rubydex/graph.rb +9 -28
  25. data/lib/rubydex/librubydex_sys.so +0 -0
  26. data/lib/rubydex/location.rb +24 -0
  27. data/lib/rubydex/version.rb +1 -1
  28. data/lib/rubydex.rb +1 -0
  29. data/rbi/rubydex.rbi +40 -15
  30. data/rust/Cargo.lock +122 -17
  31. data/rust/rubydex/Cargo.toml +26 -2
  32. data/rust/rubydex/benches/graph_memory.rs +46 -0
  33. data/rust/rubydex/src/config.rs +275 -0
  34. data/rust/rubydex/src/dot.rs +609 -0
  35. data/rust/rubydex/src/errors.rs +2 -0
  36. data/rust/rubydex/src/indexing/rbs_indexer.rs +19 -1
  37. data/rust/rubydex/src/indexing/ruby_indexer.rs +4 -0
  38. data/rust/rubydex/src/lib.rs +8 -1
  39. data/rust/rubydex/src/main.rs +8 -5
  40. data/rust/rubydex/src/model/built_in.rs +5 -2
  41. data/rust/rubydex/src/model/comment.rs +2 -0
  42. data/rust/rubydex/src/model/declaration.rs +13 -51
  43. data/rust/rubydex/src/model/definitions.rs +13 -1
  44. data/rust/rubydex/src/model/document.rs +2 -0
  45. data/rust/rubydex/src/model/encoding.rs +2 -0
  46. data/rust/rubydex/src/model/graph.rs +88 -27
  47. data/rust/rubydex/src/model/identity_maps.rs +3 -0
  48. data/rust/rubydex/src/model/keywords.rs +3 -0
  49. data/rust/rubydex/src/model/name.rs +2 -0
  50. data/rust/rubydex/src/model/string_ref.rs +2 -0
  51. data/rust/rubydex/src/model/visibility.rs +3 -0
  52. data/rust/rubydex/src/operation/applier.rs +1 -0
  53. data/rust/rubydex/src/operation/mod.rs +1 -0
  54. data/rust/rubydex/src/operation/ruby_builder.rs +4 -0
  55. data/rust/rubydex/src/query.rs +114 -33
  56. data/rust/rubydex/src/resolution.rs +18 -20
  57. data/rust/rubydex/src/resolution_tests.rs +132 -0
  58. data/rust/rubydex/tests/cli.rs +17 -61
  59. data/rust/rubydex-mcp/Cargo.toml +9 -3
  60. data/rust/rubydex-sys/Cargo.toml +9 -2
  61. data/rust/rubydex-sys/src/definition_api.rs +72 -2
  62. data/rust/rubydex-sys/src/document_api.rs +28 -0
  63. data/rust/rubydex-sys/src/graph_api.rs +74 -6
  64. metadata +6 -4
  65. data/rust/rubydex/src/visualization/dot.rs +0 -192
  66. data/rust/rubydex/src/visualization.rs +0 -6
@@ -338,6 +338,7 @@ impl<'a> RBSIndexer<'a> {
338
338
  &mut self,
339
339
  str_id: StringId,
340
340
  offset: Offset,
341
+ name_offset: Offset,
341
342
  comments: Box<[Comment]>,
342
343
  flags: DefinitionFlags,
343
344
  lexical_nesting_id: Option<DefinitionId>,
@@ -347,6 +348,7 @@ impl<'a> RBSIndexer<'a> {
347
348
  str_id,
348
349
  self.uri_id,
349
350
  offset.clone(),
351
+ name_offset.clone(),
350
352
  comments.clone(),
351
353
  flags.clone(),
352
354
  lexical_nesting_id,
@@ -360,6 +362,7 @@ impl<'a> RBSIndexer<'a> {
360
362
  str_id,
361
363
  self.uri_id,
362
364
  offset,
365
+ name_offset,
363
366
  comments,
364
367
  flags,
365
368
  lexical_nesting_id,
@@ -562,13 +565,22 @@ impl Visit for RBSIndexer<'_> {
562
565
  fn visit_method_definition_node(&mut self, def_node: &node::MethodDefinitionNode) {
563
566
  let str_id = self.local_graph.intern_string(format!("{}()", def_node.name()));
564
567
  let offset = Offset::from_rbs_location(&def_node.location());
568
+ let name_offset = Offset::from_rbs_location(&def_node.name_location());
565
569
  let comments = self.collect_comments(def_node.comment());
566
570
  let flags = Self::flags(&def_node.annotations());
567
571
  let lexical_nesting_id = self.parent_lexical_scope_id();
568
572
  let signatures = self.collect_overload_signatures(def_node);
569
573
 
570
574
  if def_node.kind() == node::MethodDefinitionKind::SingletonInstance {
571
- self.register_singleton_instance_method(str_id, offset, comments, flags, lexical_nesting_id, signatures);
575
+ self.register_singleton_instance_method(
576
+ str_id,
577
+ offset,
578
+ name_offset,
579
+ comments,
580
+ flags,
581
+ lexical_nesting_id,
582
+ signatures,
583
+ );
572
584
  return;
573
585
  }
574
586
 
@@ -602,6 +614,7 @@ impl Visit for RBSIndexer<'_> {
602
614
  str_id,
603
615
  self.uri_id,
604
616
  offset,
617
+ name_offset,
605
618
  comments,
606
619
  flags,
607
620
  lexical_nesting_id,
@@ -1197,6 +1210,7 @@ mod tests {
1197
1210
 
1198
1211
  assert_definition_at!(&context, "2:3-2:22", Method, |def| {
1199
1212
  assert_def_str_eq!(&context, def, "foo()");
1213
+ assert_def_name_offset_eq!(&context, def, "2:7-2:10");
1200
1214
  assert!(def.receiver().is_none());
1201
1215
  assert_eq!(def.visibility(), &Visibility::Public);
1202
1216
  assert_eq!(class_def.id(), def.lexical_nesting_id().unwrap());
@@ -1205,6 +1219,7 @@ mod tests {
1205
1219
 
1206
1220
  assert_definition_at!(&context, "4:3-4:23", Method, |def| {
1207
1221
  assert_def_str_eq!(&context, def, "bar()");
1222
+ assert_def_name_offset_eq!(&context, def, "4:7-4:10");
1208
1223
  assert!(def.receiver().is_none());
1209
1224
  assert_eq!(def.visibility(), &Visibility::Public);
1210
1225
  assert_eq!(class_def.id(), def.lexical_nesting_id().unwrap());
@@ -1398,6 +1413,7 @@ mod tests {
1398
1413
  panic!()
1399
1414
  };
1400
1415
  assert_def_str_eq!(&context, instance_method, "foo()");
1416
+ assert_def_name_offset_eq!(&context, instance_method, "2:13-2:16");
1401
1417
  assert_eq!(instance_method.visibility(), &Visibility::Private);
1402
1418
 
1403
1419
  let singleton_method = definitions
@@ -1408,6 +1424,7 @@ mod tests {
1408
1424
  panic!()
1409
1425
  };
1410
1426
  assert_def_str_eq!(&context, singleton_method, "foo()");
1427
+ assert_def_name_offset_eq!(&context, singleton_method, "2:13-2:16");
1411
1428
  assert_eq!(singleton_method.visibility(), &Visibility::Public);
1412
1429
  }
1413
1430
 
@@ -1425,6 +1442,7 @@ mod tests {
1425
1442
 
1426
1443
  assert_definition_at!(&context, "2:3-2:27", Method, |def| {
1427
1444
  assert_def_str_eq!(&context, def, "foo()");
1445
+ assert_def_name_offset_eq!(&context, def, "2:12-2:15");
1428
1446
  let sigs = def.signatures().as_slice();
1429
1447
  assert_eq!(sigs.len(), 1);
1430
1448
  assert_eq!(sigs[0].len(), 0);
@@ -1811,6 +1811,7 @@ impl Visit<'_> for RubyIndexer<'_> {
1811
1811
  let name = Self::location_to_string(&node.name_loc());
1812
1812
  let str_id = self.local_graph.intern_string(format!("{name}()"));
1813
1813
  let offset = Offset::from_prism_location(&node.location());
1814
+ let name_offset = Offset::from_prism_location(&node.name_loc());
1814
1815
  let parent_nesting_id = self.current_nesting_definition_id();
1815
1816
  let parameters = self.collect_parameters(node);
1816
1817
  let is_singleton = node.receiver().is_some();
@@ -1862,6 +1863,7 @@ impl Visit<'_> for RubyIndexer<'_> {
1862
1863
  str_id,
1863
1864
  self.uri_id,
1864
1865
  offset.clone(),
1866
+ name_offset.clone(),
1865
1867
  comments.clone(),
1866
1868
  flags.clone(),
1867
1869
  parent_nesting_id,
@@ -1878,6 +1880,7 @@ impl Visit<'_> for RubyIndexer<'_> {
1878
1880
  str_id,
1879
1881
  self.uri_id,
1880
1882
  offset,
1883
+ name_offset,
1881
1884
  comments,
1882
1885
  flags,
1883
1886
  parent_nesting_id,
@@ -1895,6 +1898,7 @@ impl Visit<'_> for RubyIndexer<'_> {
1895
1898
  str_id,
1896
1899
  self.uri_id,
1897
1900
  offset,
1901
+ name_offset,
1898
1902
  comments,
1899
1903
  flags,
1900
1904
  parent_nesting_id,
@@ -1,5 +1,13 @@
1
+ // Setting the global allocator needs to happen during linking and consumers may not always want to change the global
2
+ // allocator. We gate the usage of jemalloc with a cargo feature, so that consumers can decide if they want to use it
3
+ #[cfg(all(feature = "jemalloc", not(target_os = "windows")))]
4
+ #[global_allocator]
5
+ static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
6
+
1
7
  pub mod compile_assertions;
8
+ pub mod config;
2
9
  pub mod diagnostic;
10
+ pub mod dot;
3
11
  pub mod errors;
4
12
  pub mod indexing;
5
13
  pub mod integrity;
@@ -12,7 +20,6 @@ pub mod position;
12
20
  pub mod query;
13
21
  pub mod resolution;
14
22
  pub mod stats;
15
- pub mod visualization;
16
23
 
17
24
  #[cfg(any(test, feature = "test_utils"))]
18
25
  pub mod test_utils;
@@ -2,6 +2,7 @@ use clap::{Parser, ValueEnum};
2
2
  use std::{collections::HashSet, mem};
3
3
 
4
4
  use rubydex::{
5
+ dot,
5
6
  indexing::{self, IndexerBackend},
6
7
  integrity, listing,
7
8
  model::graph::Graph,
@@ -10,7 +11,6 @@ use rubydex::{
10
11
  memory::MemoryStats,
11
12
  timer::{Timer, time_it},
12
13
  },
13
- visualization::dot,
14
14
  };
15
15
 
16
16
  #[derive(Parser, Debug)]
@@ -23,8 +23,11 @@ struct Args {
23
23
  #[arg(long = "stop-after", help = "Stop after the given stage")]
24
24
  stop_after: Option<StopAfter>,
25
25
 
26
- #[arg(long = "visualize")]
27
- visualize: bool,
26
+ #[arg(long = "dot", help = "Output a DOT graph visualization")]
27
+ dot: bool,
28
+
29
+ #[arg(long = "show-builtins", help = "Include built-in declarations in DOT output")]
30
+ show_builtins: bool,
28
31
 
29
32
  #[arg(long = "stats", help = "Show detailed performance statistics")]
30
33
  stats: bool,
@@ -171,8 +174,8 @@ fn main() {
171
174
  }
172
175
 
173
176
  // Generate visualization or print statistics
174
- if args.visualize {
175
- println!("{}", dot::generate(&graph));
177
+ if args.dot {
178
+ println!("{}", dot::DotBuilder::generate(&graph, args.show_builtins));
176
179
  } else {
177
180
  println!("Indexed {} files", graph.documents().len());
178
181
  println!("Found {} names", graph.declarations().len());
@@ -7,10 +7,13 @@ use crate::{
7
7
  model::{
8
8
  declaration::{ClassDeclaration, Declaration, Namespace},
9
9
  graph::Graph,
10
- ids::DeclarationId,
10
+ ids::{DeclarationId, UriId},
11
11
  },
12
12
  };
13
13
 
14
+ pub const BUILT_IN_URI: &str = "rubydex:built-in";
15
+ pub static BUILT_IN_URI_ID: LazyLock<UriId> = LazyLock::new(|| UriId::from(BUILT_IN_URI));
16
+
14
17
  pub static KERNEL_ID: LazyLock<DeclarationId> = LazyLock::new(|| DeclarationId::from("Kernel"));
15
18
  pub static BASIC_OBJECT_ID: LazyLock<DeclarationId> = LazyLock::new(|| DeclarationId::from("BasicObject"));
16
19
  pub static OBJECT_ID: LazyLock<DeclarationId> = LazyLock::new(|| DeclarationId::from("Object"));
@@ -27,7 +30,7 @@ pub fn add_built_in_data(graph: &mut Graph) {
27
30
  // We need definitions to ensure that ancestor linearization happens naturally through the algorithm. Trying to set
28
31
  // ancestors directly on declarations doesn't work because the algorithm erases the ancestors and there are no
29
32
  // definitions to inform it of the superclasses and mixins.
30
- let uri = Url::parse("rubydex:built-in").unwrap();
33
+ let uri = Url::parse(BUILT_IN_URI).unwrap();
31
34
  let source = r"
32
35
  class BasicObject
33
36
  end
@@ -1,3 +1,4 @@
1
+ use crate::assert_mem_size;
1
2
  use crate::offset::Offset;
2
3
 
3
4
  #[derive(Debug, Clone)]
@@ -5,6 +6,7 @@ pub struct Comment {
5
6
  offset: Offset,
6
7
  string: String,
7
8
  }
9
+ assert_mem_size!(Comment, 32);
8
10
 
9
11
  impl Comment {
10
12
  #[must_use]
@@ -1,5 +1,4 @@
1
1
  use crate::assert_mem_size;
2
- use crate::diagnostic::Diagnostic;
3
2
  use crate::model::ids::{
4
3
  ClassVariableReferenceId, GlobalVariableReferenceId, InstanceVariableReferenceId, MethodReferenceId,
5
4
  };
@@ -16,6 +15,7 @@ pub enum Ancestor {
16
15
  /// A partial ancestor that is missing linearization
17
16
  Partial(NameId),
18
17
  }
18
+ assert_mem_size!(Ancestor, 16);
19
19
 
20
20
  /// The ancestor chain and its current state
21
21
  #[derive(Debug, Clone)]
@@ -110,8 +110,6 @@ macro_rules! namespace_declaration {
110
110
  descendants: IdentityHashSet<DeclarationId>,
111
111
  /// The singleton class associated with this declaration
112
112
  singleton_class_id: Option<DeclarationId>,
113
- /// Diagnostics associated with this declaration
114
- diagnostics: Vec<Diagnostic>,
115
113
  }
116
114
 
117
115
  impl $name {
@@ -126,13 +124,11 @@ macro_rules! namespace_declaration {
126
124
  ancestors: Ancestors::Partial(Vec::new()),
127
125
  descendants: IdentityHashSet::default(),
128
126
  singleton_class_id: None,
129
- diagnostics: Vec::new(),
130
127
  }
131
128
  }
132
129
 
133
- pub fn extend(&mut self, mut other: Declaration) {
130
+ pub fn extend(&mut self, other: Declaration) {
134
131
  self.definition_ids.extend(other.definitions());
135
- self.diagnostics.extend(other.take_diagnostics());
136
132
 
137
133
  match other {
138
134
  Declaration::Namespace(namespace) => {
@@ -242,8 +238,6 @@ macro_rules! simple_declaration {
242
238
  references: IdentityHashSet<$reference_type>,
243
239
  /// The ID of the owner of this declaration
244
240
  owner_id: DeclarationId,
245
- /// Diagnostics associated with this declaration
246
- diagnostics: Vec<Diagnostic>,
247
241
  }
248
242
 
249
243
  impl $name {
@@ -254,13 +248,11 @@ macro_rules! simple_declaration {
254
248
  definition_ids: Vec::new(),
255
249
  references: IdentityHashSet::default(),
256
250
  owner_id,
257
- diagnostics: Vec::new(),
258
251
  }
259
252
  }
260
253
 
261
- pub fn extend(&mut self, mut other: $name) {
254
+ pub fn extend(&mut self, other: $name) {
262
255
  self.definition_ids.extend(other.definitions());
263
- self.diagnostics.extend(other.take_diagnostics());
264
256
  self.references.extend(other.references());
265
257
  }
266
258
 
@@ -277,10 +269,6 @@ macro_rules! simple_declaration {
277
269
  self.references.remove(reference_id);
278
270
  }
279
271
 
280
- pub fn take_diagnostics(&mut self) -> Vec<Diagnostic> {
281
- std::mem::take(&mut self.diagnostics)
282
- }
283
-
284
272
  #[must_use]
285
273
  pub fn definitions(&self) -> &[DefinitionId] {
286
274
  &self.definition_ids
@@ -435,23 +423,6 @@ impl Declaration {
435
423
  })
436
424
  }
437
425
 
438
- #[must_use]
439
- pub fn diagnostics(&self) -> &[Diagnostic] {
440
- all_declarations!(self, it => &it.diagnostics)
441
- }
442
-
443
- pub fn take_diagnostics(&mut self) -> Vec<Diagnostic> {
444
- all_declarations!(self, it => std::mem::take(&mut it.diagnostics))
445
- }
446
-
447
- pub fn add_diagnostic(&mut self, diagnostic: Diagnostic) {
448
- all_declarations!(self, it => it.diagnostics.push(diagnostic));
449
- }
450
-
451
- pub fn clear_diagnostics(&mut self) {
452
- all_declarations!(self, it => it.diagnostics.clear());
453
- }
454
-
455
426
  #[must_use]
456
427
  pub fn reference_count(&self) -> usize {
457
428
  all_declarations!(self, it => it.references.len())
@@ -545,15 +516,6 @@ impl Namespace {
545
516
  all_namespaces!(self, it => &it.members)
546
517
  }
547
518
 
548
- #[must_use]
549
- pub fn diagnostics(&self) -> &[Diagnostic] {
550
- all_namespaces!(self, it => &it.diagnostics)
551
- }
552
-
553
- pub fn take_diagnostics(&mut self) -> Vec<Diagnostic> {
554
- all_namespaces!(self, it => std::mem::take(&mut it.diagnostics))
555
- }
556
-
557
519
  pub fn extend(&mut self, other: Declaration) {
558
520
  all_namespaces!(self, it => it.extend(other));
559
521
  }
@@ -646,25 +608,25 @@ impl Namespace {
646
608
  }
647
609
 
648
610
  namespace_declaration!(Class, ClassDeclaration);
649
- assert_mem_size!(ClassDeclaration, 216);
611
+ assert_mem_size!(ClassDeclaration, 192);
650
612
  namespace_declaration!(Module, ModuleDeclaration);
651
- assert_mem_size!(ModuleDeclaration, 216);
613
+ assert_mem_size!(ModuleDeclaration, 192);
652
614
  namespace_declaration!(SingletonClass, SingletonClassDeclaration);
653
- assert_mem_size!(SingletonClassDeclaration, 216);
615
+ assert_mem_size!(SingletonClassDeclaration, 192);
654
616
  namespace_declaration!(Todo, TodoDeclaration);
655
- assert_mem_size!(TodoDeclaration, 216);
617
+ assert_mem_size!(TodoDeclaration, 192);
656
618
  simple_declaration!(ConstantDeclaration, ConstantReferenceId);
657
- assert_mem_size!(ConstantDeclaration, 112);
619
+ assert_mem_size!(ConstantDeclaration, 88);
658
620
  simple_declaration!(MethodDeclaration, MethodReferenceId);
659
- assert_mem_size!(MethodDeclaration, 112);
621
+ assert_mem_size!(MethodDeclaration, 88);
660
622
  simple_declaration!(GlobalVariableDeclaration, GlobalVariableReferenceId);
661
- assert_mem_size!(GlobalVariableDeclaration, 112);
623
+ assert_mem_size!(GlobalVariableDeclaration, 88);
662
624
  simple_declaration!(InstanceVariableDeclaration, InstanceVariableReferenceId);
663
- assert_mem_size!(InstanceVariableDeclaration, 112);
625
+ assert_mem_size!(InstanceVariableDeclaration, 88);
664
626
  simple_declaration!(ClassVariableDeclaration, ClassVariableReferenceId);
665
- assert_mem_size!(ClassVariableDeclaration, 112);
627
+ assert_mem_size!(ClassVariableDeclaration, 88);
666
628
  simple_declaration!(ConstantAliasDeclaration, ConstantReferenceId);
667
- assert_mem_size!(ConstantAliasDeclaration, 112);
629
+ assert_mem_size!(ConstantAliasDeclaration, 88);
668
630
 
669
631
  #[cfg(test)]
670
632
  mod tests {
@@ -43,6 +43,7 @@ bitflags! {
43
43
  const SINGLETON_METHOD_VISIBILITY = 0b0100;
44
44
  }
45
45
  }
46
+ assert_mem_size!(DefinitionFlags, 1);
46
47
 
47
48
  impl DefinitionFlags {
48
49
  #[must_use]
@@ -181,6 +182,7 @@ impl Definition {
181
182
  Definition::Class(d) => Some(d.name_offset()),
182
183
  Definition::Module(d) => Some(d.name_offset()),
183
184
  Definition::SingletonClass(d) => Some(d.name_offset()),
185
+ Definition::Method(d) => Some(d.name_offset()),
184
186
  _ => None,
185
187
  }
186
188
  }
@@ -199,6 +201,7 @@ pub enum Mixin {
199
201
  Prepend(PrependDefinition),
200
202
  Extend(ExtendDefinition),
201
203
  }
204
+ assert_mem_size!(Mixin, 16);
202
205
 
203
206
  impl Mixin {
204
207
  #[must_use]
@@ -891,6 +894,7 @@ pub enum Signatures {
891
894
  /// Used for RBS definitions with more than one overload.
892
895
  Overloaded(Box<[Signature]>),
893
896
  }
897
+ assert_mem_size!(Signatures, 24);
894
898
 
895
899
  impl Signatures {
896
900
  /// Returns all signatures as a slice, regardless of variant.
@@ -915,6 +919,7 @@ pub struct MethodDefinition {
915
919
  str_id: StringId,
916
920
  uri_id: UriId,
917
921
  offset: Offset,
922
+ name_offset: Offset,
918
923
  flags: DefinitionFlags,
919
924
  comments: Box<[Comment]>,
920
925
  lexical_nesting_id: Option<DefinitionId>,
@@ -923,7 +928,7 @@ pub struct MethodDefinition {
923
928
  receiver: Option<Receiver>,
924
929
  }
925
930
 
926
- assert_mem_size!(MethodDefinition, 96);
931
+ assert_mem_size!(MethodDefinition, 104);
927
932
 
928
933
  /// The receiver of a singleton method definition.
929
934
  #[derive(Debug, Clone)]
@@ -943,6 +948,7 @@ impl MethodDefinition {
943
948
  str_id: StringId,
944
949
  uri_id: UriId,
945
950
  offset: Offset,
951
+ name_offset: Offset,
946
952
  comments: Box<[Comment]>,
947
953
  flags: DefinitionFlags,
948
954
  lexical_nesting_id: Option<DefinitionId>,
@@ -954,6 +960,7 @@ impl MethodDefinition {
954
960
  str_id,
955
961
  uri_id,
956
962
  offset,
963
+ name_offset,
957
964
  flags,
958
965
  comments,
959
966
  lexical_nesting_id,
@@ -983,6 +990,11 @@ impl MethodDefinition {
983
990
  &self.offset
984
991
  }
985
992
 
993
+ #[must_use]
994
+ pub fn name_offset(&self) -> &Offset {
995
+ &self.name_offset
996
+ }
997
+
986
998
  #[must_use]
987
999
  pub fn comments(&self) -> &[Comment] {
988
1000
  &self.comments
@@ -3,6 +3,7 @@ use std::path::PathBuf;
3
3
  use line_index::LineIndex;
4
4
  use url::Url;
5
5
 
6
+ use crate::assert_mem_size;
6
7
  use crate::diagnostic::Diagnostic;
7
8
  use crate::model::ids::{ConstantReferenceId, DefinitionId, MethodReferenceId};
8
9
 
@@ -17,6 +18,7 @@ pub struct Document {
17
18
  constant_reference_ids: Vec<ConstantReferenceId>,
18
19
  diagnostics: Vec<Diagnostic>,
19
20
  }
21
+ assert_mem_size!(Document, 176);
20
22
 
21
23
  impl Document {
22
24
  #[must_use]
@@ -1,3 +1,4 @@
1
+ use crate::assert_mem_size;
1
2
  use line_index::WideEncoding;
2
3
 
3
4
  #[derive(Default, Debug)]
@@ -7,6 +8,7 @@ pub enum Encoding {
7
8
  Utf16,
8
9
  Utf32,
9
10
  }
11
+ assert_mem_size!(Encoding, 1);
10
12
 
11
13
  impl Encoding {
12
14
  /// Transform the LSP selected encoding into the expected `WideEncoding` for converting code units with the