Skip to content

Commit 43b7286

Browse files
committed
Fix some issue
1 parent e86749c commit 43b7286

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

crates/code_analysis/src/semantic/type_compact/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ fn infer_type_compact(
148148
(LuaType::TableConst(_), _) => false,
149149
(LuaType::Extends(_), _) => false,
150150
(LuaType::MuliReturn(_), _) => false,
151+
(LuaType::Namespace(a), LuaType::Namespace(b)) => a == b,
151152
_ => false,
152153
}
153154
}

crates/code_analysis/src/vfs/loader.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,11 @@ pub fn read_file_with_encoding(path: &Path, encoding: &str) -> Option<String> {
8888
let content = fs::read(path).ok()?;
8989
let encoding = Encoding::for_label(encoding.as_bytes()).unwrap_or(UTF_8);
9090

91-
let (content, _, has_error) = encoding.decode(&content);
91+
let (content, has_error) = encoding.decode_with_bom_removal(&content);
9292
if has_error {
9393
error!("Error decoding file: {:?}", path);
9494
return None;
9595
}
9696

97-
// Remove BOM
98-
let content_str = if encoding == UTF_8 && content.starts_with("\u{FEFF}") {
99-
&content[3..]
100-
} else {
101-
&content
102-
};
103-
104-
Some(content_str.to_string())
97+
Some(content.to_string())
10598
}

crates/code_analysis/src/vfs/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ impl Vfs {
103103

104104
pub fn set_file_content(&mut self, uri: &Uri, data: Option<String>) -> FileId {
105105
let fid = self.file_id(uri);
106-
if cfg!(debug_assertions) {
107-
log::debug!("file_id: {:?}, uri: {}", fid, uri.as_str());
108-
}
106+
log::debug!("file_id: {:?}, uri: {}", fid, uri.as_str());
109107

110108
if let Some(data) = &data {
111109
let line_index = LineIndex::parse(&data);

0 commit comments

Comments
 (0)