mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
TextEditor: Suggest saving new files with an extension from highlighter
This commit is contained in:
parent
c75bfa9cda
commit
9b3335723f
Notes:
sideshowbarker
2024-07-17 02:59:25 +09:00
Author: https://github.com/krkk
Commit: 9b3335723f
Pull-request: https://github.com/SerenityOS/serenity/pull/16570
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 5 additions and 1 deletions
|
@ -280,7 +280,11 @@ MainWidget::MainWidget()
|
|||
});
|
||||
|
||||
m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) {
|
||||
auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window(), m_name, m_extension);
|
||||
auto extension = m_extension;
|
||||
if (extension.is_null() && m_editor->syntax_highlighter())
|
||||
extension = Syntax::common_language_extension(m_editor->syntax_highlighter()->language());
|
||||
|
||||
auto response = FileSystemAccessClient::Client::the().try_save_file_deprecated(window(), m_name, extension);
|
||||
if (response.is_error())
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue