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
33643364 cx: &mut Context<Self>,
33653365 ) -> Task<Result<Vec<LocationLink>>> {
33663366 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| {
33683369 lsp_store.definitions(buffer, position, cx)
3370+ });
3371+ cx.spawn(async move |_, _| {
3372+ let result = task.await;
3373+ drop(guard);
3374+ result
33693375 })
33703376 }
33713377
@@ -3376,8 +3382,14 @@ impl Project { · 4 unmodified lines
33763382 cx: &mut Context<Self>,
33773383 ) -> Task<Result<Vec<LocationLink>>> {
33783384 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| {
33803387 lsp_store.declarations(buffer, position, cx)
3388+ });
3389+ cx.spawn(async move |_, _| {
3390+ let result = task.await;
3391+ drop(guard);
3392+ result
33813393 })
33823394 }
33833395
@@ -3388,8 +3400,14 @@ impl Project { · 4 unmodified lines
33883400 cx: &mut Context<Self>,
33893401 ) -> Task<Result<Vec<LocationLink>>> {
33903402 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| {
33923405 lsp_store.type_definitions(buffer, position, cx)
3406+ });
3407+ cx.spawn(async move |_, _| {
3408+ let result = task.await;
3409+ drop(guard);
3410+ result
33933411 })
33943412 }
33953413
@@ -3400,8 +3418,14 @@ impl Project { · 4 unmodified lines
34003418 cx: &mut Context<Self>,
34013419 ) -> Task<Result<Vec<LocationLink>>> {
34023420 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| {
34043423 lsp_store.implementations(buffer, position, cx)
3424+ });
3425+ cx.spawn(async move |_, _| {
3426+ let result = task.await;
3427+ drop(guard);
3428+ result
34053429 })
34063430 }
34073431
@@ -3412,8 +3436,14 @@ impl Project { · 4 unmodified lines
34123436 cx: &mut Context<Self>,
34133437 ) -> Task<Result<Vec<Location>>> {
34143438 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| {
34163441 lsp_store.references(buffer, position, cx)
3442+ });
3443+ cx.spawn(async move |_, _| {
3444+ let result = task.await;
3445+ drop(guard);
3446+ result
34173447 })
34183448 }
34193449

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