chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but hey, it's a start. Release Notes: - N/A
This commit is contained in:
parent
93249fc82b
commit
e6c1c51b37
361 changed files with 3530 additions and 3587 deletions
|
@ -22,7 +22,7 @@ impl ClojureExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -60,7 +60,7 @@ impl ClojureExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -76,7 +76,7 @@ impl ClojureExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ impl CsharpExtension {
|
|||
}
|
||||
|
||||
if let Some(path) = &self.cached_binary_path {
|
||||
if fs::metadata(&path).map_or(false, |stat| stat.is_file()) {
|
||||
if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
|
||||
return Ok(OmnisharpBinary {
|
||||
path: path.clone(),
|
||||
args: binary_args,
|
||||
|
@ -107,7 +107,7 @@ impl CsharpExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ impl DenoExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -63,7 +63,7 @@ impl DenoExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -79,7 +79,7 @@ impl DenoExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ impl zed::Extension for ElixirExtension {
|
|||
) -> Result<zed::Command> {
|
||||
match language_server_id.as_ref() {
|
||||
ElixirLs::LANGUAGE_SERVER_ID => {
|
||||
let elixir_ls = self.elixir_ls.get_or_insert_with(|| ElixirLs::new());
|
||||
let elixir_ls = self.elixir_ls.get_or_insert_with(ElixirLs::new);
|
||||
|
||||
Ok(zed::Command {
|
||||
command: elixir_ls.language_server_binary_path(language_server_id, worktree)?,
|
||||
|
@ -37,7 +37,7 @@ impl zed::Extension for ElixirExtension {
|
|||
})
|
||||
}
|
||||
NextLs::LANGUAGE_SERVER_ID => {
|
||||
let next_ls = self.next_ls.get_or_insert_with(|| NextLs::new());
|
||||
let next_ls = self.next_ls.get_or_insert_with(NextLs::new);
|
||||
|
||||
Ok(zed::Command {
|
||||
command: next_ls.language_server_binary_path(language_server_id, worktree)?,
|
||||
|
@ -46,7 +46,7 @@ impl zed::Extension for ElixirExtension {
|
|||
})
|
||||
}
|
||||
Lexical::LANGUAGE_SERVER_ID => {
|
||||
let lexical = self.lexical.get_or_insert_with(|| Lexical::new());
|
||||
let lexical = self.lexical.get_or_insert_with(Lexical::new);
|
||||
let lexical_binary =
|
||||
lexical.language_server_binary(language_server_id, worktree)?;
|
||||
|
||||
|
@ -110,13 +110,10 @@ impl zed::Extension for ElixirExtension {
|
|||
language_server_id: &LanguageServerId,
|
||||
worktree: &zed::Worktree,
|
||||
) -> Result<Option<serde_json::Value>> {
|
||||
match language_server_id.as_ref() {
|
||||
ElixirLs::LANGUAGE_SERVER_ID => {
|
||||
if let Some(elixir_ls) = self.elixir_ls.as_mut() {
|
||||
return elixir_ls.language_server_workspace_configuration(worktree);
|
||||
}
|
||||
if language_server_id.as_ref() == ElixirLs::LANGUAGE_SERVER_ID {
|
||||
if let Some(elixir_ls) = self.elixir_ls.as_mut() {
|
||||
return elixir_ls.language_server_workspace_configuration(worktree);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
|
|
|
@ -34,7 +34,7 @@ impl ElixirLs {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -63,7 +63,7 @@ impl ElixirLs {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -83,7 +83,7 @@ impl ElixirLs {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ impl Lexical {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -83,7 +83,7 @@ impl Lexical {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -103,7 +103,7 @@ impl Lexical {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ impl NextLs {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -77,7 +77,7 @@ impl NextLs {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -95,7 +95,7 @@ impl NextLs {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ impl ElmExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&server_id,
|
||||
server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let version = zed::npm_package_latest_version(PACKAGE_NAME)?;
|
||||
|
@ -33,7 +33,7 @@ impl ElmExtension {
|
|||
|| zed::npm_package_installed_version(PACKAGE_NAME)?.as_ref() != Some(&version)
|
||||
{
|
||||
zed::set_language_server_installation_status(
|
||||
&server_id,
|
||||
server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
let result = zed::npm_install_package(PACKAGE_NAME, &version);
|
||||
|
|
|
@ -24,7 +24,7 @@ impl zed::Extension for ErlangExtension {
|
|||
) -> Result<zed::Command> {
|
||||
match language_server_id.as_ref() {
|
||||
ErlangLs::LANGUAGE_SERVER_ID => {
|
||||
let erlang_ls = self.erlang_ls.get_or_insert_with(|| ErlangLs::new());
|
||||
let erlang_ls = self.erlang_ls.get_or_insert_with(ErlangLs::new);
|
||||
|
||||
Ok(zed::Command {
|
||||
command: erlang_ls.language_server_binary_path(language_server_id, worktree)?,
|
||||
|
@ -35,7 +35,7 @@ impl zed::Extension for ErlangExtension {
|
|||
ErlangLanguagePlatform::LANGUAGE_SERVER_ID => {
|
||||
let erlang_language_platform = self
|
||||
.erlang_language_platform
|
||||
.get_or_insert_with(|| ErlangLanguagePlatform::new());
|
||||
.get_or_insert_with(ErlangLanguagePlatform::new);
|
||||
erlang_language_platform.language_server_command(language_server_id, worktree)
|
||||
}
|
||||
language_server_id => Err(format!("unknown language server: {language_server_id}")),
|
||||
|
|
|
@ -43,7 +43,7 @@ impl ErlangLanguagePlatform {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -85,7 +85,7 @@ impl ErlangLanguagePlatform {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -101,7 +101,7 @@ impl ErlangLanguagePlatform {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ impl GleamExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -68,7 +68,7 @@ impl GleamExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -84,7 +84,7 @@ impl GleamExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,12 +157,12 @@ impl zed::Extension for GleamExtension {
|
|||
) -> Result<SlashCommandOutput, String> {
|
||||
match command.name.as_str() {
|
||||
"gleam-project" => {
|
||||
let worktree = worktree.ok_or_else(|| "no worktree")?;
|
||||
let worktree = worktree.ok_or("no worktree")?;
|
||||
|
||||
let mut text = String::new();
|
||||
text.push_str("You are in a Gleam project.\n");
|
||||
|
||||
if let Some(gleam_toml) = worktree.read_text_file("gleam.toml").ok() {
|
||||
if let Ok(gleam_toml) = worktree.read_text_file("gleam.toml") {
|
||||
text.push_str("The `gleam.toml` is as follows:\n");
|
||||
text.push_str(&gleam_toml);
|
||||
}
|
||||
|
@ -244,6 +244,6 @@ mod tests {
|
|||
|
||||
let detail = "fn(\n Method,\n List(#(String, String)),\n a,\n Scheme,\n String,\n Option(Int),\n String,\n Option(String),\n) -> Request(a)";
|
||||
let expected = "fn(Method, List(#(String, String)), a, Scheme, String, Option(Int), String, Option(String)) -> Request(a)";
|
||||
assert_eq!(strip_newlines_from_detail(&detail), expected);
|
||||
assert_eq!(strip_newlines_from_detail(detail), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,10 +130,10 @@ pub struct GleamChromeRemover;
|
|||
|
||||
impl HandleTag for GleamChromeRemover {
|
||||
fn should_handle(&self, tag: &str) -> bool {
|
||||
match tag {
|
||||
"head" | "script" | "style" | "svg" | "header" | "footer" | "a" => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(
|
||||
tag,
|
||||
"head" | "script" | "style" | "svg" | "header" | "footer" | "a"
|
||||
)
|
||||
}
|
||||
|
||||
fn handle_tag_start(
|
||||
|
@ -188,10 +188,7 @@ impl GleamModuleCollector {
|
|||
|
||||
impl HandleTag for GleamModuleCollector {
|
||||
fn should_handle(&self, tag: &str) -> bool {
|
||||
match tag {
|
||||
"h2" | "a" => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(tag, "h2" | "a")
|
||||
}
|
||||
|
||||
fn handle_tag_start(
|
||||
|
@ -199,15 +196,10 @@ impl HandleTag for GleamModuleCollector {
|
|||
tag: &HtmlElement,
|
||||
writer: &mut MarkdownWriter,
|
||||
) -> StartTagOutcome {
|
||||
match tag.tag() {
|
||||
"a" => {
|
||||
if self.has_seen_modules_header && writer.is_inside("li") {
|
||||
if let Some(module_name) = Self::parse_module(tag) {
|
||||
self.modules.insert(module_name);
|
||||
}
|
||||
}
|
||||
if tag.tag() == "a" && self.has_seen_modules_header && writer.is_inside("li") {
|
||||
if let Some(module_name) = Self::parse_module(tag) {
|
||||
self.modules.insert(module_name);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
StartTagOutcome::Continue
|
||||
|
|
|
@ -23,7 +23,7 @@ impl GlslExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -62,7 +62,7 @@ impl GlslExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -83,7 +83,7 @@ impl GlslExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ impl HtmlExtension {
|
|||
|| zed::npm_package_installed_version(PACKAGE_NAME)?.as_ref() != Some(&version)
|
||||
{
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
let result = zed::npm_install_package(PACKAGE_NAME, &version);
|
||||
|
|
|
@ -24,7 +24,7 @@ impl LuaExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -72,7 +72,7 @@ impl LuaExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -91,7 +91,7 @@ impl LuaExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ impl zed::Extension for OcamlExtension {
|
|||
}
|
||||
|
||||
Some((CompletionKind::Field, detail)) => {
|
||||
let filter_range_start = if name.starts_with(&['~', '?']) { 1 } else { 0 };
|
||||
let filter_range_start = if name.starts_with(['~', '?']) { 1 } else { 0 };
|
||||
|
||||
let record_prefix = "type t = { ";
|
||||
let record_suffix = "; }";
|
||||
|
|
|
@ -58,7 +58,7 @@ impl Intelephense {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let version = zed::npm_package_latest_version(PACKAGE_NAME)?;
|
||||
|
@ -67,7 +67,7 @@ impl Intelephense {
|
|||
|| zed::npm_package_installed_version(PACKAGE_NAME)?.as_ref() != Some(&version)
|
||||
{
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
let result = zed::npm_install_package(PACKAGE_NAME, &version);
|
||||
|
|
|
@ -31,7 +31,7 @@ impl Phpactor {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -56,7 +56,7 @@ impl Phpactor {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -74,7 +74,7 @@ impl Phpactor {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ impl zed::Extension for PhpExtension {
|
|||
) -> Result<zed::Command> {
|
||||
match language_server_id.as_ref() {
|
||||
Intelephense::LANGUAGE_SERVER_ID => {
|
||||
let intelephense = self.intelephense.get_or_insert_with(|| Intelephense::new());
|
||||
let intelephense = self.intelephense.get_or_insert_with(Intelephense::new);
|
||||
intelephense.language_server_command(language_server_id, worktree)
|
||||
}
|
||||
Phpactor::LANGUAGE_SERVER_ID => {
|
||||
let phpactor = self.phpactor.get_or_insert_with(|| Phpactor::new());
|
||||
let phpactor = self.phpactor.get_or_insert_with(Phpactor::new);
|
||||
|
||||
Ok(zed::Command {
|
||||
command: phpactor.language_server_binary_path(language_server_id, worktree)?,
|
||||
|
@ -45,13 +45,10 @@ impl zed::Extension for PhpExtension {
|
|||
language_server_id: &LanguageServerId,
|
||||
worktree: &zed::Worktree,
|
||||
) -> Result<Option<serde_json::Value>> {
|
||||
match language_server_id.as_ref() {
|
||||
Intelephense::LANGUAGE_SERVER_ID => {
|
||||
if let Some(intelephense) = self.intelephense.as_mut() {
|
||||
return intelephense.language_server_workspace_configuration(worktree);
|
||||
}
|
||||
if language_server_id.as_ref() == Intelephense::LANGUAGE_SERVER_ID {
|
||||
if let Some(intelephense) = self.intelephense.as_mut() {
|
||||
return intelephense.language_server_workspace_configuration(worktree);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
|
|
|
@ -88,7 +88,7 @@ impl RubyLsp {
|
|||
pub fn label_for_symbol(&self, symbol: Symbol) -> Option<CodeLabel> {
|
||||
let name = &symbol.name;
|
||||
|
||||
return match symbol.kind {
|
||||
match symbol.kind {
|
||||
SymbolKind::Method => {
|
||||
let code = format!("def {name}; end");
|
||||
let filter_range = 0..name.len();
|
||||
|
@ -123,6 +123,6 @@ impl RubyLsp {
|
|||
})
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,15 +29,15 @@ impl zed::Extension for RubyExtension {
|
|||
) -> Result<zed::Command> {
|
||||
match language_server_id.as_ref() {
|
||||
Solargraph::LANGUAGE_SERVER_ID => {
|
||||
let solargraph = self.solargraph.get_or_insert_with(|| Solargraph::new());
|
||||
let solargraph = self.solargraph.get_or_insert_with(Solargraph::new);
|
||||
solargraph.language_server_command(language_server_id, worktree)
|
||||
}
|
||||
RubyLsp::LANGUAGE_SERVER_ID => {
|
||||
let ruby_lsp = self.ruby_lsp.get_or_insert_with(|| RubyLsp::new());
|
||||
let ruby_lsp = self.ruby_lsp.get_or_insert_with(RubyLsp::new);
|
||||
ruby_lsp.language_server_command(language_server_id, worktree)
|
||||
}
|
||||
Rubocop::LANGUAGE_SERVER_ID => {
|
||||
let rubocop = self.rubocop.get_or_insert_with(|| Rubocop::new());
|
||||
let rubocop = self.rubocop.get_or_insert_with(Rubocop::new);
|
||||
rubocop.language_server_command(language_server_id, worktree)
|
||||
}
|
||||
language_server_id => Err(format!("unknown language server: {language_server_id}")),
|
||||
|
|
|
@ -39,7 +39,7 @@ impl RuffExtension {
|
|||
}
|
||||
|
||||
if let Some(path) = &self.cached_binary_path {
|
||||
if fs::metadata(&path).map_or(false, |stat| stat.is_file()) {
|
||||
if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
|
||||
return Ok(RuffBinary {
|
||||
path: path.clone(),
|
||||
args: binary_args,
|
||||
|
@ -48,7 +48,7 @@ impl RuffExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -93,7 +93,7 @@ impl RuffExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
let file_kind = match platform {
|
||||
|
@ -108,7 +108,7 @@ impl RuffExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ impl SnippetExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -61,7 +61,7 @@ impl SnippetExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -77,7 +77,7 @@ impl SnippetExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ impl TerraformExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -55,7 +55,7 @@ impl TerraformExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl TerraformExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ impl TestExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -58,7 +58,7 @@ impl TestExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -74,7 +74,7 @@ impl TestExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ impl TomlExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let release = zed::latest_github_release(
|
||||
|
@ -64,7 +64,7 @@ impl TomlExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -82,7 +82,7 @@ impl TomlExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|err| format!("failed to load directory entry {err}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ impl ZigExtension {
|
|||
}
|
||||
|
||||
if let Some(path) = &self.cached_binary_path {
|
||||
if fs::metadata(&path).map_or(false, |stat| stat.is_file()) {
|
||||
if fs::metadata(path).map_or(false, |stat| stat.is_file()) {
|
||||
return Ok(ZlsBinary {
|
||||
path: path.clone(),
|
||||
args,
|
||||
|
@ -58,7 +58,7 @@ impl ZigExtension {
|
|||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
|
||||
|
@ -100,7 +100,7 @@ impl ZigExtension {
|
|||
|
||||
if !fs::metadata(&binary_path).map_or(false, |stat| stat.is_file()) {
|
||||
zed::set_language_server_installation_status(
|
||||
&language_server_id,
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
|
||||
|
@ -121,7 +121,7 @@ impl ZigExtension {
|
|||
for entry in entries {
|
||||
let entry = entry.map_err(|e| format!("failed to load directory entry {e}"))?;
|
||||
if entry.file_name().to_str() != Some(&version_dir) {
|
||||
fs::remove_dir_all(&entry.path()).ok();
|
||||
fs::remove_dir_all(entry.path()).ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue