|
3 | 3 | import shutil |
4 | 4 | from functools import partial |
5 | 5 | from subprocess import CalledProcessError |
6 | | -from typing import Any, Literal, override |
| 6 | +from typing import override |
7 | 7 |
|
8 | 8 | import anyio |
9 | | -from attrs import define, field |
| 9 | +from attrs import define |
10 | 10 | from loguru import logger |
11 | 11 |
|
12 | | -from lsp_client.capability.notification import ( |
13 | | - WithNotifyDidChangeConfiguration, |
14 | | -) |
| 12 | +from lsp_client.capability.notification import WithNotifyDidChangeConfiguration |
15 | 13 | from lsp_client.capability.request import ( |
16 | 14 | WithRequestCallHierarchy, |
17 | 15 | WithRequestCompletion, |
@@ -107,103 +105,13 @@ class GoplsClient( |
107 | 105 | - VSCode Extension: https://marketplace.visualstudio.com/items?itemName=golang.go |
108 | 106 | """ |
109 | 107 |
|
110 | | - all_experiments: bool = False |
111 | | - analyses: dict[str, bool | str] = field(factory=dict) |
112 | | - allow_modfile_mods: bool = False |
113 | | - allow_multi_line_string_literals: bool = False |
114 | | - allow_implicit_variable_assignments: bool = False |
115 | | - build_directory: str | None = None |
116 | | - codelenses: dict[str, bool] = field(factory=dict) |
117 | | - complete_completions: bool = False |
118 | | - complete_unimported: bool = False |
119 | | - completion_budget: str | None = None |
120 | | - diagnostics_delay: str | None = None |
121 | | - documentation_options: dict[str, bool] = field(factory=dict) |
122 | | - experimental_postfix_completions: bool = True |
123 | | - experimental_prefixed_format: bool = True |
124 | | - experimental_template_support: bool = False |
125 | | - experimental_workspace_module: bool = False |
126 | | - gofumpt: bool = False |
127 | | - hover_kind: Literal[ |
128 | | - "FullDocumentation", "NoDocumentation", "SingleLine", "Structured" |
129 | | - ] = "FullDocumentation" |
130 | | - link_in_hover: bool = True |
131 | | - link_target: str = "pkg.go.dev" |
132 | | - matcher: Literal["Fuzzy", "CaseInsensitive", "CaseSensitive"] = "Fuzzy" |
133 | | - semantic_tokens: bool = True |
134 | | - staticcheck: bool = False |
135 | | - use_placeholders: bool = False |
136 | | - verbose_output: bool = False |
137 | | - |
138 | 108 | @override |
139 | 109 | def create_default_servers(self) -> DefaultServers: |
140 | 110 | return DefaultServers( |
141 | 111 | local=GoplsLocalServer(), |
142 | 112 | container=GoplsContainerServer(), |
143 | 113 | ) |
144 | 114 |
|
145 | | - @override |
146 | | - def create_initialization_options(self) -> dict[str, Any]: |
147 | | - options: dict[str, Any] = {} |
148 | | - |
149 | | - if self.all_experiments: |
150 | | - options["allExperiments"] = self.all_experiments |
151 | | - |
152 | | - if self.analyses: |
153 | | - options["analyses"] = self.analyses |
154 | | - |
155 | | - if self.allow_modfile_mods: |
156 | | - options["allowModfileMods"] = self.allow_modfile_mods |
157 | | - |
158 | | - if self.allow_multi_line_string_literals: |
159 | | - options["allowMultiLineStringLiterals"] = ( |
160 | | - self.allow_multi_line_string_literals |
161 | | - ) |
162 | | - |
163 | | - if self.allow_implicit_variable_assignments: |
164 | | - options["allowImplicitVariableAssignments"] = ( |
165 | | - self.allow_implicit_variable_assignments |
166 | | - ) |
167 | | - |
168 | | - if self.build_directory: |
169 | | - options["buildDirectory"] = self.build_directory |
170 | | - |
171 | | - if self.codelenses: |
172 | | - options["codelenses"] = self.codelenses |
173 | | - |
174 | | - if self.complete_completions: |
175 | | - options["completeCompletions"] = self.complete_completions |
176 | | - |
177 | | - if self.complete_unimported: |
178 | | - options["completeUnimported"] = self.complete_unimported |
179 | | - |
180 | | - if self.completion_budget: |
181 | | - options["completionBudget"] = self.completion_budget |
182 | | - |
183 | | - if self.diagnostics_delay: |
184 | | - options["diagnosticsDelay"] = self.diagnostics_delay |
185 | | - |
186 | | - if self.documentation_options: |
187 | | - options["documentationOptions"] = self.documentation_options |
188 | | - |
189 | | - options["experimentalPostfixCompletions"] = ( |
190 | | - self.experimental_postfix_completions |
191 | | - ) |
192 | | - options["experimentalPrefixedFormat"] = self.experimental_prefixed_format |
193 | | - options["experimentalTemplateSupport"] = self.experimental_template_support |
194 | | - options["experimentalWorkspaceModule"] = self.experimental_workspace_module |
195 | | - options["gofumpt"] = self.gofumpt |
196 | | - options["hoverKind"] = self.hover_kind |
197 | | - options["linkInHover"] = self.link_in_hover |
198 | | - options["linkTarget"] = self.link_target |
199 | | - options["matcher"] = self.matcher |
200 | | - options["semanticTokens"] = self.semantic_tokens |
201 | | - options["staticcheck"] = self.staticcheck |
202 | | - options["usePlaceholders"] = self.use_placeholders |
203 | | - options["verboseOutput"] = self.verbose_output |
204 | | - |
205 | | - return options |
206 | | - |
207 | 115 | @override |
208 | 116 | def check_server_compatibility(self, info: lsp_type.ServerInfo | None) -> None: |
209 | 117 | return |
0 commit comments