summaryrefslogtreecommitdiff
path: root/src/dged/syntax.c
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2024-05-22 00:00:29 +0200
committerAlbert Cervin <albert@acervin.com>2024-09-12 20:17:56 +0200
commit405da5f84b072ea97b69359454899f45d92d24b6 (patch)
tree20525b4bc44a5d8cbab4d62abe8413e174731db6 /src/dged/syntax.c
parent4ab7e453e26afc6e9f4938c65f89463fbba9e267 (diff)
downloaddged-405da5f84b072ea97b69359454899f45d92d24b6.tar.gz
dged-405da5f84b072ea97b69359454899f45d92d24b6.tar.xz
dged-405da5f84b072ea97b69359454899f45d92d24b6.zip
WIP LSP client
This contains the start of an LSP client. Nothing (except starting the LSP server) works at the moment and the feature is disabled by default.
Diffstat (limited to 'src/dged/syntax.c')
-rw-r--r--src/dged/syntax.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/dged/syntax.c b/src/dged/syntax.c
index 569dc70..67ab3a2 100644
--- a/src/dged/syntax.c
+++ b/src/dged/syntax.c
@@ -48,6 +48,8 @@ struct highlight {
};
static void delete_parser(struct buffer *buffer, void *userdata) {
+ (void)buffer;
+
struct highlight *highlight = (struct highlight *)userdata;
if (highlight->query != NULL) {
@@ -72,6 +74,7 @@ static void delete_parser(struct buffer *buffer, void *userdata) {
static const char *read_text(void *payload, uint32_t byte_offset,
TSPoint position, uint32_t *bytes_read) {
+ (void)byte_offset;
struct text *text = (struct text *)payload;
@@ -97,7 +100,7 @@ static const char *read_text(void *payload, uint32_t byte_offset,
static const char *grammar_name_from_buffer(struct buffer *buffer) {
struct setting *s = lang_setting(&buffer->lang, "grammar");
if (s != NULL && s->value.type == Setting_String) {
- return s->value.string_value;
+ return s->value.data.string_value;
}
return buffer->lang.name;
@@ -124,6 +127,10 @@ static const char *lang_folder(struct buffer *buffer, const char *path) {
static bool eval_eq(struct s8 capname, uint32_t argc, struct s8 argv[],
struct s8 value, void *data) {
+ (void)capname;
+ (void)argc;
+ (void)argv;
+
const struct s8 *cmp_to = (const struct s8 *)data;
if (data == NULL) {
return false;
@@ -143,6 +150,10 @@ static void cleanup_eq(void *data) {
static bool eval_match(struct s8 capname, uint32_t argc, struct s8 argv[],
struct s8 value, void *data) {
+ (void)capname;
+ (void)argc;
+ (void)argv;
+
regex_t *regex = (regex_t *)data;
if (regex == NULL) {
return false;
@@ -325,6 +336,8 @@ static void update_parser(struct buffer *buffer, void *userdata,
struct location origin, uint32_t width,
uint32_t height) {
+ (void)width;
+
struct highlight *h = (struct highlight *)userdata;
if (h->query == NULL) {
@@ -411,7 +424,7 @@ static void update_parser(struct buffer *buffer, void *userdata,
end.column > 0 ? end.column - 1 : 0,
(struct text_property){
.type = TextProperty_Colors,
- .colors =
+ .data.colors =
(struct text_property_colors){
.set_fg = true,
.fg = color,
@@ -509,8 +522,9 @@ static void text_inserted(struct buffer *buffer, struct edit_location inserted,
}
static void create_parser(struct buffer *buffer, void *userdata) {
+ (void)userdata;
- TSLanguage *(*langsym)() = NULL;
+ TSLanguage *(*langsym)(void) = NULL;
const char *lang_root = NULL, *langname = NULL;
void *h = NULL;
@@ -601,7 +615,7 @@ void syntax_init(uint32_t grammar_path_len, const char *grammar_path[]) {
lang_setting_set_default(
&l, "grammar",
(struct setting_value){.type = Setting_String,
- .string_value = "gitcommit"});
+ .data.string_value = "gitcommit"});
lang_destroy(&l);
}
@@ -609,14 +623,15 @@ void syntax_init(uint32_t grammar_path_len, const char *grammar_path[]) {
if (!lang_is_fundamental(&l)) {
lang_setting_set_default(
&l, "grammar",
- (struct setting_value){.type = Setting_String, .string_value = "cpp"});
+ (struct setting_value){.type = Setting_String,
+ .data.string_value = "cpp"});
lang_destroy(&l);
}
buffer_add_create_hook(create_parser, NULL);
}
-void syntax_teardown() {
+void syntax_teardown(void) {
for (uint32_t i = 0; i < treesitter_path_len; ++i) {
free((void *)treesitter_path[i]);
}