MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / lspSettings

Function lspSettings

src/settings/lspSettings.js:169–431  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

167 * @returns {object} Settings page interface
168 */
169export default function lspSettings() {
170 const title =
171 strings?.lsp_settings || strings["language servers"] || "Language Servers";
172 const categories = {
173 customServers: strings["settings-category-custom-servers"],
174 behavior: strings["settings-category-behavior"] || "Behavior",
175 servers: strings["settings-category-servers"],
176 };
177 let page = createPage();
178
179 return {
180 show(goTo) {
181 page = createPage();
182 page.show(goTo);
183 },
184 hide() {
185 page.hide();
186 },
187 search(key) {
188 page = createPage();
189 return page.search(key);
190 },
191 restoreList() {
192 page.restoreList();
193 },
194 setTitle(nextTitle) {
195 page.setTitle(nextTitle);
196 },
197 };
198
199 function createPage() {
200 const servers = serverRegistry.listServers();
201
202 const sortedServers = servers.sort((a, b) => {
203 const aEnabled = getServerOverride(a.id).enabled ?? a.enabled;
204 const bEnabled = getServerOverride(b.id).enabled ?? b.enabled;
205
206 if (aEnabled !== bEnabled) {
207 return bEnabled ? 1 : -1;
208 }
209 return a.label.localeCompare(b.label);
210 });
211
212 const items = [
213 {
214 key: "allow_non_terminal_workspace",
215 text: strings["lsp-allow-non-terminal-workspace"],
216 checkbox: appSettings.value.lsp?.allowNonTerminalWorkspace === true,
217 info: strings["settings-info-lsp-allow-non-terminal-workspace"],
218 category: categories.behavior,
219 },
220 {
221 key: "add_custom_server",
222 text: strings["lsp-add-custom-server"],
223 info: strings["settings-info-lsp-add-custom-server"],
224 category: categories.customServers,
225 index: 0,
226 chevron: true,

Callers

nothing calls this directly

Calls 1

createPageFunction · 0.85

Tested by

no test coverage detected