editor: In OpenFile check if file with path_suffix exists (#17805)

Demo:


https://github.com/user-attachments/assets/6acb6c1e-bb15-4205-9dcb-2aa4bb99dcf9



Release Notes:

- When using `OpenFile` (`gf` in Vim mode) and the word under the cursor
is not an existing file path, we now fall back and additionally check
whether a file called
`<word-under-cursor>.<language-specific-path-suffixes>` exists. That's
similar to Vim's `suffixesadd` option.

---------

Co-authored-by: Abdelhakim Qbaich <abdelhakim@qbaich.com>
Co-authored-by: Pete LeVasseur <plevasseur@gmail.com>
This commit is contained in:
Thorsten Ball 2024-09-13 15:11:10 -04:00 committed by GitHub
parent 8f833ea029
commit adbe973f02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 83 additions and 9 deletions

View file

@ -1410,6 +1410,10 @@ impl Language {
}
impl LanguageScope {
pub fn path_suffixes(&self) -> &[String] {
&self.language.path_suffixes()
}
pub fn language_name(&self) -> LanguageName {
self.language.config.name.clone()
}