mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base class
This commit is contained in:
		
							parent
							
								
									bed06b13f3
								
							
						
					
					
						commit
						02038a0ede
					
				
					 7 changed files with 126 additions and 97 deletions
				
			
		|  | @ -31,8 +31,19 @@ | |||
| 
 | ||||
| namespace LanguageServers::Cpp { | ||||
| 
 | ||||
| Vector<GUI::AutocompleteProvider::Entry> LexerAutoComplete::get_suggestions(const String& code, const GUI::TextPosition& autocomplete_position) | ||||
| LexerAutoComplete::LexerAutoComplete(const FileDB& filedb) | ||||
|     : AutoCompleteEngine(filedb) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| Vector<GUI::AutocompleteProvider::Entry> LexerAutoComplete::get_suggestions(const String& file, const GUI::TextPosition& autocomplete_position) | ||||
| { | ||||
|     auto document = filedb().get(file); | ||||
|     if (!document) { | ||||
|         dbgln("didn't find document for {}", file); | ||||
|         return {}; | ||||
|     } | ||||
|     auto code = document->text(); | ||||
|     auto lines = code.split('\n', true); | ||||
|     Cpp::Lexer lexer(code); | ||||
|     auto tokens = lexer.lex(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Itamar
						Itamar