A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/lsp/init_opts.rs')
-rw-r--r--src/lsp/init_opts.rs72
1 files changed, 13 insertions, 59 deletions
diff --git a/src/lsp/init_opts.rs b/src/lsp/init_opts.rs
index 301d295..345e2a4 100644
--- a/src/lsp/init_opts.rs
+++ b/src/lsp/init_opts.rs
@@ -1,7 +1,16 @@
use Default::default;
use lsp_types::*;
use serde_json::json;
-pub fn get(workspace: WorkspaceFolder) -> InitializeParams {
+pub fn get(
+ workspace: WorkspaceFolder,
+ conf: &Option<serde_json::Value>,
+ is_ra: bool,
+) -> InitializeParams {
+ let sym = Some(if is_ra {
+ SymbolKind::ALL.to_vec()
+ } else {
+ (1..=26).map(SymbolKind).collect()
+ });
InitializeParams {
process_id: Some(std::process::id()),
@@ -13,7 +22,7 @@ pub fn get(workspace: WorkspaceFolder) -> InitializeParams {
workspace: Some(WorkspaceClientCapabilities {
symbol: Some(WorkspaceSymbolClientCapabilities {
symbol_kind: Some(SymbolKindCapability {
- value_set: Some(SymbolKind::ALL.to_vec()),
+ value_set: sym.clone(),
}),
tag_support: Some(TagSupport {
value_set: SymbolTag::ALL.to_vec(),
@@ -76,7 +85,7 @@ pub fn get(workspace: WorkspaceFolder) -> InitializeParams {
value_set: SymbolTag::ALL.to_vec(),
}),
symbol_kind: Some(SymbolKindCapability {
- value_set: Some(SymbolKind::ALL.to_vec()),
+ value_set: sym,
}),
hierarchical_document_symbol_support: Some(true),
..default()
@@ -302,65 +311,10 @@ pub fn get(workspace: WorkspaceFolder) -> InitializeParams {
name: "gracilaria".into(),
version: Some(env!("CARGO_PKG_VERSION").into()),
}),
- initialization_options: Some(ra_config()),
+ initialization_options: conf.clone(),
trace: None,
workspace_folders: Some(vec![workspace]),
..default()
}
}
-pub fn ra_config() -> serde_json::Value {
- json! {{
- "cargo": {
- "buildScripts": { "enable": true }
- },
- "procMacro": {
- "enable": true,
- "attributes": { "enable": true }
- },
- "hover": {
- "documentation": {
- "keywords": { "enable": false },
- },
- },
- "inlayHints": {
- "closureReturnTypeHints": { "enable": "with_block" },
- "closingBraceHints": { "minLines": 5 },
- "closureStyle": "rust_analyzer",
- "genericParameterHints": { "type": { "enable": true } },
- "rangeExclusiveHints": { "enable": true },
- "closureCaptureHints": { "enable": true },
- },
- "typing": { "triggerChars": ".=<>{(+" },
- "assist": { "preferSelf": true },
- "checkOnSave": true,
- "diagnostics": { "enable": true },
- "semanticHighlighting": {
- "punctuation": {
- "separate": {
- "macroBang": true
- },
- "specialization": { "enable": true },
- "enable": true
- }
- },
- "workspace": {
- "symbol": {
- "search": { "limit": 1024 }
- }
- },
- "showUnlinkedFileNotification": false,
- "completion": {
- "fullFunctionSignatures": { "enable": true, },
- "autoIter": { "enable": false, },
- "autoImport": { "enable": true, },
- "termSearch": { "enable": true, },
- "autoself": { "enable": true, },
- "privateEditable": { "enable": true },
- },
- "imports": {
- "granularity": "group",
- },
- }
- }
-}