context_server: Change command string field to PathBuf (#34873)
Release Notes: - N/A
This commit is contained in:
parent
87014cec71
commit
3a651c546b
7 changed files with 22 additions and 23 deletions
|
@ -610,7 +610,7 @@ mod tests {
|
|||
use context_server::test::create_fake_transport;
|
||||
use gpui::{AppContext, TestAppContext, UpdateGlobal as _};
|
||||
use serde_json::json;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use std::{cell::RefCell, path::PathBuf, rc::Rc};
|
||||
use util::path;
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -931,7 +931,7 @@ mod tests {
|
|||
ContextServerSettings::Custom {
|
||||
enabled: true,
|
||||
command: ContextServerCommand {
|
||||
path: "somebinary".to_string(),
|
||||
path: "somebinary".into(),
|
||||
args: vec!["arg".to_string()],
|
||||
env: None,
|
||||
},
|
||||
|
@ -971,7 +971,7 @@ mod tests {
|
|||
ContextServerSettings::Custom {
|
||||
enabled: true,
|
||||
command: ContextServerCommand {
|
||||
path: "somebinary".to_string(),
|
||||
path: "somebinary".into(),
|
||||
args: vec!["anotherArg".to_string()],
|
||||
env: None,
|
||||
},
|
||||
|
@ -1053,7 +1053,7 @@ mod tests {
|
|||
ContextServerSettings::Custom {
|
||||
enabled: true,
|
||||
command: ContextServerCommand {
|
||||
path: "somebinary".to_string(),
|
||||
path: "somebinary".into(),
|
||||
args: vec!["arg".to_string()],
|
||||
env: None,
|
||||
},
|
||||
|
@ -1104,7 +1104,7 @@ mod tests {
|
|||
ContextServerSettings::Custom {
|
||||
enabled: false,
|
||||
command: ContextServerCommand {
|
||||
path: "somebinary".to_string(),
|
||||
path: "somebinary".into(),
|
||||
args: vec!["arg".to_string()],
|
||||
env: None,
|
||||
},
|
||||
|
@ -1132,7 +1132,7 @@ mod tests {
|
|||
ContextServerSettings::Custom {
|
||||
enabled: true,
|
||||
command: ContextServerCommand {
|
||||
path: "somebinary".to_string(),
|
||||
path: "somebinary".into(),
|
||||
args: vec!["arg".to_string()],
|
||||
env: None,
|
||||
},
|
||||
|
@ -1184,7 +1184,7 @@ mod tests {
|
|||
ContextServerSettings::Custom {
|
||||
enabled: true,
|
||||
command: ContextServerCommand {
|
||||
path: "somebinary".to_string(),
|
||||
path: "somebinary".into(),
|
||||
args: vec!["arg".to_string()],
|
||||
env: None,
|
||||
},
|
||||
|
@ -1256,11 +1256,11 @@ mod tests {
|
|||
}
|
||||
|
||||
struct FakeContextServerDescriptor {
|
||||
path: String,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl FakeContextServerDescriptor {
|
||||
fn new(path: impl Into<String>) -> Self {
|
||||
fn new(path: impl Into<PathBuf>) -> Self {
|
||||
Self { path: path.into() }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,10 +61,7 @@ impl registry::ContextServerDescriptor for ContextServerDescriptor {
|
|||
let mut command = extension
|
||||
.context_server_command(id.clone(), extension_project.clone())
|
||||
.await?;
|
||||
command.command = extension
|
||||
.path_from_extension(command.command.as_ref())
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
command.command = extension.path_from_extension(&command.command);
|
||||
|
||||
log::info!("loaded command for context server {id}: {command:?}");
|
||||
|
||||
|
|
|
@ -581,7 +581,7 @@ impl Settings for ProjectSettings {
|
|||
|
||||
#[derive(Deserialize)]
|
||||
struct VsCodeContextServerCommand {
|
||||
command: String,
|
||||
command: PathBuf,
|
||||
args: Option<Vec<String>>,
|
||||
env: Option<HashMap<String, String>>,
|
||||
// note: we don't support envFile and type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue