Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Fixed

- **LSP Workspace Symbols**: Fixed `lsp_workspace_symbols` return type to use
`Option<DocumentSymbolResult>` instead of `WorkspaceSymbolResult` for
consistency with other LSP tools

### New Features

- **Automatic Connection**: Added automatic connection feature with CLI support
Expand Down
14 changes: 3 additions & 11 deletions src/neovim/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub trait NeovimClientTrait: Sync {
&self,
client_name: &str,
query: &str,
) -> Result<WorkspaceSymbolResult, NeovimError>;
) -> Result<Option<DocumentSymbolResult>, NeovimError>;

/// Get references for a symbol at a specific position
async fn lsp_references(
Expand Down Expand Up @@ -1011,14 +1011,6 @@ pub enum DocumentSymbolResult {
Information(Vec<SymbolInformation>),
}

/// Result type for workspace symbols request
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct WorkspaceSymbolResult {
pub result: Option<DocumentSymbolResult>,
#[serde(flatten)]
pub unknowns: HashMap<String, serde_json::Value>,
}

/// Prepare rename response variants
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -1639,7 +1631,7 @@ where
&self,
client_name: &str,
query: &str,
) -> Result<WorkspaceSymbolResult, NeovimError> {
) -> Result<Option<DocumentSymbolResult>, NeovimError> {
let conn = self.connection.as_ref().ok_or_else(|| {
NeovimError::Connection("Not connected to any Neovim instance".to_string())
})?;
Expand All @@ -1662,7 +1654,7 @@ where
.await
{
Ok(result) => {
match serde_json::from_str::<NvimExecuteLuaResult<WorkspaceSymbolResult>>(
match serde_json::from_str::<NvimExecuteLuaResult<Option<DocumentSymbolResult>>>(
result.as_str().unwrap(),
) {
Ok(d) => d.into(),
Expand Down