mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -20,7 +20,7 @@ private:
|
|||
: LanguageServers::ConnectionFromClient(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) {
|
||||
m_autocomplete_engine->set_declarations_of_document_callback = [this](String const& 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) {
|
||||
|
|
|
@ -14,12 +14,12 @@ namespace LanguageServers::Shell {
|
|||
|
||||
RefPtr<::Shell::Shell> ShellComprehensionEngine::s_shell {};
|
||||
|
||||
ShellComprehensionEngine::ShellComprehensionEngine(const FileDB& filedb)
|
||||
ShellComprehensionEngine::ShellComprehensionEngine(FileDB const& filedb)
|
||||
: CodeComprehensionEngine(filedb, true)
|
||||
{
|
||||
}
|
||||
|
||||
const ShellComprehensionEngine::DocumentData& ShellComprehensionEngine::get_or_create_document_data(const String& file)
|
||||
ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_or_create_document_data(String const& file)
|
||||
{
|
||||
auto absolute_path = filedb().to_absolute_path(file);
|
||||
if (!m_documents.contains(absolute_path)) {
|
||||
|
@ -28,7 +28,7 @@ const ShellComprehensionEngine::DocumentData& ShellComprehensionEngine::get_or_c
|
|||
return get_document_data(absolute_path);
|
||||
}
|
||||
|
||||
const ShellComprehensionEngine::DocumentData& ShellComprehensionEngine::get_document_data(const String& file) const
|
||||
ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_document_data(String const& file) const
|
||||
{
|
||||
auto absolute_path = filedb().to_absolute_path(file);
|
||||
auto document_data = m_documents.get(absolute_path);
|
||||
|
@ -36,7 +36,7 @@ const ShellComprehensionEngine::DocumentData& ShellComprehensionEngine::get_docu
|
|||
return *document_data.value();
|
||||
}
|
||||
|
||||
OwnPtr<ShellComprehensionEngine::DocumentData> ShellComprehensionEngine::create_document_data_for(const String& file)
|
||||
OwnPtr<ShellComprehensionEngine::DocumentData> ShellComprehensionEngine::create_document_data_for(String const& file)
|
||||
{
|
||||
auto document = filedb().get(file);
|
||||
if (!document)
|
||||
|
@ -50,7 +50,7 @@ OwnPtr<ShellComprehensionEngine::DocumentData> ShellComprehensionEngine::create_
|
|||
return document_data;
|
||||
}
|
||||
|
||||
void ShellComprehensionEngine::set_document_data(const String& file, OwnPtr<DocumentData>&& data)
|
||||
void ShellComprehensionEngine::set_document_data(String const& file, OwnPtr<DocumentData>&& data)
|
||||
{
|
||||
m_documents.set(filedb().to_absolute_path(file), move(data));
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ ShellComprehensionEngine::DocumentData::DocumentData(String&& _text, String _fil
|
|||
{
|
||||
}
|
||||
|
||||
const Vector<String>& ShellComprehensionEngine::DocumentData::sourced_paths() const
|
||||
Vector<String> const& ShellComprehensionEngine::DocumentData::sourced_paths() const
|
||||
{
|
||||
if (all_sourced_paths.has_value())
|
||||
return all_sourced_paths.value();
|
||||
|
@ -110,7 +110,7 @@ NonnullRefPtr<::Shell::AST::Node> ShellComprehensionEngine::DocumentData::parse(
|
|||
return ::Shell::AST::make_ref_counted<::Shell::AST::SyntaxError>(::Shell::AST::Position {}, "Unable to parse file");
|
||||
}
|
||||
|
||||
size_t ShellComprehensionEngine::resolve(const ShellComprehensionEngine::DocumentData& document, const GUI::TextPosition& position)
|
||||
size_t ShellComprehensionEngine::resolve(ShellComprehensionEngine::DocumentData const& document, const GUI::TextPosition& position)
|
||||
{
|
||||
size_t offset = 0;
|
||||
|
||||
|
@ -133,11 +133,11 @@ size_t ShellComprehensionEngine::resolve(const ShellComprehensionEngine::Documen
|
|||
return offset;
|
||||
}
|
||||
|
||||
Vector<GUI::AutocompleteProvider::Entry> ShellComprehensionEngine::get_suggestions(const String& file, const GUI::TextPosition& position)
|
||||
Vector<GUI::AutocompleteProvider::Entry> ShellComprehensionEngine::get_suggestions(String const& file, const GUI::TextPosition& position)
|
||||
{
|
||||
dbgln_if(SH_LANGUAGE_SERVER_DEBUG, "ShellComprehensionEngine position {}:{}", position.line(), position.column());
|
||||
|
||||
const auto& document = get_or_create_document_data(file);
|
||||
auto const& document = get_or_create_document_data(file);
|
||||
size_t offset_in_file = resolve(document, position);
|
||||
|
||||
::Shell::AST::HitTestResult hit_test = document.node->hit_test_position(offset_in_file);
|
||||
|
@ -154,20 +154,20 @@ Vector<GUI::AutocompleteProvider::Entry> ShellComprehensionEngine::get_suggestio
|
|||
return entries;
|
||||
}
|
||||
|
||||
void ShellComprehensionEngine::on_edit(const String& file)
|
||||
void ShellComprehensionEngine::on_edit(String const& file)
|
||||
{
|
||||
set_document_data(file, create_document_data_for(file));
|
||||
}
|
||||
|
||||
void ShellComprehensionEngine::file_opened([[maybe_unused]] const String& file)
|
||||
void ShellComprehensionEngine::file_opened([[maybe_unused]] String const& file)
|
||||
{
|
||||
set_document_data(file, create_document_data_for(file));
|
||||
}
|
||||
|
||||
Optional<GUI::AutocompleteProvider::ProjectLocation> ShellComprehensionEngine::find_declaration_of(const String& filename, const GUI::TextPosition& identifier_position)
|
||||
Optional<GUI::AutocompleteProvider::ProjectLocation> ShellComprehensionEngine::find_declaration_of(String const& filename, const GUI::TextPosition& identifier_position)
|
||||
{
|
||||
dbgln_if(SH_LANGUAGE_SERVER_DEBUG, "find_declaration_of({}, {}:{})", filename, identifier_position.line(), identifier_position.column());
|
||||
const auto& document = get_or_create_document_data(filename);
|
||||
auto const& document = get_or_create_document_data(filename);
|
||||
auto position = resolve(document, identifier_position);
|
||||
auto result = document.node->hit_test_position(position);
|
||||
if (!result.matching_node) {
|
||||
|
@ -192,10 +192,10 @@ Optional<GUI::AutocompleteProvider::ProjectLocation> ShellComprehensionEngine::f
|
|||
return {};
|
||||
}
|
||||
|
||||
void ShellComprehensionEngine::update_declared_symbols(const DocumentData& document)
|
||||
void ShellComprehensionEngine::update_declared_symbols(DocumentData const& document)
|
||||
{
|
||||
struct Visitor : public ::Shell::AST::NodeVisitor {
|
||||
explicit Visitor(const String& filename)
|
||||
explicit Visitor(String const& filename)
|
||||
: filename(filename)
|
||||
{
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ void ShellComprehensionEngine::update_declared_symbols(const DocumentData& docum
|
|||
declarations.append({ node->name().name, { filename, node->position().start_line.line_number, node->position().start_line.line_column }, GUI::AutocompleteProvider::DeclarationType::Function, {} });
|
||||
}
|
||||
|
||||
const String& filename;
|
||||
String const& filename;
|
||||
Vector<GUI::AutocompleteProvider::Declaration> declarations;
|
||||
} visitor { document.filename };
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@ namespace LanguageServers::Shell {
|
|||
|
||||
class ShellComprehensionEngine : public CodeComprehensionEngine {
|
||||
public:
|
||||
ShellComprehensionEngine(const FileDB& filedb);
|
||||
virtual Vector<GUI::AutocompleteProvider::Entry> get_suggestions(const String& file, const GUI::TextPosition& position) override;
|
||||
virtual void on_edit(const String& file) override;
|
||||
virtual void file_opened([[maybe_unused]] const String& file) override;
|
||||
virtual Optional<GUI::AutocompleteProvider::ProjectLocation> find_declaration_of(const String& filename, const GUI::TextPosition& identifier_position) override;
|
||||
ShellComprehensionEngine(FileDB const& filedb);
|
||||
virtual Vector<GUI::AutocompleteProvider::Entry> get_suggestions(String const& file, const GUI::TextPosition& position) override;
|
||||
virtual void on_edit(String const& file) override;
|
||||
virtual void file_opened([[maybe_unused]] String const& file) override;
|
||||
virtual Optional<GUI::AutocompleteProvider::ProjectLocation> find_declaration_of(String const& filename, const GUI::TextPosition& identifier_position) override;
|
||||
|
||||
private:
|
||||
struct DocumentData {
|
||||
|
@ -26,7 +26,7 @@ private:
|
|||
String text;
|
||||
NonnullRefPtr<::Shell::AST::Node> node;
|
||||
|
||||
const Vector<String>& sourced_paths() const;
|
||||
Vector<String> const& sourced_paths() const;
|
||||
|
||||
private:
|
||||
NonnullRefPtr<::Shell::AST::Node> parse() const;
|
||||
|
@ -34,15 +34,15 @@ private:
|
|||
mutable Optional<Vector<String>> all_sourced_paths {};
|
||||
};
|
||||
|
||||
const DocumentData& get_document_data(const String& file) const;
|
||||
const DocumentData& get_or_create_document_data(const String& file);
|
||||
void set_document_data(const String& file, OwnPtr<DocumentData>&& data);
|
||||
DocumentData const& get_document_data(String const& file) const;
|
||||
DocumentData const& get_or_create_document_data(String const& file);
|
||||
void set_document_data(String const& file, OwnPtr<DocumentData>&& data);
|
||||
|
||||
OwnPtr<DocumentData> create_document_data_for(const String& file);
|
||||
OwnPtr<DocumentData> create_document_data_for(String const& file);
|
||||
String document_path_from_include_path(StringView include_path) const;
|
||||
void update_declared_symbols(const DocumentData&);
|
||||
void update_declared_symbols(DocumentData const&);
|
||||
|
||||
static size_t resolve(const ShellComprehensionEngine::DocumentData& document, const GUI::TextPosition& position);
|
||||
static size_t resolve(ShellComprehensionEngine::DocumentData const& document, const GUI::TextPosition& position);
|
||||
|
||||
::Shell::Shell& shell()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue