From 2cc74bdc1e410a7f6c9d8472442f97e442d362e4 Mon Sep 17 00:00:00 2001 From: ykiko Date: Fri, 5 Jul 2024 23:32:40 +0800 Subject: [PATCH] some update. --- .clang-format | 2 +- include/LSP/Server.h | 7 ++++--- include/Support/JSON.h | 10 ++++++++++ src/Clang/ParsedAST.cpp | 2 +- src/LSP/Server.cpp | 2 +- src/main.cpp | 10 ++++++---- tests/Support/Reflection.cpp | 11 +++++++++++ 7 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 include/Support/JSON.h create mode 100644 tests/Support/Reflection.cpp diff --git a/.clang-format b/.clang-format index ae764419..9d8ba58e 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ # compatible with clang-format 18 UseTab: Never -ColumnLimit: 100 +ColumnLimit: 110 # Indent IndentWidth: 4 diff --git a/include/LSP/Server.h b/include/LSP/Server.h index f2d75463..bd01a09a 100644 --- a/include/LSP/Server.h +++ b/include/LSP/Server.h @@ -12,11 +12,12 @@ class Server { uv_pipe_t stdin_pipe; public: - int initialize(); + int start(); int exit(); - -public: void handle_message(std::string_view message); + + // LSP methods + void initialize(); }; } // namespace clice diff --git a/include/Support/JSON.h b/include/Support/JSON.h new file mode 100644 index 00000000..89c5596c --- /dev/null +++ b/include/Support/JSON.h @@ -0,0 +1,10 @@ +#include + +namespace clice { + +template +class JSON { + +private: +}; +} // namespace clice diff --git a/src/Clang/ParsedAST.cpp b/src/Clang/ParsedAST.cpp index 35f12bcc..7692ba5e 100644 --- a/src/Clang/ParsedAST.cpp +++ b/src/Clang/ParsedAST.cpp @@ -7,7 +7,7 @@ std::unique_ptr ParsedAST::build(std::string_view path, const std::shared_ptr& preamble) { auto AST = new ParsedAST(); AST->path = path; - + // some settings for CompilerInstance auto& instance = AST->instance; instance.setInvocation(invocation); diff --git a/src/LSP/Server.cpp b/src/LSP/Server.cpp index 99120633..6ae34396 100644 --- a/src/LSP/Server.cpp +++ b/src/LSP/Server.cpp @@ -6,7 +6,7 @@ namespace clice { Server server; -int Server::initialize() { +int Server::start() { loop = uv_default_loop(); // initialize pipe and bind to stdin diff --git a/src/main.cpp b/src/main.cpp index 95032324..4f887664 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,8 @@ #include #include -#include #include - +#include +#include uv_loop_t* loop = nullptr; struct Task { @@ -76,7 +76,9 @@ Task async_factorial(int n) { } int main() { - auto& server = clice::server; - server.initialize(); + clice::InitializeResult result; + clice::print(result); + // auto& server = clice::server; + // server.start(); return 0; } diff --git a/tests/Support/Reflection.cpp b/tests/Support/Reflection.cpp new file mode 100644 index 00000000..abac2557 --- /dev/null +++ b/tests/Support/Reflection.cpp @@ -0,0 +1,11 @@ +#include + +namespace { + +struct Point { + int x; + int y; +}; + +static_assert(clice::impl::member_count() == 2); +} // namespace