-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
97 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
rustflags = ["--cfg", "tracing_unstable"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
pub use async_lsp::ServerSocket; | ||
use tokio::{ | ||
process::{Child, Command}, | ||
runtime::Runtime, | ||
}; | ||
use tracing::error; | ||
|
||
use crate::commands::shutdown; | ||
|
||
#[derive(Clone)] | ||
pub struct LSPClient { | ||
process: Child, | ||
pub socket: ServerSocket, | ||
} | ||
|
||
impl LSPClient { | ||
pub fn new(socket: ServerSocket) -> Self { | ||
Self { socket } | ||
pub fn new(process: Child, socket: ServerSocket) -> Self { | ||
Self { process, socket } | ||
} | ||
} | ||
|
||
impl Drop for LSPClient { | ||
fn drop(&mut self) { | ||
error!("we are dropping"); | ||
Runtime::new() | ||
.expect("Create tokio runtime") | ||
.block_on(shutdown(self.socket.clone())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
use async_lsp::{LanguageServer, ServerSocket}; | ||
use snafu::ResultExt; | ||
use tracing::{debug, info}; | ||
|
||
use crate::{Error, LspSnafu}; | ||
|
||
struct Stop; | ||
|
||
pub async fn shutdown(mut server: ServerSocket) -> Result<(), crate::Error> { | ||
info!("Language Server Protocol Client shutting down."); | ||
|
||
server.shutdown(()).await.context(LspSnafu); | ||
server.exit(()).context(LspSnafu); | ||
server.emit(Stop).context(LspSnafu); | ||
// TODO | ||
// mainloop_fut.await.unwrap(); | ||
|
||
debug!("Language Server Protocol Client shutdown complete."); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
use crate::LspSnafu; | ||
|
||
use async_lsp::{ | ||
lsp_types::{DidOpenTextDocumentParams, TextDocumentItem, Url}, | ||
lsp_types::{DidChangeTextDocumentParams, DidOpenTextDocumentParams, TextDocumentItem, Url}, | ||
LanguageServer, ServerSocket, | ||
}; | ||
use snafu::ResultExt; | ||
use std::path::PathBuf; | ||
|
||
pub async fn did_change() -> Result<ServerSocket, crate::Error> { | ||
pub async fn did_change(mut server: ServerSocket) -> Result<ServerSocket, crate::Error> { | ||
todo!() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
use kuiper_gui::start_gui; | ||
|
||
fn main() { | ||
pretty_env_logger::init(); | ||
tracing_subscriber::fmt::init(); | ||
// pretty_env_logger::init(); | ||
|
||
let _ = start_gui(); | ||
} |