Skip to content

Commit 0104e32

Browse files
committed
feat: added basic LSP
1 parent 20f8ec0 commit 0104e32

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

lsp/src/lsp.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
use std::{
2+
collections::{HashMap, HashSet},
3+
sync::{Arc, Mutex},
4+
};
5+
6+
use tower_lsp::{
7+
Client, LanguageServer,
8+
lsp_types::{
9+
CompletionOptions, HoverProviderCapability, InitializeParams, InitializeResult,
10+
InitializedParams, ServerCapabilities, ServerInfo, TextDocumentSyncCapability,
11+
TextDocumentSyncKind,
12+
},
13+
};
14+
15+
#[derive(Debug)]
16+
pub struct LSPBackend {
17+
lsp_client: Client,
18+
documents: Arc<Mutex<HashSet<String>>>,
19+
}
20+
21+
#[tower_lsp::async_trait]
22+
impl LanguageServer for LSPBackend {
23+
async fn initialize(
24+
&self,
25+
_: InitializeParams,
26+
) -> tower_lsp::jsonrpc::Result<InitializeResult> {
27+
Ok(InitializeResult {
28+
capabilities: ServerCapabilities {
29+
hover_provider: Some(HoverProviderCapability::Simple(true)),
30+
completion_provider: Some(CompletionOptions::default()),
31+
text_document_sync: Some(TextDocumentSyncCapability::Kind(
32+
TextDocumentSyncKind::FULL,
33+
)),
34+
..Default::default()
35+
},
36+
server_info: Some(ServerInfo {
37+
name: "quickfall-lsp".to_string(),
38+
version: Some("0.1".to_string()),
39+
}),
40+
})
41+
}
42+
43+
async fn shutdown(&self) -> tower_lsp::jsonrpc::Result<()> {
44+
Ok(())
45+
}
46+
}

lsp/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod lsp;
2+
3+
fn main() {}

0 commit comments

Comments
 (0)