| 24 | #[tower_lsp::async_trait] |
| 25 | impl LanguageServer for Backend { |
| 26 | async fn initialize(&self, i: InitializeParams) -> Result<InitializeResult> { |
| 27 | let root = match i.root_uri { |
| 28 | Some(v) => v.to_file_path().unwrap_or(PathBuf::from("")), |
| 29 | None => PathBuf::from(""), |
| 30 | }; |
| 31 | self.manager.build(&root); |
| 32 | Ok(InitializeResult { |
| 33 | server_info: None, |
| 34 | offset_encoding: None, |
| 35 | capabilities: ServerCapabilities { |
| 36 | text_document_sync: Some(TextDocumentSyncCapability::Kind( |
| 37 | TextDocumentSyncKind::FULL, |
| 38 | )), |
| 39 | hover_provider: Some(HoverProviderCapability::Simple(true)), |
| 40 | ..ServerCapabilities::default() |
| 41 | }, |
| 42 | }) |
| 43 | } |
| 44 | |
| 45 | async fn initialized(&self, _: InitializedParams) { |
| 46 | log::info!("server initialized!"); |