History

Return back the guards when goto targets are queried for (#34340)

Closes https://github.com/zed-industries/zed/issues/34310 Follow-up of https://github.com/zed-industries/zed/pull/29359 Release Notes: - Fixed goto definition not working in remote projects in certain conditions

Kirill Bulatov committed 1 year ago

Commit 13ddd5e1 parent 1b6e2121 file · +35 −5Browse files

Unified · Split

crates/project/src/project.rs+35−5
@@ -3364,8 +3364,14 @@ impl Project { · 3363 unmodified lines
3364 cx: &mut Context<Self>,3364 cx: &mut Context<Self>,
3365 ) -> Task<Result<Vec<LocationLink>>> {3365 ) -> Task<Result<Vec<LocationLink>>> {
3366 let position = position.to_point_utf16(buffer.read(cx));3366 let position = position.to_point_utf16(buffer.read(cx));
3367 self.lsp_store.update(cx, |lsp_store, cx| {3367 let guard = self.retain_remotely_created_models(cx);
3368 let task = self.lsp_store.update(cx, |lsp_store, cx| {
3368 lsp_store.definitions(buffer, position, cx)3369 lsp_store.definitions(buffer, position, cx)
3370 });
3371 cx.spawn(async move |_, _| {
3372 let result = task.await;
3373 drop(guard);
3374 result
3369 })3375 })
3370 }3376 }
3371 3377
@@ -3376,8 +3382,14 @@ impl Project { · 4 unmodified lines
3376 cx: &mut Context<Self>,3382 cx: &mut Context<Self>,
3377 ) -> Task<Result<Vec<LocationLink>>> {3383 ) -> Task<Result<Vec<LocationLink>>> {
3378 let position = position.to_point_utf16(buffer.read(cx));3384 let position = position.to_point_utf16(buffer.read(cx));
3379 self.lsp_store.update(cx, |lsp_store, cx| {3385 let guard = self.retain_remotely_created_models(cx);
3386 let task = self.lsp_store.update(cx, |lsp_store, cx| {
3380 lsp_store.declarations(buffer, position, cx)3387 lsp_store.declarations(buffer, position, cx)
3388 });
3389 cx.spawn(async move |_, _| {
3390 let result = task.await;
3391 drop(guard);
3392 result
3381 })3393 })
3382 }3394 }
3383 3395
@@ -3388,8 +3400,14 @@ impl Project { · 4 unmodified lines
3388 cx: &mut Context<Self>,3400 cx: &mut Context<Self>,
3389 ) -> Task<Result<Vec<LocationLink>>> {3401 ) -> Task<Result<Vec<LocationLink>>> {
3390 let position = position.to_point_utf16(buffer.read(cx));3402 let position = position.to_point_utf16(buffer.read(cx));
3391 self.lsp_store.update(cx, |lsp_store, cx| {3403 let guard = self.retain_remotely_created_models(cx);
3404 let task = self.lsp_store.update(cx, |lsp_store, cx| {
3392 lsp_store.type_definitions(buffer, position, cx)3405 lsp_store.type_definitions(buffer, position, cx)
3406 });
3407 cx.spawn(async move |_, _| {
3408 let result = task.await;
3409 drop(guard);
3410 result
3393 })3411 })
3394 }3412 }
3395 3413
@@ -3400,8 +3418,14 @@ impl Project { · 4 unmodified lines
3400 cx: &mut Context<Self>,3418 cx: &mut Context<Self>,
3401 ) -> Task<Result<Vec<LocationLink>>> {3419 ) -> Task<Result<Vec<LocationLink>>> {
3402 let position = position.to_point_utf16(buffer.read(cx));3420 let position = position.to_point_utf16(buffer.read(cx));
3403 self.lsp_store.update(cx, |lsp_store, cx| {3421 let guard = self.retain_remotely_created_models(cx);
3422 let task = self.lsp_store.update(cx, |lsp_store, cx| {
3404 lsp_store.implementations(buffer, position, cx)3423 lsp_store.implementations(buffer, position, cx)
3424 });
3425 cx.spawn(async move |_, _| {
3426 let result = task.await;
3427 drop(guard);
3428 result
3405 })3429 })
3406 }3430 }
3407 3431
@@ -3412,8 +3436,14 @@ impl Project { · 4 unmodified lines
3412 cx: &mut Context<Self>,3436 cx: &mut Context<Self>,
3413 ) -> Task<Result<Vec<Location>>> {3437 ) -> Task<Result<Vec<Location>>> {
3414 let position = position.to_point_utf16(buffer.read(cx));3438 let position = position.to_point_utf16(buffer.read(cx));
3415 self.lsp_store.update(cx, |lsp_store, cx| {3439 let guard = self.retain_remotely_created_models(cx);
3440 let task = self.lsp_store.update(cx, |lsp_store, cx| {
3416 lsp_store.references(buffer, position, cx)3441 lsp_store.references(buffer, position, cx)
3442 });
3443 cx.spawn(async move |_, _| {
3444 let result = task.await;
3445 drop(guard);
3446 result
3417 })3447 })
3418 }3448 }
3419 3449

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t