diff --git a/crates/ark/src/lsp/config.rs b/crates/ark/src/lsp/config.rs
index 79b8ee886..1a269be6c 100644
--- a/crates/ark/src/lsp/config.rs
+++ b/crates/ark/src/lsp/config.rs
@@ -62,6 +62,14 @@ pub static SETTINGS: &[Setting] = &[
.unwrap_or_else(|| SymbolsConfig::default().include_assignments_in_blocks)
},
},
+ Setting {
+ key: "positron.r.workspaceSymbols.includeCommentSections",
+ set: |cfg, v| {
+ cfg.workspace_symbols.include_comment_sections = v
+ .as_bool()
+ .unwrap_or_else(|| WorkspaceSymbolsConfig::default().include_comment_sections)
+ },
+ },
];
/// Configuration of the LSP
@@ -69,6 +77,7 @@ pub static SETTINGS: &[Setting] = &[
pub(crate) struct LspConfig {
pub(crate) diagnostics: DiagnosticsConfig,
pub(crate) symbols: SymbolsConfig,
+ pub(crate) workspace_symbols: WorkspaceSymbolsConfig,
pub(crate) document: DocumentConfig,
}
@@ -78,6 +87,12 @@ pub struct SymbolsConfig {
pub include_assignments_in_blocks: bool,
}
+#[derive(Serialize, Deserialize, Clone, Debug)]
+pub struct WorkspaceSymbolsConfig {
+ /// Whether to include sections like `# My section ---` in workspace symbols.
+ pub include_comment_sections: bool,
+}
+
/// Configuration of a document.
///
/// The naming follows where possible.
@@ -141,6 +156,14 @@ impl Default for SymbolsConfig {
}
}
+impl Default for WorkspaceSymbolsConfig {
+ fn default() -> Self {
+ Self {
+ include_comment_sections: false,
+ }
+ }
+}
+
impl Default for IndentationConfig {
fn default() -> Self {
Self {
diff --git a/crates/ark/src/lsp/handlers.rs b/crates/ark/src/lsp/handlers.rs
index c111cfb82..cc468c5ec 100644
--- a/crates/ark/src/lsp/handlers.rs
+++ b/crates/ark/src/lsp/handlers.rs
@@ -124,8 +124,9 @@ pub(crate) async fn handle_initialized(
#[tracing::instrument(level = "info", skip_all)]
pub(crate) fn handle_symbol(
params: WorkspaceSymbolParams,
+ state: &WorldState,
) -> anyhow::Result