Bennet Bo Fenner
72318df4b5
lsp: Add support for textDocument/documentSymbol (#27488)
This PR adds support for retrieving the outline of a specific
buffer/document from the LSP.
E.g. for this code (`crates/cli/src/cli.rs`):
```rs
use collections::HashMap;
pub use ipc_channel::ipc;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct IpcHandshake {
pub requests: ipc::IpcSender<CliRequest>,
pub responses: ipc::IpcReceiver<CliResponse>,
}
#[derive(Debug, Serialize, Deserialize)]
pub enum CliRequest {
Open {
paths: Vec<String>,
urls: Vec<String>,
wait: bool,
open_new_workspace: Option<bool>,
env: Option<HashMap<String, String>>,
},
}
#[derive(Debug, Serialize, Deserialize)]
pub enum CliResponse {
Ping,
Stdout { message: String },
Stderr { message: String },
Exit { status: i32 },
}
/// When Zed started not as an *.app but as a binary (e.g. local development),
/// there's a possibility to tell it to behave "regularly".
pub const FORCE_CLI_MODE_ENV_VAR_NAME: &str = "ZED_FORCE_CLI_MODE";
```
Rust-analyzer responds with:
```
Symbol: 'IpcHandshake' - Struct - (4:0-8:1) (5:11-5:23)
Symbol: 'requests' - Field - (6:4-6:44) (6:8-6:16)
Symbol: 'responses' - Field - (7:4-7:48) (7:8-7:17)
Symbol: 'CliRequest' - Enum - (10:0-19:1) (11:9-11:19)
Symbol: 'Open' - EnumMember - (12:4-18:5) (12:4-12:8)
Symbol: 'paths' - Field - (13:8-13:26) (13:8-13:13)
Symbol: 'urls' - Field - (14:8-14:25) (14:8-14:12)
Symbol: 'wait' - Field - (15:8-15:18) (15:8-15:12)
Symbol: 'open_new_workspace' - Field - (16:8-16:40) (16:8-16:26)
Symbol: 'env' - Field - (17:8-17:44) (17:8-17:11)
Symbol: 'CliResponse' - Enum - (21:0-27:1) (22:9-22:20)
Symbol: 'Ping' - EnumMember - (23:4-23:8) (23:4-23:8)
Symbol: 'Stdout' - EnumMember - (24:4-24:30) (24:4-24:10)
Symbol: 'message' - Field - (24:13-24:28) (24:13-24:20)
Symbol: 'Stderr' - EnumMember - (25:4-25:30) (25:4-25:10)
Symbol: 'message' - Field - (25:13-25:28) (25:13-25:20)
Symbol: 'Exit' - EnumMember - (26:4-26:24) (26:4-26:8)
Symbol: 'status' - Field - (26:11-26:22) (26:11-26:17)
Symbol: 'FORCE_CLI_MODE_ENV_VAR_NAME' - Constant - (29:0-31:67) (31:10-31:37)
```
We'll use this to reference specific symbols in assistant2
Release Notes:
- N/A
2025-03-26 11:38:22 +00:00
..
2025-03-19 02:09:02 +00:00
2025-03-21 12:29:07 +00:00
2025-03-21 10:04:39 -06:00
2025-03-24 21:00:33 -03:00
2025-03-25 20:52:44 -04:00
2025-03-25 17:08:36 +00:00
2025-03-21 16:39:01 +00:00
2025-03-25 20:52:44 -04:00
2025-03-10 13:38:30 -06:00
2025-03-19 02:09:02 +00:00
2025-03-25 18:37:15 +00:00
2025-03-26 08:20:09 -03:00
2025-03-19 02:09:02 +00:00
2025-03-19 02:09:02 +00:00
2025-02-24 20:28:20 +00:00
2025-02-25 13:52:42 -05:00
2025-03-03 09:20:15 +00:00
2025-03-24 19:25:56 +00:00
2025-03-21 00:10:17 -04:00
2025-03-19 02:09:02 +00:00
2025-03-22 02:56:25 +00:00
2025-03-19 02:09:02 +00:00
2025-03-26 11:38:22 +00:00
2025-03-25 04:35:01 +05:30
2025-03-19 02:09:02 +00:00
2025-02-11 04:55:40 +00:00
2025-03-07 18:56:17 +00:00
2025-03-19 02:09:02 +00:00
2025-03-25 18:37:15 +00:00
2025-03-25 10:56:27 +01:00
2025-02-20 19:07:16 +00:00
2025-03-19 02:09:02 +00:00
2025-03-25 00:21:09 +00:00
2025-02-18 20:30:33 +00:00
2025-03-19 02:09:02 +00:00
2025-03-26 07:13:12 +00:00
2025-03-19 02:09:02 +00:00
2025-03-25 09:22:01 -03:00
2025-03-26 10:28:32 +00:00
2025-03-19 02:09:02 +00:00
2025-03-25 18:23:59 +05:30
2025-03-25 18:23:59 +05:30
2025-03-03 15:55:15 +00:00
2025-03-25 18:23:59 +05:30
2025-03-22 18:38:01 +05:30
2025-03-19 12:20:26 +00:00
2025-03-22 02:56:25 +00:00
2025-03-25 19:34:26 +00:00
2025-02-15 00:35:13 +00:00
2025-03-24 19:25:56 +00:00
2025-01-30 23:53:36 -07:00
2025-03-10 13:38:30 -06:00
2025-03-26 15:46:04 +08:00
2025-03-17 15:39:52 +00:00
2025-03-25 07:05:25 +00:00
2025-03-19 02:09:02 +00:00
2025-03-26 00:12:10 +00:00
2025-03-26 05:23:27 +00:00
2025-03-14 13:40:02 -03:00
2025-01-31 02:00:55 +00:00
2025-03-17 02:36:37 +00:00
2025-03-17 02:36:37 +00:00
2025-03-26 08:20:09 -03:00
2025-03-19 02:09:02 +00:00
2025-02-10 22:28:56 -03:00
2025-03-24 20:45:06 -07:00
2025-03-19 02:09:02 +00:00
2025-03-25 15:13:53 +02:00
2025-03-25 18:23:59 +05:30
2025-03-26 00:12:10 +00:00
2025-03-20 10:22:49 -03:00
2025-03-25 10:56:27 +01:00
2025-03-19 02:09:02 +00:00
2025-03-21 09:15:41 +02:00
2025-03-25 22:08:16 +01:00
2025-02-19 23:32:51 +00:00
2025-03-19 02:09:02 +00:00
2025-03-19 02:09:02 +00:00
2025-01-31 22:28:11 +00:00
2025-03-26 11:38:22 +00:00
2025-03-25 11:11:04 -06:00
2025-03-26 04:14:23 +05:30
2025-03-03 17:44:49 +05:30
2025-03-25 04:35:01 +05:30
2025-02-14 13:07:41 -05:00
2025-03-24 16:12:26 -06:00
2025-03-06 12:50:42 +01:00
2025-03-19 02:09:02 +00:00
2025-02-19 11:06:20 -05:00
2025-03-14 07:19:43 +00:00
2025-03-25 19:34:26 +00:00
2025-03-18 18:18:56 +00:00
2025-03-20 13:06:10 +00:00
2025-03-19 02:09:02 +00:00
2025-03-19 02:09:02 +00:00
2025-03-26 11:38:22 +00:00
2025-03-25 16:43:40 -05:00
2025-03-22 19:23:11 +00:00
2025-03-19 02:09:02 +00:00
2025-03-20 08:30:04 +00:00
2025-03-26 11:38:22 +00:00
2025-03-19 02:09:02 +00:00
2025-02-05 14:30:09 +00:00
2025-02-27 08:00:42 +00:00
2025-03-19 02:09:02 +00:00
2025-03-22 19:23:11 +00:00
2025-03-19 02:09:02 +00:00
2025-03-19 02:09:02 +00:00
2025-03-10 13:38:30 -06:00
2025-03-06 08:36:10 -06:00
2025-03-18 17:59:58 +00:00
2025-03-06 04:59:57 +00:00
2025-03-19 02:09:02 +00:00
2025-03-19 02:09:02 +00:00
2025-03-19 02:09:02 +00:00
2025-03-20 13:06:10 +00:00
2025-02-21 06:24:02 -03:00
2025-03-19 02:09:02 +00:00
2025-03-19 02:09:02 +00:00
2025-03-26 02:06:08 -04:00
2025-02-05 14:30:09 +00:00
2025-03-06 17:57:31 +00:00
2025-03-19 02:09:02 +00:00
2025-03-13 10:41:04 -07:00
2025-03-19 02:09:02 +00:00
2025-03-10 11:39:01 -04:00
2025-03-24 22:31:11 -07:00
2025-03-19 02:09:02 +00:00
2025-03-06 10:56:28 -07:00
2025-03-18 20:39:54 +00:00
2025-03-24 22:31:11 -07:00
2025-03-25 19:34:26 +00:00
2025-03-19 15:33:08 +01:00
2025-03-19 18:48:35 +00:00
2025-02-18 17:47:25 +00:00
2025-03-19 17:26:46 +00:00
2025-02-12 15:57:08 -07:00
2025-03-25 17:57:42 -03:00
2025-03-19 02:09:02 +00:00
2025-03-25 19:34:26 +00:00
2025-03-06 20:37:54 +00:00
2025-03-18 22:27:09 -06:00
2025-03-25 12:32:20 -04:00
2025-03-15 14:16:10 +08:00
2025-03-22 19:23:11 +00:00
2025-03-19 17:26:46 +00:00
2025-03-26 02:06:08 -04:00
2025-03-25 16:43:40 -05:00
2025-03-26 10:28:32 +00:00
2025-03-24 21:00:33 -03:00
2025-03-25 11:11:04 -06:00
2025-03-25 03:05:32 +00:00
2025-03-21 20:08:03 +00:00