Skip to content

Commit

Permalink
fix: include server info in initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
ribru17 committed Dec 2, 2024
1 parent 291c482 commit decffdd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ts_query_ls"
version = "1.2.4"
version = "1.4.1"
authors = ["Riley Bruins <[email protected]>"]
edition = "2021"
description = "An LSP implementation for Tree-sitter's query files"
Expand Down
14 changes: 10 additions & 4 deletions src/handlers/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{env::set_current_dir, path::PathBuf};

use log::{error, info};
use tower_lsp::jsonrpc::Result;
use tower_lsp::lsp_types::{InitializeParams, InitializeResult};
use tower_lsp::lsp_types::{InitializeParams, InitializeResult, ServerInfo};

use crate::{Backend, SERVER_CAPABILITIES};

Expand All @@ -17,15 +17,18 @@ pub async fn initialize(_backend: &Backend, params: InitializeParams) -> Result<

Ok(InitializeResult {
capabilities: SERVER_CAPABILITIES.clone(),
..Default::default()
server_info: Some(ServerInfo {
name: String::from("ts_query_ls"),
version: Some(env!("CARGO_PKG_VERSION").to_string()),
}),
})
}

#[cfg(test)]
mod test {
use pretty_assertions::assert_eq;
use rstest::rstest;
use tower_lsp::lsp_types::{request::Initialize, InitializeResult, Url};
use tower_lsp::lsp_types::{request::Initialize, InitializeResult, ServerInfo, Url};

use crate::{
test_helpers::helpers::{
Expand Down Expand Up @@ -65,7 +68,10 @@ mod test {
response,
lsp_response_to_jsonrpc_response::<Initialize>(InitializeResult {
capabilities: SERVER_CAPABILITIES.clone(),
..Default::default()
server_info: Some(ServerInfo {
name: String::from("ts_query_ls"),
version: Some(String::from("1.4.1")),
}),
})
);
assert_eq!(backend.document_map.len(), documents.len());
Expand Down

0 comments on commit decffdd

Please sign in to comment.