mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 14:12:52 +00:00
LanguageServers/Cpp: Add FileDB and pass project_root in Greet()
FileDB wraps the access to the contents of project files. When asked to fetch a file, FileDB will either return its in-memory model of the file if it has been "opened" by the language-server protocol, or otherwise fetch it from the filesystem. Previously, the cpp language server did not pledge "rpath" and got access to the contents of files whenever they were opened by the language client. However, features like inspection of header files require the language server to get the content of files that were not opened by the client. The language server now pledges rpath but makes sure to only unveil the project's directory and /usr/include.
This commit is contained in:
parent
bed3261723
commit
bed06b13f3
Notes:
sideshowbarker
2024-07-18 22:28:54 +09:00
Author: https://github.com/itamar8910
Commit: bed06b13f3
Pull-request: https://github.com/SerenityOS/serenity/pull/5244
Reviewed-by: https://github.com/alimpfard
8 changed files with 248 additions and 21 deletions
|
@ -62,6 +62,7 @@ void LanguageClient::remove_text(const String& path, size_t from_line, size_t fr
|
|||
|
||||
void LanguageClient::request_autocomplete(const String& path, size_t cursor_line, size_t cursor_column)
|
||||
{
|
||||
set_active_client();
|
||||
m_connection.post_message(Messages::LanguageServer::AutoCompleteSuggestions(path, cursor_line, cursor_column));
|
||||
}
|
||||
|
||||
|
@ -78,4 +79,9 @@ void LanguageClient::set_autocomplete_mode(const String& mode)
|
|||
m_connection.post_message(Messages::LanguageServer::SetAutoCompleteMode(mode));
|
||||
}
|
||||
|
||||
void LanguageClient::set_active_client()
|
||||
{
|
||||
m_connection.attach(*this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue