mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
TextEditor: Add support for SQL highlighting
This commit is contained in:
parent
984b6e08cf
commit
3ab37674c6
3 changed files with 12 additions and 1 deletions
|
@ -8,4 +8,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(TextEditor ICON app-text-editor)
|
serenity_app(TextEditor ICON app-text-editor)
|
||||||
target_link_libraries(TextEditor LibWeb LibMarkdown LibGUI LibShell LibRegex LibDesktop LibCpp LibJS)
|
target_link_libraries(TextEditor LibWeb LibMarkdown LibGUI LibShell LibRegex LibDesktop LibCpp LibJS LibSQL)
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
||||||
#include <LibJS/SyntaxHighlighter.h>
|
#include <LibJS/SyntaxHighlighter.h>
|
||||||
#include <LibMarkdown/Document.h>
|
#include <LibMarkdown/Document.h>
|
||||||
|
#include <LibSQL/SyntaxHighlighter.h>
|
||||||
#include <LibWeb/OutOfProcessWebView.h>
|
#include <LibWeb/OutOfProcessWebView.h>
|
||||||
#include <Shell/SyntaxHighlighter.h>
|
#include <Shell/SyntaxHighlighter.h>
|
||||||
|
|
||||||
|
@ -570,6 +571,13 @@ void MainWidget::initialize_menubar(GUI::Menubar& menubar)
|
||||||
syntax_actions.add_action(*m_shell_highlight);
|
syntax_actions.add_action(*m_shell_highlight);
|
||||||
syntax_menu.add_action(*m_shell_highlight);
|
syntax_menu.add_action(*m_shell_highlight);
|
||||||
|
|
||||||
|
m_sql_highlight = GUI::Action::create_checkable("S&QL File", [&](auto&) {
|
||||||
|
m_editor->set_syntax_highlighter(make<SQL::SyntaxHighlighter>());
|
||||||
|
m_editor->update();
|
||||||
|
});
|
||||||
|
syntax_actions.add_action(*m_sql_highlight);
|
||||||
|
syntax_menu.add_action(*m_sql_highlight);
|
||||||
|
|
||||||
auto& help_menu = menubar.add_menu("&Help");
|
auto& help_menu = menubar.add_menu("&Help");
|
||||||
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
|
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/TextEditor.md"), "/bin/Help");
|
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/TextEditor.md"), "/bin/Help");
|
||||||
|
@ -591,6 +599,8 @@ void MainWidget::set_path(const LexicalPath& lexical_path)
|
||||||
m_gml_highlight->activate();
|
m_gml_highlight->activate();
|
||||||
} else if (m_extension == "ini") {
|
} else if (m_extension == "ini") {
|
||||||
m_ini_highlight->activate();
|
m_ini_highlight->activate();
|
||||||
|
} else if (m_extension == "sql") {
|
||||||
|
m_sql_highlight->activate();
|
||||||
} else {
|
} else {
|
||||||
m_plain_text_highlight->activate();
|
m_plain_text_highlight->activate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,7 @@ private:
|
||||||
RefPtr<GUI::Action> m_gml_highlight;
|
RefPtr<GUI::Action> m_gml_highlight;
|
||||||
RefPtr<GUI::Action> m_ini_highlight;
|
RefPtr<GUI::Action> m_ini_highlight;
|
||||||
RefPtr<GUI::Action> m_shell_highlight;
|
RefPtr<GUI::Action> m_shell_highlight;
|
||||||
|
RefPtr<GUI::Action> m_sql_highlight;
|
||||||
|
|
||||||
RefPtr<Web::OutOfProcessWebView> m_page_view;
|
RefPtr<Web::OutOfProcessWebView> m_page_view;
|
||||||
RefPtr<Core::ConfigFile> m_config;
|
RefPtr<Core::ConfigFile> m_config;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue