Skip to content

Commit 8c9b1ba

Browse files
committed
More renames
1 parent c82a864 commit 8c9b1ba

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

crates/ty_ide/src/goto_references.rs renamed to crates/ty_ide/src/find_references.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use ty_python_semantic::SemanticModel;
77

88
/// Find all references to a symbol at the given position.
99
/// Search for references across all files in the project.
10-
pub fn goto_references(
10+
pub fn find_references(
1111
db: &dyn Db,
1212
file: File,
1313
offset: TextSize,
@@ -41,7 +41,7 @@ mod tests {
4141
impl CursorTest {
4242
fn references(&self) -> String {
4343
let Some(mut reference_results) =
44-
goto_references(&self.db, self.cursor.file, self.cursor.offset, true)
44+
find_references(&self.db, self.cursor.file, self.cursor.offset, true)
4545
else {
4646
return "No references found".to_string();
4747
};
@@ -84,7 +84,7 @@ mod tests {
8484
}
8585

8686
#[test]
87-
fn test_parameter_references_in_function() {
87+
fn parameter_references_in_function() {
8888
let test = cursor_test(
8989
"
9090
def calculate_sum(<CURSOR>value: int) -> int:
@@ -149,28 +149,28 @@ result = calculate_sum(value=42)
149149
}
150150

151151
#[test]
152-
fn test_nonlocal_variable_references() {
152+
fn nonlocal_variable_references() {
153153
let test = cursor_test(
154154
"
155155
def outer_function():
156156
coun<CURSOR>ter = 0
157-
157+
158158
def increment():
159159
nonlocal counter
160160
counter += 1
161161
return counter
162-
162+
163163
def decrement():
164164
nonlocal counter
165165
counter -= 1
166166
return counter
167-
167+
168168
# Use counter in outer scope
169169
initial = counter
170170
increment()
171171
decrement()
172172
final = counter
173-
173+
174174
return increment, decrement
175175
",
176176
);
@@ -272,7 +272,7 @@ def outer_function():
272272
}
273273

274274
#[test]
275-
fn test_global_variable_references() {
275+
fn global_variable_references() {
276276
let test = cursor_test(
277277
"
278278
glo<CURSOR>bal_counter = 0
@@ -389,7 +389,7 @@ final_value = global_counter
389389
}
390390

391391
#[test]
392-
fn test_except_handler_variable_references() {
392+
fn except_handler_variable_references() {
393393
let test = cursor_test(
394394
"
395395
try:
@@ -450,7 +450,7 @@ except ValueError as err:
450450
}
451451

452452
#[test]
453-
fn test_pattern_match_as_references() {
453+
fn pattern_match_as_references() {
454454
let test = cursor_test(
455455
"
456456
match x:
@@ -498,7 +498,7 @@ match x:
498498
}
499499

500500
#[test]
501-
fn test_pattern_match_mapping_rest_references() {
501+
fn pattern_match_mapping_rest_references() {
502502
let test = cursor_test(
503503
"
504504
match data:
@@ -553,7 +553,7 @@ match data:
553553
}
554554

555555
#[test]
556-
fn test_function_definition_references() {
556+
fn function_definition_references() {
557557
let test = cursor_test(
558558
"
559559
def my_func<CURSOR>tion():
@@ -632,7 +632,7 @@ value = my_function
632632
}
633633

634634
#[test]
635-
fn test_class_definition_references() {
635+
fn class_definition_references() {
636636
let test = cursor_test(
637637
"
638638
class My<CURSOR>Class:
@@ -1105,7 +1105,7 @@ cls = MyClass
11051105
def __init__(self, pos, btn):
11061106
self.position: int = pos
11071107
self.button: str = btn
1108-
1108+
11091109
def my_func(event: Click):
11101110
match event:
11111111
case Click(x, button=a<CURSOR>b):
@@ -1144,7 +1144,7 @@ cls = MyClass
11441144
def __init__(self, pos, btn):
11451145
self.position: int = pos
11461146
self.button: str = btn
1147-
1147+
11481148
def my_func(event: Click):
11491149
match event:
11501150
case Click(x, button=ab):
@@ -1183,7 +1183,7 @@ cls = MyClass
11831183
def __init__(self, pos, btn):
11841184
self.position: int = pos
11851185
self.button: str = btn
1186-
1186+
11871187
def my_func(event: Click):
11881188
match event:
11891189
case Cl<CURSOR>ick(x, button=ab):
@@ -1233,7 +1233,7 @@ cls = MyClass
12331233
def __init__(self, pos, btn):
12341234
self.position: int = pos
12351235
self.button: str = btn
1236-
1236+
12371237
def my_func(event: Click):
12381238
match event:
12391239
case Click(x, but<CURSOR>ton=ab):
@@ -1445,7 +1445,7 @@ cls = MyClass
14451445
}
14461446

14471447
#[test]
1448-
fn test_multi_file_function_references() {
1448+
fn multi_file_function_references() {
14491449
let test = CursorTest::builder()
14501450
.source(
14511451
"utils.py",
@@ -1471,7 +1471,7 @@ from utils import func
14711471
class DataProcessor:
14721472
def __init__(self):
14731473
self.multiplier = func
1474-
1474+
14751475
def process(self, value):
14761476
return func(value)
14771477
",
@@ -1535,14 +1535,14 @@ class DataProcessor:
15351535
}
15361536

15371537
#[test]
1538-
fn test_multi_file_class_attribute_references() {
1538+
fn multi_file_class_attribute_references() {
15391539
let test = CursorTest::builder()
15401540
.source(
15411541
"models.py",
15421542
"
15431543
class MyModel:
15441544
a<CURSOR>ttr = 42
1545-
1545+
15461546
def get_attribute(self):
15471547
return MyModel.attr
15481548
",
@@ -1613,7 +1613,7 @@ def process_model():
16131613
}
16141614

16151615
#[test]
1616-
fn test_import_alias_references_should_not_resolve_to_original() {
1616+
fn import_alias_references_should_not_resolve_to_original() {
16171617
let test = CursorTest::builder()
16181618
.source(
16191619
"original.py",

crates/ty_ide/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ mod doc_highlights;
99
mod docstring;
1010
mod document_symbols;
1111
mod find_node;
12+
mod find_references;
1213
mod goto;
1314
mod goto_declaration;
1415
mod goto_definition;
15-
mod goto_references;
1616
mod goto_type_definition;
1717
mod hover;
1818
mod importer;
@@ -32,8 +32,8 @@ pub use code_action::{QuickFix, code_actions};
3232
pub use completion::{Completion, CompletionKind, CompletionSettings, completion};
3333
pub use doc_highlights::document_highlights;
3434
pub use document_symbols::document_symbols;
35+
pub use find_references::find_references;
3536
pub use goto::{goto_declaration, goto_definition, goto_type_definition};
36-
pub use goto_references::goto_references;
3737
pub use hover::hover;
3838
pub use inlay_hints::{
3939
InlayHintKind, InlayHintLabel, InlayHintSettings, InlayHintTextEdit, inlay_hints,

crates/ty_server/src/server/api/requests/references.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::borrow::Cow;
22

33
use lsp_types::request::References;
44
use lsp_types::{Location, ReferenceParams, Url};
5-
use ty_ide::goto_references;
5+
use ty_ide::find_references;
66
use ty_project::ProjectDatabase;
77

88
use crate::document::{PositionExt, ToLink};
@@ -51,7 +51,7 @@ impl BackgroundDocumentRequestHandler for ReferencesRequestHandler {
5151

5252
let include_declaration = params.context.include_declaration;
5353

54-
let Some(references_result) = goto_references(db, file, offset, include_declaration) else {
54+
let Some(references_result) = find_references(db, file, offset, include_declaration) else {
5555
return Ok(None);
5656
};
5757

crates/ty_wasm/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use ruff_python_formatter::formatted_file;
1717
use ruff_source_file::{LineIndex, OneIndexed, SourceLocation};
1818
use ruff_text_size::{Ranged, TextSize};
1919
use ty_ide::{
20-
InlayHintSettings, MarkupKind, RangedValue, document_highlights, goto_declaration,
21-
goto_definition, goto_references, goto_type_definition, hover, inlay_hints,
20+
InlayHintSettings, MarkupKind, RangedValue, document_highlights, find_references,
21+
goto_declaration, goto_definition, goto_type_definition, hover, inlay_hints,
2222
};
2323
use ty_ide::{NavigationTarget, NavigationTargets, signature_help};
2424
use ty_project::metadata::options::Options;
@@ -351,7 +351,7 @@ impl Workspace {
351351

352352
let offset = position.to_text_size(&source, &index, self.position_encoding)?;
353353

354-
let Some(targets) = goto_references(&self.db, file_id.file, offset, true) else {
354+
let Some(targets) = find_references(&self.db, file_id.file, offset, true) else {
355355
return Ok(Vec::new());
356356
};
357357

0 commit comments

Comments
 (0)