mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:27:45 +00:00
Playground: Remove the GML formatting warning
As we no longer remove comments when formatting GML, this gets rid of the warning presented to the user when there are comments in the GML.
This commit is contained in:
parent
41ef4f11dc
commit
32de6dde4c
1 changed files with 2 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, Julius Heijmen <julius.heijmen@gmail.com>
|
* Copyright (c) 2021, Julius Heijmen <julius.heijmen@gmail.com>
|
||||||
|
* Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -214,22 +215,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
auto edit_menu = TRY(window->try_add_menu("&Edit"));
|
auto edit_menu = TRY(window->try_add_menu("&Edit"));
|
||||||
TRY(edit_menu->try_add_action(GUI::Action::create("&Format GML", { Mod_Ctrl | Mod_Shift, Key_I }, [&](auto&) {
|
TRY(edit_menu->try_add_action(GUI::Action::create("&Format GML", { Mod_Ctrl | Mod_Shift, Key_I }, [&](auto&) {
|
||||||
auto source = editor->text();
|
auto formatted_gml = GUI::GML::format_gml(editor->text());
|
||||||
GUI::GML::Lexer lexer(source);
|
|
||||||
for (auto& token : lexer.lex()) {
|
|
||||||
if (token.m_type == GUI::GML::Token::Type::Comment) {
|
|
||||||
auto result = GUI::MessageBox::show(
|
|
||||||
window,
|
|
||||||
"Your GML contains comments, which currently are not supported by the formatter and will be removed. Proceed?",
|
|
||||||
"Warning",
|
|
||||||
GUI::MessageBox::Type::Warning,
|
|
||||||
GUI::MessageBox::InputType::OKCancel);
|
|
||||||
if (result == GUI::MessageBox::ExecCancel)
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
auto formatted_gml = GUI::GML::format_gml(source);
|
|
||||||
if (!formatted_gml.is_null()) {
|
if (!formatted_gml.is_null()) {
|
||||||
editor->set_text(formatted_gml);
|
editor->set_text(formatted_gml);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue