First completion level is working (LSP connected)
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#define _BSD_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "include/utils.h"
|
||||
|
||||
#include "include/buffer.h"
|
||||
#include "include/split_screen.h"
|
||||
#include <string.h>
|
||||
@@ -19,18 +21,36 @@
|
||||
#include "include/input.h"
|
||||
#include "include/editor_op.h"
|
||||
#include "include/terminal.h"
|
||||
#include "include/completion.h"
|
||||
#include <signal.h>
|
||||
|
||||
#include "include/utils.h"
|
||||
|
||||
struct editorConfig E;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
char * splash_screen = (char *) calloc(256, sizeof(char));
|
||||
char * splash_screen = bAlloc(sizeof(char) * 512);
|
||||
|
||||
signal(SIGPIPE, SIG_IGN); // don't die on broken pipe, just get EPIPE from write()
|
||||
|
||||
enableRawMode();
|
||||
initEditor();
|
||||
if (argc >= 2) {
|
||||
EditorPane *active = splitScreenGetActivePane();
|
||||
active->buffer_id = bufferCreate(argv[1], READ_AND_WRITE);
|
||||
|
||||
char project_root[512];
|
||||
realpath(argv[1], project_root);
|
||||
char *slash = strrchr(project_root, '/');
|
||||
if (slash) *slash = '\0';
|
||||
|
||||
appDebug("peoject root : %s\n", project_root);
|
||||
|
||||
lspStart(E.lsp_client, project_root);
|
||||
struct buffer_t *buf = &E.buffers[active->buffer_id];
|
||||
lspDidOpen(E.lsp_client, buf);
|
||||
|
||||
} else {
|
||||
strcat(splash_screen, getenv("HOME"));
|
||||
strcat(splash_screen, "/.beluga/assets/beluga.txt");
|
||||
@@ -38,11 +58,16 @@ int main(int argc, char *argv[]) {
|
||||
appDebug("splash : %s\n", splash_screen);
|
||||
EditorPane *active = splitScreenGetActivePane();
|
||||
active->buffer_id = bufferCreate(splash_screen, READ_ONLY);
|
||||
struct buffer_t *buf = &E.buffers[active->buffer_id];
|
||||
lspStart(E.lsp_client, splash_screen);
|
||||
lspDidOpen(E.lsp_client, buf);
|
||||
|
||||
}
|
||||
free(splash_screen);
|
||||
|
||||
editorSetStatusMessage("HELP: Ctrl-x Ctrl-s = save | Ctrl-x Ctrl-c = quit");
|
||||
|
||||
appDebug("allocation : %d\n", beluga_alloc_counter);
|
||||
|
||||
while (1) {
|
||||
editorRefreshScreen();
|
||||
|
||||
Reference in New Issue
Block a user