Fix #24314 - File icons missing for hidden files (#24391)

- **fix ignoring ignored files when matching icons**
- **remove poorly named and confusing method
`PathExt.icon_stem_or_suffix` and refactor
`PathExt.extension_or_hidden_file_name` to actually do what it says it
does**

Closes #24314

Release Notes:

- Fixed an issue where hidden files would have the default icon instead
of the correct one
- Fixed an issue where files with specific icons (such as
`eslint.config.js`) would not have the their specific icon without a
leading `.` (`.eslint.config.js`)
This commit is contained in:
Ben Kunkle 2025-02-06 14:26:42 -06:00 committed by GitHub
parent ad46c5b567
commit 9c132fece5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 52 deletions

View file

@ -31,7 +31,7 @@ use sum_tree::Bias;
use text::{Point, Rope};
use theme::Theme;
use unicase::UniCase;
use util::{maybe, paths::PathExt, post_inc, ResultExt};
use util::{maybe, post_inc, ResultExt};
#[derive(
Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema,
@ -659,7 +659,7 @@ impl LanguageRegistry {
user_file_types: Option<&HashMap<Arc<str>, GlobSet>>,
) -> Option<AvailableLanguage> {
let filename = path.file_name().and_then(|name| name.to_str());
let extension = path.extension_or_hidden_file_name();
let extension = path.extension().and_then(|ext| ext.to_str());
let path_suffixes = [extension, filename, path.to_str()];
let empty = GlobSet::empty();