some refactors.
This commit is contained in:
7
include/Clang/ParsedAST.h
Normal file
7
include/Clang/ParsedAST.h
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace clice {
|
||||
|
||||
class ParsedAST {
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
5
include/Clang/Preamble.h
Normal file
5
include/Clang/Preamble.h
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace {
|
||||
|
||||
class Preamble {};
|
||||
|
||||
} // namespace
|
||||
@@ -6,42 +6,42 @@ namespace clice {
|
||||
// allowed to extend these and announce the values they support in the
|
||||
// corresponding client capability.
|
||||
enum class SemanticTokenTypes {
|
||||
Namespace,
|
||||
Type,
|
||||
Class,
|
||||
Enum,
|
||||
Interface,
|
||||
Struct,
|
||||
TypeParameter,
|
||||
Parameter,
|
||||
Variable,
|
||||
Property,
|
||||
EnumMember,
|
||||
Event,
|
||||
Function,
|
||||
Method,
|
||||
Macro,
|
||||
Keyword,
|
||||
Modifier,
|
||||
Comment,
|
||||
String,
|
||||
Number,
|
||||
Regexp,
|
||||
Operator,
|
||||
Decorator // @since 3.17.0
|
||||
Namespace,
|
||||
Type,
|
||||
Class,
|
||||
Enum,
|
||||
Interface,
|
||||
Struct,
|
||||
TypeParameter,
|
||||
Parameter,
|
||||
Variable,
|
||||
Property,
|
||||
EnumMember,
|
||||
Event,
|
||||
Function,
|
||||
Method,
|
||||
Macro,
|
||||
Keyword,
|
||||
Modifier,
|
||||
Comment,
|
||||
String,
|
||||
Number,
|
||||
Regexp,
|
||||
Operator,
|
||||
Decorator // @since 3.17.0
|
||||
};
|
||||
|
||||
enum SemanticTokenModifiers {
|
||||
Declaration,
|
||||
Definition,
|
||||
Readonly,
|
||||
Static,
|
||||
Deprecated,
|
||||
Abstract,
|
||||
Async,
|
||||
Modification,
|
||||
Documentation,
|
||||
DefaultLibrary
|
||||
Declaration,
|
||||
Definition,
|
||||
Readonly,
|
||||
Static,
|
||||
Deprecated,
|
||||
Abstract,
|
||||
Async,
|
||||
Modification,
|
||||
Documentation,
|
||||
DefaultLibrary
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
} // namespace clice
|
||||
|
||||
@@ -1,45 +1,15 @@
|
||||
#include <uv.h>
|
||||
|
||||
namespace clice {
|
||||
|
||||
/// core class responsible for starting the server
|
||||
class Server {
|
||||
private:
|
||||
uv_loop_t *loop;
|
||||
uv_pipe_t stdin_pipe;
|
||||
|
||||
private:
|
||||
static void on_read(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
|
||||
if (nread > 0) {
|
||||
printf("Read: %s\n", buf->base);
|
||||
} else if (nread < 0) {
|
||||
if (nread != UV_EOF)
|
||||
fprintf(stderr, "Read error: %s\n", uv_err_name(nread));
|
||||
if (!uv_is_closing((uv_handle_t *)&pipe)) {
|
||||
uv_close((uv_handle_t *)&pipe, NULL);
|
||||
}
|
||||
}
|
||||
if (buf->base) {
|
||||
free(buf->base);
|
||||
}
|
||||
}
|
||||
|
||||
static void alloc_buffer(uv_handle_t *handle, size_t suggested_size,
|
||||
uv_buf_t *buf) {
|
||||
buf->base = (char *)malloc(suggested_size);
|
||||
buf->len = suggested_size;
|
||||
}
|
||||
static uv_loop_t* loop;
|
||||
static uv_pipe_t stdin_pipe;
|
||||
|
||||
public:
|
||||
Server() {
|
||||
loop = uv_default_loop();
|
||||
uv_pipe_init(loop, &stdin_pipe, 0);
|
||||
uv_pipe_open(&stdin_pipe, 0);
|
||||
uv_read_start((uv_stream_t *)&stdin_pipe, alloc_buffer, on_read);
|
||||
}
|
||||
|
||||
~Server() { uv_loop_close(loop); }
|
||||
|
||||
int run() { return uv_run(loop, UV_RUN_DEFAULT); }
|
||||
static int Initialize();
|
||||
static int Exit();
|
||||
};
|
||||
|
||||
} // namespace clice
|
||||
} // namespace clice
|
||||
|
||||
Reference in New Issue
Block a user