Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_php"
version = "0.4.4"
version = "0.4.5"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id = "php"
name = "PHP"
description = "PHP support."
version = "0.4.4"
version = "0.4.5"
schema_version = 1
authors = ["Piotr Osiewicz <[email protected]>"]
repository = "https://github.com/zed-extensions/php"
Expand Down
4 changes: 2 additions & 2 deletions src/language_servers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod phptools;
mod intelephense;
mod phpactor;
mod phptools;

pub use phptools::*;
pub use intelephense::*;
pub use phpactor::*;
pub use phptools::*;
2 changes: 1 addition & 1 deletion src/language_servers/intelephense.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Intelephense {
}

fn server_exists(&self) -> bool {
fs::metadata(SERVER_PATH).map_or(false, |stat| stat.is_file())
fs::metadata(SERVER_PATH).is_ok_and(|stat| stat.is_file())
}

fn server_script_path(&mut self, language_server_id: &LanguageServerId) -> Result<String> {
Expand Down
4 changes: 2 additions & 2 deletions src/language_servers/phpactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Phpactor {
}

if let Some(path) = &self.cached_binary_path {
if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
if fs::metadata(path).is_ok_and(|stat| stat.is_file()) {
return Ok(path.clone());
}
}
Expand Down Expand Up @@ -54,7 +54,7 @@ impl Phpactor {

let binary_path = format!("{version_dir}/phpactor.phar");

if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
if !fs::metadata(&binary_path).is_ok_and(|stat| stat.is_file()) {
zed::set_language_server_installation_status(
language_server_id,
&zed::LanguageServerInstallationStatus::Downloading,
Expand Down
2 changes: 1 addition & 1 deletion src/language_servers/phptools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl PhpTools {
}

fn server_exists(&self) -> bool {
fs::metadata(self.server_file_path()).map_or(false, |stat| stat.is_file())
fs::metadata(self.server_file_path()).is_ok_and(|stat| stat.is_file())
}

fn server_script_path(&mut self, language_server_id: &LanguageServerId) -> Result<String> {
Expand Down
2 changes: 1 addition & 1 deletion src/php.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl zed::Extension for PhpExtension {
.map_err(|_| "Could not get current directory")?
.join(&phpactor_path);

if !fs::exists(&abs_phpactor_path).map_or(false, |exists| exists) {
if !fs::exists(&abs_phpactor_path).is_ok_and(|exists| exists) {
return Err(format!(
"Could not resolve phpactor path {:?}!",
phpactor_path
Expand Down
24 changes: 11 additions & 13 deletions src/xdebug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl XDebug {
.and_then(|v| {
v.as_str().and_then(|s| {
s.eq("launch")
.then(|| StartDebuggingRequestArgumentsRequest::Launch)
.then_some(StartDebuggingRequestArgumentsRequest::Launch)
})
})
.ok_or_else(|| "Invalid config".into())
Expand Down Expand Up @@ -98,7 +98,7 @@ impl XDebug {
.current_version
.get()
.cloned()
.ok_or_else(|| format!("no installed version of Xdebug found"))?;
.ok_or_else(|| "no installed version of Xdebug found".to_string())?;
env::current_dir()
.unwrap()
.join(Self::NAME)
Expand All @@ -107,15 +107,13 @@ impl XDebug {
.into_owned()
};

let tcp_connection =
task_definition
.tcp_connection
.clone()
.unwrap_or_else(|| TcpArgumentsTemplate {
host: None,
port: None,
timeout: None,
});
let tcp_connection = task_definition
.tcp_connection
.unwrap_or(TcpArgumentsTemplate {
host: None,
port: None,
timeout: None,
});
let TcpArguments {
host,
port,
Expand Down Expand Up @@ -146,7 +144,7 @@ impl XDebug {
cwd: Some(worktree.root_path()),
envs: vec![],
request_args: StartDebuggingRequestArguments {
request: self.dap_request_kind(&configuration)?.into(),
request: self.dap_request_kind(&configuration)?,
configuration: configuration.to_string(),
},
})
Expand All @@ -173,7 +171,7 @@ impl XDebug {
let mut version = std::fs::read_dir(Self::NAME)
.ok()
.into_iter()
.flat_map(|e| e)
.flatten()
.filter_map(|e| {
e.ok().and_then(|entry| {
entry
Expand Down