mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:32:43 +00:00 
			
		
		
		
	 971b3645ef
			
		
	
	
		971b3645ef
		
	
	
	
	
		
			
			This is an encapsulation of the common work done by all of our
single-client IPC servers on startup:
    1. Create a Core::LocalSocket, taking over an accepted fd.
    2. Create an application-specific ClientConnection object,
       wrapping the socket.
It's not a huge change in terms of lines saved, but I do feel that it
improves expressiveness. :^)
		
	
			
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "ShellComprehensionEngine.h"
 | |
| #include <DevTools/HackStudio/LanguageServers/ClientConnection.h>
 | |
| #include <LibCpp/Parser.h>
 | |
| 
 | |
| namespace LanguageServers::Shell {
 | |
| 
 | |
| class ClientConnection final : public LanguageServers::ClientConnection {
 | |
|     C_OBJECT(ClientConnection);
 | |
| 
 | |
| private:
 | |
|     ClientConnection(NonnullRefPtr<Core::LocalSocket> socket)
 | |
|         : LanguageServers::ClientConnection(move(socket))
 | |
|     {
 | |
|         m_autocomplete_engine = make<ShellComprehensionEngine>(m_filedb);
 | |
|         m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
 | |
|             async_declarations_in_document(filename, move(declarations));
 | |
|         };
 | |
|         m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector<Cpp::Parser::TodoEntry>&& todo_entries) {
 | |
|             async_todo_entries_in_document(filename, move(todo_entries));
 | |
|         };
 | |
|     }
 | |
|     virtual ~ClientConnection() override = default;
 | |
| };
 | |
| }
 |