(
server: LspServerDefinition,
uri: string | null | undefined,
file?: { uri?: string } | null,
)
| 78 | } |
| 79 | |
| 80 | function isSettingsOrKeybindingsFile( |
| 81 | server: LspServerDefinition, |
| 82 | uri: string | null | undefined, |
| 83 | file?: { uri?: string } | null, |
| 84 | ): boolean { |
| 85 | if (server.id !== "json") return false; |
| 86 | |
| 87 | const fileUri = String(uri || file?.uri || "").toLowerCase(); |
| 88 | if (!fileUri) return false; |
| 89 | |
| 90 | // 1. Check if it matches the exact Acode paths from window globals |
| 91 | try { |
| 92 | const dataStorage = (globalThis as any).DATA_STORAGE; |
| 93 | if (dataStorage) { |
| 94 | const settingsPath = Url.join(dataStorage, "settings.json").toLowerCase(); |
| 95 | const keybindingsPath = ( |
| 96 | (globalThis as any).KEYBINDING_FILE || |
| 97 | Url.join(dataStorage, ".key-bindings.json") |
| 98 | ).toLowerCase(); |
| 99 | |
| 100 | if (fileUri === settingsPath || fileUri === keybindingsPath) { |
| 101 | return true; |
| 102 | } |
| 103 | } |
| 104 | } catch {} |
| 105 | |
| 106 | // 2. Check if it matches generic/relative names as a robust fallback |
| 107 | return ( |
| 108 | fileUri.endsWith("/settings.json") || |
| 109 | fileUri.endsWith("/.key-bindings.json") || |
| 110 | fileUri.endsWith("/keybindings.json") || |
| 111 | fileUri.endsWith("/.keybindings.json") || |
| 112 | fileUri === "settings.json" || |
| 113 | fileUri === ".key-bindings.json" || |
| 114 | fileUri === "keybindings.json" || |
| 115 | fileUri === ".keybindings.json" |
| 116 | ); |
| 117 | } |
| 118 | |
| 119 | function isVerboseLspLoggingEnabled(): boolean { |
| 120 | const buildInfo = (globalThis as { BuildInfo?: { debug?: boolean } }) |
no test coverage detected