lsp server test

This commit is contained in:
2024-06-03 13:23:20 +02:00
parent 5fafd054b1
commit e048e0e10c
2 changed files with 47 additions and 34 deletions
+3
View File
@@ -9,3 +9,6 @@ edition = "2021"
regex = "1.10.4"
once_cell = "1.19.0"
clap = { version = "4.0", features = ["derive"] }
lspower = "1.5.0"
tokio = { version = "1.38.0", features = ["full"] }
tokio-macros = "2.3.0"
+14 -4
View File
@@ -2,27 +2,35 @@ mod transpiler;
mod parser;
mod lexer;
mod compile;
mod lsp;
use std::{fs, path::Path};
use clap::Parser;
use lexer::LexerState;
use transpiler::Options;
use crate::lsp::run_lsp_server;
// Arguments for Wyst (short and long version)
#[derive(Parser)]
struct Args {
#[clap()]
file: std::path::PathBuf,
#[clap(short, long)]
rust: Option<String>,
#[clap(short, long)]
compile: Option<String>,
#[clap(long)]
stdio: bool,
}
fn main() {
let args = Args::parse();
let file_content = fs::read_to_string(&args.file)
match args.stdio {
true => {
run_lsp_server();
},
false => {
let file_content = fs::read_to_string("main.wt")
.expect("Error reading file");
if Path::new("build").exists() {
fs::remove_dir_all("build").expect("err rm build");
@@ -55,4 +63,6 @@ fn main() {
}
None => {}
}
}
}
}