lsp server test
This commit is contained in:
@@ -9,3 +9,6 @@ edition = "2021"
|
|||||||
regex = "1.10.4"
|
regex = "1.10.4"
|
||||||
once_cell = "1.19.0"
|
once_cell = "1.19.0"
|
||||||
clap = { version = "4.0", features = ["derive"] }
|
clap = { version = "4.0", features = ["derive"] }
|
||||||
|
lspower = "1.5.0"
|
||||||
|
tokio = { version = "1.38.0", features = ["full"] }
|
||||||
|
tokio-macros = "2.3.0"
|
||||||
+14
-4
@@ -2,27 +2,35 @@ mod transpiler;
|
|||||||
mod parser;
|
mod parser;
|
||||||
mod lexer;
|
mod lexer;
|
||||||
mod compile;
|
mod compile;
|
||||||
|
mod lsp;
|
||||||
use std::{fs, path::Path};
|
use std::{fs, path::Path};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use lexer::LexerState;
|
use lexer::LexerState;
|
||||||
use transpiler::Options;
|
use transpiler::Options;
|
||||||
|
|
||||||
|
use crate::lsp::run_lsp_server;
|
||||||
|
|
||||||
// Arguments for Wyst (short and long version)
|
// Arguments for Wyst (short and long version)
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
struct Args {
|
struct Args {
|
||||||
#[clap()]
|
|
||||||
file: std::path::PathBuf,
|
|
||||||
|
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
rust: Option<String>,
|
rust: Option<String>,
|
||||||
|
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
compile: Option<String>,
|
compile: Option<String>,
|
||||||
|
|
||||||
|
#[clap(long)]
|
||||||
|
stdio: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = Args::parse();
|
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");
|
.expect("Error reading file");
|
||||||
if Path::new("build").exists() {
|
if Path::new("build").exists() {
|
||||||
fs::remove_dir_all("build").expect("err rm build");
|
fs::remove_dir_all("build").expect("err rm build");
|
||||||
@@ -56,3 +64,5 @@ fn main() {
|
|||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user