Fix different kinds values used for worktree_id
(#17523)
This commit is contained in:
parent
47aec5e64d
commit
8985fd87c2
18 changed files with 136 additions and 127 deletions
|
@ -4250,7 +4250,7 @@ impl LspStore {
|
|||
|
||||
let project_settings = ProjectSettings::get(
|
||||
Some(SettingsLocation {
|
||||
worktree_id: worktree_id.to_proto() as usize,
|
||||
worktree_id,
|
||||
path: Path::new(""),
|
||||
}),
|
||||
cx,
|
||||
|
@ -6408,8 +6408,8 @@ impl LspAdapterDelegate for ProjectLspAdapterDelegate {
|
|||
self.http_client.clone()
|
||||
}
|
||||
|
||||
fn worktree_id(&self) -> u64 {
|
||||
self.worktree.id().to_proto()
|
||||
fn worktree_id(&self) -> WorktreeId {
|
||||
self.worktree.id()
|
||||
}
|
||||
|
||||
fn worktree_root_path(&self) -> &Path {
|
||||
|
|
|
@ -37,7 +37,7 @@ use futures::{
|
|||
|
||||
use git::{blame::Blame, repository::GitRepository};
|
||||
use gpui::{
|
||||
AnyModel, AppContext, AsyncAppContext, BorrowAppContext, Context, Entity, EventEmitter, Model,
|
||||
AnyModel, AppContext, AsyncAppContext, BorrowAppContext, Context, EventEmitter, Model,
|
||||
ModelContext, SharedString, Task, WeakModel, WindowContext,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
|
@ -1606,7 +1606,7 @@ impl Project {
|
|||
self.worktree_store.update(cx, |worktree_store, cx| {
|
||||
for worktree in worktree_store.worktrees() {
|
||||
store
|
||||
.clear_local_settings(worktree.entity_id().as_u64() as usize, cx)
|
||||
.clear_local_settings(worktree.read(cx).id(), cx)
|
||||
.log_err();
|
||||
}
|
||||
});
|
||||
|
@ -5186,7 +5186,7 @@ impl EventEmitter<Event> for Project {}
|
|||
impl<'a> From<&'a ProjectPath> for SettingsLocation<'a> {
|
||||
fn from(val: &'a ProjectPath) -> Self {
|
||||
SettingsLocation {
|
||||
worktree_id: val.worktree_id.to_usize(),
|
||||
worktree_id: val.worktree_id,
|
||||
path: val.path.as_ref(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ impl SettingsObserver {
|
|||
let store = cx.global::<SettingsStore>();
|
||||
for worktree in self.worktree_store.read(cx).worktrees() {
|
||||
let worktree_id = worktree.read(cx).id().to_proto();
|
||||
for (path, content) in store.local_settings(worktree.entity_id().as_u64() as usize) {
|
||||
for (path, content) in store.local_settings(worktree.read(cx).id()) {
|
||||
downstream_client
|
||||
.send(proto::UpdateWorktreeSettings {
|
||||
project_id,
|
||||
|
@ -416,17 +416,12 @@ impl SettingsObserver {
|
|||
settings_contents: impl IntoIterator<Item = (Arc<Path>, Option<String>)>,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) {
|
||||
let worktree_id = worktree.entity_id();
|
||||
let worktree_id = worktree.read(cx).id();
|
||||
let remote_worktree_id = worktree.read(cx).id();
|
||||
cx.update_global::<SettingsStore, _>(|store, cx| {
|
||||
for (directory, file_content) in settings_contents {
|
||||
store
|
||||
.set_local_settings(
|
||||
worktree_id.as_u64() as usize,
|
||||
directory.clone(),
|
||||
file_content.as_deref(),
|
||||
cx,
|
||||
)
|
||||
.set_local_settings(worktree_id, directory.clone(), file_content.as_deref(), cx)
|
||||
.log_err();
|
||||
if let Some(downstream_client) = &self.downstream_client {
|
||||
downstream_client
|
||||
|
|
|
@ -579,15 +579,16 @@ impl ContextProvider for BasicContextProvider {
|
|||
if !selected_text.trim().is_empty() {
|
||||
task_variables.insert(VariableName::SelectedText, selected_text);
|
||||
}
|
||||
let worktree_abs_path = buffer
|
||||
.file()
|
||||
.map(|file| WorktreeId::from_usize(file.worktree_id()))
|
||||
.and_then(|worktree_id| {
|
||||
self.project
|
||||
.read(cx)
|
||||
.worktree_for_id(worktree_id, cx)
|
||||
.map(|worktree| worktree.read(cx).abs_path())
|
||||
});
|
||||
let worktree_abs_path =
|
||||
buffer
|
||||
.file()
|
||||
.map(|file| file.worktree_id(cx))
|
||||
.and_then(|worktree_id| {
|
||||
self.project
|
||||
.read(cx)
|
||||
.worktree_for_id(worktree_id, cx)
|
||||
.map(|worktree| worktree.read(cx).abs_path())
|
||||
});
|
||||
if let Some(worktree_path) = worktree_abs_path {
|
||||
task_variables.insert(
|
||||
VariableName::WorktreeRoot,
|
||||
|
|
|
@ -103,7 +103,7 @@ impl Project {
|
|||
if let Some(path) = path.as_ref() {
|
||||
if let Some((worktree, _)) = self.find_worktree(path, cx) {
|
||||
settings_location = Some(SettingsLocation {
|
||||
worktree_id: worktree.read(cx).id().to_usize(),
|
||||
worktree_id: worktree.read(cx).id(),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue