1use crate::{
2 LSPAny, Location, OneOf, PartialResultParams, SymbolInformation, SymbolKind,
3 SymbolKindCapability, SymbolTag, TagSupport, Url, WorkDoneProgressParams,
4};
56use serde::{Deserialize, Serialize};
78#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
9#[serde(rename_all = "camelCase")]
10pub struct WorkspaceSymbolClientCapabilities {
11/// This capability supports dynamic registration.
12#[serde(skip_serializing_if = "Option::is_none")]
13pub dynamic_registration: Option<bool>,
1415/// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
16#[serde(skip_serializing_if = "Option::is_none")]
17pub symbol_kind: Option<SymbolKindCapability>,
1819/// The client supports tags on `SymbolInformation`.
20 /// Clients supporting tags have to handle unknown tags gracefully.
21 ///
22 /// @since 3.16.0
23#[serde(
24 default,
25 skip_serializing_if = "Option::is_none",
26 deserialize_with = "TagSupport::deserialize_compat"
27)]
28pub tag_support: Option<TagSupport<SymbolTag>>,
2930/// The client support partial workspace symbols. The client will send the
31 /// request `workspaceSymbol/resolve` to the server to resolve additional
32 /// properties.
33 ///
34 /// @since 3.17.0
35#[serde(skip_serializing_if = "Option::is_none")]
36pub resolve_support: Option<WorkspaceSymbolResolveSupportCapability>,
37}
3839/// The parameters of a Workspace Symbol Request.
40#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
41pub struct WorkspaceSymbolParams {
42#[serde(flatten)]
43pub partial_result_params: PartialResultParams,
4445#[serde(flatten)]
46pub work_done_progress_params: WorkDoneProgressParams,
4748/// A non-empty query string
49pub query: String,
50}
5152#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
53pub struct WorkspaceSymbolResolveSupportCapability {
54/// The properties that a client can resolve lazily. Usually
55 /// `location.range`
56pub properties: Vec<String>,
57}
5859/// A special workspace symbol that supports locations without a range
60///
61/// @since 3.17.0
62#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
63#[serde(rename_all = "camelCase")]
64pub struct WorkspaceSymbol {
65/// The name of this symbol.
66pub name: String,
6768/// The kind of this symbol.
69pub kind: SymbolKind,
7071/// Tags for this completion item.
72#[serde(skip_serializing_if = "Option::is_none")]
73pub tags: Option<Vec<SymbolTag>>,
7475/// The name of the symbol containing this symbol. This information is for
76 /// user interface purposes (e.g. to render a qualifier in the user interface
77 /// if necessary). It can't be used to re-infer a hierarchy for the document
78 /// symbols.
79#[serde(skip_serializing_if = "Option::is_none")]
80pub container_name: Option<String>,
8182/// The location of this symbol. Whether a server is allowed to
83 /// return a location without a range depends on the client
84 /// capability `workspace.symbol.resolveSupport`.
85 ///
86 /// See also `SymbolInformation.location`.
87pub location: OneOf<Location, WorkspaceLocation>,
8889/// A data entry field that is preserved on a workspace symbol between a
90 /// workspace symbol request and a workspace symbol resolve request.
91#[serde(skip_serializing_if = "Option::is_none")]
92pub data: Option<LSPAny>,
93}
9495#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
96pub struct WorkspaceLocation {
97pub uri: Url,
98}
99100#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum WorkspaceSymbolResponse {
103 Flat(Vec<SymbolInformation>),
104 Nested(Vec<WorkspaceSymbol>),
105}