We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a9fa60 commit a5aef81Copy full SHA for a5aef81
1 file changed
rust/rubydex/src/test_utils/graph_test.rs
@@ -58,9 +58,14 @@ impl GraphTest {
58
#[must_use]
59
pub fn source_at(&self, definition_id: &DefinitionId) -> &str {
60
let def = self.graph.definitions().get(definition_id).unwrap();
61
- let uri = self.graph.documents().get(def.uri_id()).unwrap().uri();
+ self.source_at_offset(self.graph.documents().get(def.uri_id()).unwrap().uri(), def.offset())
62
+ }
63
+
64
+ /// Returns the source text at the given URI and offset.
65
+ #[must_use]
66
+ pub fn source_at_offset(&self, uri: &str, offset: &Offset) -> &str {
67
let source = self.source(uri);
- &source[def.offset().start() as usize..def.offset().end() as usize]
68
+ &source[offset.start() as usize..offset.end() as usize]
69
}
70
71
pub fn delete_uri(&mut self, uri: &str) {
0 commit comments