mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-23 02:22:13 +00:00
Fixed build errors in json_language
This commit is contained in:
parent
c5002d85a9
commit
073bd767f2
3 changed files with 11 additions and 13 deletions
|
@ -1,5 +1,6 @@
|
||||||
[target.'cfg(all())']
|
[target.'cfg(all())']
|
||||||
rustflags = [
|
rustflags = [
|
||||||
|
"-Dwarnings",
|
||||||
"-Aclippy::reversed_empty_ranges",
|
"-Aclippy::reversed_empty_ranges",
|
||||||
"-Aclippy::missing_safety_doc",
|
"-Aclippy::missing_safety_doc",
|
||||||
"-Aclippy::let_unit_value",
|
"-Aclippy::let_unit_value",
|
||||||
|
|
BIN
.github/workflows/.ci.yml.swp
vendored
BIN
.github/workflows/.ci.yml.swp
vendored
Binary file not shown.
|
@ -1,13 +1,12 @@
|
||||||
|
use std::{fs, path::PathBuf};
|
||||||
|
|
||||||
use plugin::prelude::*;
|
use plugin::prelude::*;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::fs;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
#[import]
|
#[import]
|
||||||
fn command(string: &str) -> Option<Vec<u8>>;
|
fn command(string: &str) -> Option<Vec<u8>>;
|
||||||
|
|
||||||
const BIN_PATH: &'static str =
|
const BIN_PATH: &str = "node_modules/vscode-json-languageserver/bin/vscode-json-languageserver";
|
||||||
"node_modules/vscode-json-languageserver/bin/vscode-json-languageserver";
|
|
||||||
|
|
||||||
#[export]
|
#[export]
|
||||||
pub fn name() -> &'static str {
|
pub fn name() -> &'static str {
|
||||||
|
@ -51,9 +50,8 @@ pub fn fetch_server_binary(container_dir: PathBuf, version: String) -> Result<Pa
|
||||||
return Err("failed to install vscode-json-languageserver".to_string());
|
return Err("failed to install vscode-json-languageserver".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(mut entries) = fs::read_dir(&container_dir).ok() {
|
if let Ok(entries) = fs::read_dir(&container_dir) {
|
||||||
while let Some(entry) = entries.next() {
|
for entry in entries.flatten() {
|
||||||
if let Some(entry) = entry.ok() {
|
|
||||||
let entry_path = entry.path();
|
let entry_path = entry.path();
|
||||||
if entry_path.as_path() != version_dir {
|
if entry_path.as_path() != version_dir {
|
||||||
fs::remove_dir_all(&entry_path).ok();
|
fs::remove_dir_all(&entry_path).ok();
|
||||||
|
@ -61,7 +59,6 @@ pub fn fetch_server_binary(container_dir: PathBuf, version: String) -> Result<Pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Ok(binary_path)
|
Ok(binary_path)
|
||||||
}
|
}
|
||||||
|
@ -69,9 +66,9 @@ pub fn fetch_server_binary(container_dir: PathBuf, version: String) -> Result<Pa
|
||||||
#[export]
|
#[export]
|
||||||
pub fn cached_server_binary(container_dir: PathBuf) -> Option<PathBuf> {
|
pub fn cached_server_binary(container_dir: PathBuf) -> Option<PathBuf> {
|
||||||
let mut last_version_dir = None;
|
let mut last_version_dir = None;
|
||||||
let mut entries = fs::read_dir(&container_dir).ok()?;
|
let entries = fs::read_dir(&container_dir).ok()?;
|
||||||
|
|
||||||
while let Some(entry) = entries.next() {
|
for entry in entries {
|
||||||
let entry = entry.ok()?;
|
let entry = entry.ok()?;
|
||||||
if entry.file_type().ok()?.is_dir() {
|
if entry.file_type().ok()?.is_dir() {
|
||||||
last_version_dir = Some(entry.path());
|
last_version_dir = Some(entry.path());
|
||||||
|
|
Loading…
Reference in a new issue