Random Stuff

This commit is contained in:
2025-10-03 12:40:47 +01:00
parent a1bddc70dc
commit 508a2f502d
10 changed files with 236 additions and 107 deletions

View File

@@ -159,7 +159,6 @@ cJSON *make_folder_init_request(int id, const char *root_uri) {
cJSON *params = cJSON_CreateObject();
cJSON_AddStringToObject(params, "rootUri", root_uri);
// capabilities
cJSON *capabilities = cJSON_CreateObject();
cJSON *textDocument = cJSON_CreateObject();
cJSON *diagnosticProvider = cJSON_CreateObject();
@@ -297,8 +296,8 @@ void print_wrapped(const char *text) {
}
int main() {
char *argv[] = {"clangd", NULL};
start_lsp("clangd", argv);
char *argv[] = {"ruby-lsp", NULL};
start_lsp("ruby-lsp", argv);
cJSON *init =
make_folder_init_request(1, "file:///home/syed/main/cubit/tests/");
lsp_send(init);
@@ -306,10 +305,10 @@ int main() {
cJSON *initialized = make_initialized_request();
lsp_send(initialized);
cJSON_Delete(initialized);
char *text = read_file("/home/syed/main/cubit/tests/test.c");
char *text = read_file("/home/syed/main/cubit/tests/test.rb");
printf("%s\n", text);
cJSON *req = make_open_file_request(
"file:///home/syed/main/cubit/tests/test.c", "c", text, 1);
"file:///home/syed/main/cubit/tests/test.rb", "ruby", text, 1);
lsp_send(req);
cJSON_Delete(req);
free(text);
@@ -328,7 +327,7 @@ int main() {
break;
if (key == 'f') {
cJSON *req = make_fold_request(
next_id++, "file:///home/syed/main/cubit/tests/test.c");
next_id++, "file:///home/syed/main/cubit/tests/test.rb");
lsp_send(req);
cJSON_Delete(req);
}
@@ -340,13 +339,13 @@ int main() {
}
if (key == 'h') {
cJSON *req = make_hover_request(
next_id++, "file:///home/syed/main/cubit/tests/test.c");
next_id++, "file:///home/syed/main/cubit/tests/test.rb");
lsp_send(req);
cJSON_Delete(req);
}
if (key == 'c') {
cJSON *req = make_change_file_request(
next_id++, "file:///home/syed/main/cubit/tests/test.c");
next_id++, "file:///home/syed/main/cubit/tests/test.rb");
lsp_send(req);
cJSON_Delete(req);
}

View File

@@ -16,6 +16,7 @@ bool_f = false
nil_val = nil
# --- Strings and symbols
s1 = "double-quoted string with escape\nand interpolation: #{int_lit}"
s2 = 'single-quoted string with \\n literal'
@@ -382,15 +383,6 @@ hex = 0xff
oct = 0o755
bin = 0b101010
# --- Case with guards
val = 10
case val
when Integer if val.even?
case_guard = :even_int
else
case_guard = :other
end
# --- Ternary, safe nav, assignment forms
tern = val > 5 ? :big : :small
safe_len = nil&.to_s&.length

BIN
tests/tls

Binary file not shown.