mirror of https://github.com/lapce/lapce.git
Fix lanaguage from path
This commit is contained in:
parent
73a1c79d12
commit
caab22d091
|
@ -1544,11 +1544,14 @@ fn from_path_raw(path: &Path) -> Option<LapceLanguage> {
|
||||||
if properties
|
if properties
|
||||||
.files
|
.files
|
||||||
.iter()
|
.iter()
|
||||||
.zip(properties.extensions)
|
.any(|f| Some(*f) == filename.as_deref())
|
||||||
.any(|(f, e)| {
|
{
|
||||||
Some(*f) == filename.as_deref()
|
return Some(properties.id);
|
||||||
|| Some(*e) == extension.as_deref()
|
}
|
||||||
})
|
if properties
|
||||||
|
.extensions
|
||||||
|
.iter()
|
||||||
|
.any(|e| Some(*e) == extension.as_deref())
|
||||||
{
|
{
|
||||||
return Some(properties.id);
|
return Some(properties.id);
|
||||||
}
|
}
|
||||||
|
@ -1908,3 +1911,16 @@ pub(crate) fn walk_tree_bracket_ast(
|
||||||
cursor.goto_parent();
|
cursor.goto_parent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use super::LapceLanguage;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_lanaguage_from_path() {
|
||||||
|
let l = LapceLanguage::from_path(&PathBuf::new().join("test.rs"));
|
||||||
|
assert_eq!(l, LapceLanguage::Rust);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue