Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/ty_ide/src/goto_declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2785,8 +2785,9 @@ def ab(a: int, *, c: int): ...

impl CursorTest {
fn goto_declaration(&self) -> String {
let Some(targets) = goto_declaration(&self.db, self.cursor.file, self.cursor.offset)
else {
let Some(targets) = salsa::attach(&self.db, || {
goto_declaration(&self.db, self.cursor.file, self.cursor.offset)
}) else {
return "No goto target found".to_string();
};

Expand Down
5 changes: 3 additions & 2 deletions crates/ty_ide/src/goto_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1697,8 +1697,9 @@ Traceb<CURSOR>ackType

impl CursorTest {
fn goto_definition(&self) -> String {
let Some(targets) = goto_definition(&self.db, self.cursor.file, self.cursor.offset)
else {
let Some(targets) = salsa::attach(&self.db, || {
goto_definition(&self.db, self.cursor.file, self.cursor.offset)
}) else {
return "No goto target found".to_string();
};

Expand Down
4 changes: 2 additions & 2 deletions crates/ty_ide/src/goto_type_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1900,9 +1900,9 @@ def function():

impl CursorTest {
fn goto_type_definition(&self) -> String {
let Some(targets) =
let Some(targets) = salsa::attach(&self.db, || {
goto_type_definition(&self.db, self.cursor.file, self.cursor.offset)
else {
}) else {
return "No goto target found".to_string();
};

Expand Down
14 changes: 8 additions & 6 deletions crates/ty_ide/src/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,23 @@ mod tests {

impl CursorTest {
fn prepare_rename(&self) -> String {
let Some(range) = can_rename(&self.db, self.cursor.file, self.cursor.offset) else {
let Some(range) = salsa::attach(&self.db, || {
can_rename(&self.db, self.cursor.file, self.cursor.offset)
}) else {
return "Cannot rename".to_string();
};

format!("Can rename symbol at range {range:?}")
}

fn rename(&self, new_name: &str) -> String {
let Some(_) = can_rename(&self.db, self.cursor.file, self.cursor.offset) else {
return "Cannot rename".to_string();
};
let rename_results = salsa::attach(&self.db, || {
can_rename(&self.db, self.cursor.file, self.cursor.offset)?;

let Some(rename_results) =
rename(&self.db, self.cursor.file, self.cursor.offset, new_name)
else {
});

let Some(rename_results) = rename_results else {
return "Cannot rename".to_string();
};

Expand Down
Loading