Skip to content

Commit

Permalink
bugfix: Fix CI failure cause by inconsistent order of walk files
Browse files Browse the repository at this point in the history
  • Loading branch information
He1pa committed Apr 7, 2023
1 parent 0651e98 commit 414a454
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion kclvm/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use kclvm_parser::LoadProgramOptions;
use kclvm_runtime::PanicInfo;
use kclvm_utils::path::PathPrefix;
use std::{
fs::read_dir,
fs::{read_dir, self},
io::{self, ErrorKind},
path::{Path, PathBuf},
};
Expand Down Expand Up @@ -186,5 +186,6 @@ pub fn get_kcl_files<P: AsRef<Path>>(path: P, recursively: bool) -> Result<Vec<S
}
}
}
files.sort();
Ok(files)
}
9 changes: 7 additions & 2 deletions kclvm/tools/src/LSP/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! + defitions in pkg
//! + system module functions

use std::io;
use std::{fs, path::Path};

use indexmap::IndexSet;
Expand Down Expand Up @@ -74,8 +75,12 @@ fn completion_for_import(
Path::new(&program.root).join(pkgpath.replace('.', &std::path::MAIN_SEPARATOR.to_string()));
if real_path.is_dir() {
if let Ok(entries) = fs::read_dir(real_path) {
for entry in entries.flatten() {
let path = entry.path();
let mut entries = entries
.map(|res| res.map(|e| e.path()))
.collect::<Result<Vec<_>, io::Error>>()
.unwrap();
entries.sort();
for path in entries {
let filename = path.file_name().unwrap().to_str().unwrap().to_string();
if path.is_dir() {
items.insert(filename);
Expand Down

0 comments on commit 414a454

Please sign in to comment.