|
44 | 44 | from lsp_client.server import DefaultServers, ServerInstallationError |
45 | 45 | from lsp_client.server.container import ContainerServer |
46 | 46 | from lsp_client.server.local import LocalServer |
| 47 | +from lsp_client.utils.config import ConfigurationMap |
47 | 48 | from lsp_client.utils.types import lsp_type |
48 | 49 |
|
49 | 50 | RustAnalyzerContainerServer = partial( |
@@ -120,3 +121,54 @@ def create_default_servers(self) -> DefaultServers: |
120 | 121 | @override |
121 | 122 | def check_server_compatibility(self, info: lsp_type.ServerInfo | None) -> None: |
122 | 123 | return |
| 124 | + |
| 125 | + @override |
| 126 | + def create_default_configuration_map(self) -> ConfigurationMap | None: |
| 127 | + """Create default configuration for rust-analyzer with all features enabled.""" |
| 128 | + config_map = ConfigurationMap() |
| 129 | + config_map.update_global( |
| 130 | + { |
| 131 | + "rust-analyzer": { |
| 132 | + # Enable inlay hints for all types |
| 133 | + "inlayHints": { |
| 134 | + "enable": True, |
| 135 | + "chainingHints": {"enable": True}, |
| 136 | + "closureReturnTypeHints": {"enable": "always"}, |
| 137 | + "lifetimeElisionHints": {"enable": "always"}, |
| 138 | + "parameterHints": {"enable": True}, |
| 139 | + "reborrowHints": {"enable": "always"}, |
| 140 | + "renderColons": True, |
| 141 | + "typeHints": {"enable": True}, |
| 142 | + }, |
| 143 | + # Enable diagnostics |
| 144 | + "diagnostics": { |
| 145 | + "enable": True, |
| 146 | + "experimental": {"enable": True}, |
| 147 | + }, |
| 148 | + # Enable completion features |
| 149 | + "completion": { |
| 150 | + "autoimport": {"enable": True}, |
| 151 | + "autoself": {"enable": True}, |
| 152 | + "callable": {"snippets": "fill_arguments"}, |
| 153 | + "postfix": {"enable": True}, |
| 154 | + "privateEditable": {"enable": True}, |
| 155 | + }, |
| 156 | + # Enable checkOnSave with cargo check |
| 157 | + "checkOnSave": {"enable": True}, |
| 158 | + # Enable code lens |
| 159 | + "lens": { |
| 160 | + "enable": True, |
| 161 | + "run": {"enable": True}, |
| 162 | + "debug": {"enable": True}, |
| 163 | + "implementations": {"enable": True}, |
| 164 | + "references": { |
| 165 | + "adt": {"enable": True}, |
| 166 | + "enumVariant": {"enable": True}, |
| 167 | + "method": {"enable": True}, |
| 168 | + "trait": {"enable": True}, |
| 169 | + }, |
| 170 | + }, |
| 171 | + } |
| 172 | + } |
| 173 | + ) |
| 174 | + return config_map |
0 commit comments