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
|
@ -27,6 +27,7 @@ use gpui::{
|
|||
use lsp::LanguageServerId;
|
||||
use parking_lot::Mutex;
|
||||
use serde_json::Value;
|
||||
use settings::WorktreeId;
|
||||
use similar::{ChangeTag, TextDiff};
|
||||
use smallvec::SmallVec;
|
||||
use smol::future::yield_now;
|
||||
|
@ -361,7 +362,7 @@ pub trait File: Send + Sync {
|
|||
/// Returns the id of the worktree to which this file belongs.
|
||||
///
|
||||
/// This is needed for looking up project-specific settings.
|
||||
fn worktree_id(&self) -> usize;
|
||||
fn worktree_id(&self, cx: &AppContext) -> WorktreeId;
|
||||
|
||||
/// Returns whether the file has been deleted.
|
||||
fn is_deleted(&self) -> bool;
|
||||
|
@ -4172,8 +4173,8 @@ impl File for TestFile {
|
|||
self.path().file_name().unwrap_or(self.root_name.as_ref())
|
||||
}
|
||||
|
||||
fn worktree_id(&self) -> usize {
|
||||
0
|
||||
fn worktree_id(&self, _: &AppContext) -> WorktreeId {
|
||||
WorktreeId::from_usize(0)
|
||||
}
|
||||
|
||||
fn is_deleted(&self) -> bool {
|
||||
|
|
|
@ -38,6 +38,7 @@ use schemars::{
|
|||
};
|
||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||
use serde_json::Value;
|
||||
use settings::WorktreeId;
|
||||
use smol::future::FutureExt as _;
|
||||
use std::num::NonZeroU32;
|
||||
use std::{
|
||||
|
@ -280,7 +281,7 @@ impl CachedLspAdapter {
|
|||
pub trait LspAdapterDelegate: Send + Sync {
|
||||
fn show_notification(&self, message: &str, cx: &mut AppContext);
|
||||
fn http_client(&self) -> Arc<dyn HttpClient>;
|
||||
fn worktree_id(&self) -> u64;
|
||||
fn worktree_id(&self) -> WorktreeId;
|
||||
fn worktree_root_path(&self) -> &Path;
|
||||
fn update_status(&self, language: LanguageServerName, status: LanguageServerBinaryStatus);
|
||||
|
||||
|
|
|
@ -20,15 +20,6 @@ use settings::{add_references_to_properties, Settings, SettingsLocation, Setting
|
|||
use std::{num::NonZeroU32, path::Path, sync::Arc};
|
||||
use util::serde::default_true;
|
||||
|
||||
impl<'a> From<&'a dyn File> for SettingsLocation<'a> {
|
||||
fn from(val: &'a dyn File) -> Self {
|
||||
SettingsLocation {
|
||||
worktree_id: val.worktree_id(),
|
||||
path: val.path().as_ref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the language settings.
|
||||
pub fn init(cx: &mut AppContext) {
|
||||
AllLanguageSettings::register(cx);
|
||||
|
@ -49,7 +40,10 @@ pub fn all_language_settings<'a>(
|
|||
file: Option<&Arc<dyn File>>,
|
||||
cx: &'a AppContext,
|
||||
) -> &'a AllLanguageSettings {
|
||||
let location = file.map(|f| f.as_ref().into());
|
||||
let location = file.map(|f| SettingsLocation {
|
||||
worktree_id: f.worktree_id(cx),
|
||||
path: f.path().as_ref(),
|
||||
});
|
||||
AllLanguageSettings::get(location, cx)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue