mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:42:44 +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. :^)
		
	
			
		
			
				
	
	
		
			42 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "../AutoCompleteResponse.h"
 | |
| #include "CodeComprehensionEngine.h"
 | |
| #include "FileDB.h"
 | |
| #include <AK/HashMap.h>
 | |
| #include <AK/LexicalPath.h>
 | |
| #include <LibIPC/ClientConnection.h>
 | |
| 
 | |
| #include <Userland/DevTools/HackStudio/LanguageServers/LanguageClientEndpoint.h>
 | |
| #include <Userland/DevTools/HackStudio/LanguageServers/LanguageServerEndpoint.h>
 | |
| 
 | |
| namespace LanguageServers {
 | |
| 
 | |
| class ClientConnection : public IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint> {
 | |
| public:
 | |
|     explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>);
 | |
|     ~ClientConnection() override;
 | |
| 
 | |
|     virtual void die() override;
 | |
| 
 | |
| protected:
 | |
|     virtual void greet(String const&) override;
 | |
|     virtual void file_opened(String const&, IPC::File const&) override;
 | |
|     virtual void file_edit_insert_text(String const&, String const&, i32, i32) override;
 | |
|     virtual void file_edit_remove_text(String const&, i32, i32, i32, i32) override;
 | |
|     virtual void set_file_content(String const&, String const&) override;
 | |
|     virtual void auto_complete_suggestions(GUI::AutocompleteProvider::ProjectLocation const&) override;
 | |
|     virtual void find_declaration(GUI::AutocompleteProvider::ProjectLocation const&) override;
 | |
|     virtual void get_parameters_hint(GUI::AutocompleteProvider::ProjectLocation const&) override;
 | |
| 
 | |
|     FileDB m_filedb;
 | |
|     OwnPtr<CodeComprehensionEngine> m_autocomplete_engine;
 | |
| };
 | |
| 
 | |
| }
 |