mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:42:43 +00:00 
			
		
		
		
	LibSyntax+LibGUI+LibJS: Move JS syntax highlighter to LibJS
This is a little bit messy but the basic idea is: Syntax::Highlighter now has a Syntax::HighlighterClient to talk to the outside world. It mostly communicates in LibGUI primitives that are available in headers, so inlineable. GUI::TextEditor inherits from Syntax::HighlighterClient. This let us to move GUI::JSSyntaxHighlighter to JS::SyntaxHighlighter and remove LibGUI's dependency on LibJS.
This commit is contained in:
		
							parent
							
								
									22baa5e64f
								
							
						
					
					
						commit
						ddbf20ecf6
					
				
					 23 changed files with 139 additions and 80 deletions
				
			
		|  | @ -43,7 +43,6 @@ | |||
| #include <LibGUI/FontPicker.h> | ||||
| #include <LibGUI/GMLSyntaxHighlighter.h> | ||||
| #include <LibGUI/INISyntaxHighlighter.h> | ||||
| #include <LibGUI/JSSyntaxHighlighter.h> | ||||
| #include <LibGUI/Menu.h> | ||||
| #include <LibGUI/MenuBar.h> | ||||
| #include <LibGUI/MessageBox.h> | ||||
|  | @ -57,6 +56,7 @@ | |||
| #include <LibGUI/ToolBarContainer.h> | ||||
| #include <LibGUI/VimEditingEngine.h> | ||||
| #include <LibGfx/Font.h> | ||||
| #include <LibJS/SyntaxHighlighter.h> | ||||
| #include <LibMarkdown/Document.h> | ||||
| #include <LibWeb/OutOfProcessWebView.h> | ||||
| #include <string.h> | ||||
|  | @ -476,7 +476,7 @@ TextEditorWidget::TextEditorWidget() | |||
|     syntax_menu.add_action(*m_cpp_highlight); | ||||
| 
 | ||||
|     m_js_highlight = GUI::Action::create_checkable("JavaScript", [&](auto&) { | ||||
|         m_editor->set_syntax_highlighter(make<GUI::JSSyntaxHighlighter>()); | ||||
|         m_editor->set_syntax_highlighter(make<JS::SyntaxHighlighter>()); | ||||
|         m_editor->update(); | ||||
|     }); | ||||
|     syntax_actions.add_action(*m_js_highlight); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling