MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getPluginLspServers

Function getPluginLspServers

src/utils/plugins/lspPluginIntegration.ts:322–358  ·  view source on GitHub ↗
(
  plugin: LoadedPlugin,
  errors: PluginError[] = [],
)

Source from the content-addressed store, hash-verified

320 * the proper environment variables and scope applied
321 */
322export async function getPluginLspServers(
323 plugin: LoadedPlugin,
324 errors: PluginError[] = [],
325): Promise<Record<string, ScopedLspServerConfig> | undefined> {
326 if (!plugin.enabled) {
327 return undefined
328 }
329
330 // Use cached servers if available
331 const servers =
332 plugin.lspServers || (await loadPluginLspServers(plugin, errors))
333 if (!servers) {
334 return undefined
335 }
336
337 // Resolve environment variables. Top-level manifest.userConfig values
338 // become available as ${user_config.KEY} in LSP command/args/env.
339 // Gate on manifest.userConfig — same rationale as buildMcpUserConfig:
340 // loadPluginOptions always returns {} so without this guard userConfig is
341 // truthy for every plugin and substituteUserConfigVariables throws on any
342 // unresolved ${user_config.X}. Also skips unneeded keychain reads.
343 const userConfig = plugin.manifest.userConfig
344 ? loadPluginOptions(getPluginStorageId(plugin))
345 : undefined
346 const resolvedServers: Record<string, LspServerConfig> = {}
347 for (const [name, config] of Object.entries(servers)) {
348 resolvedServers[name] = resolvePluginLspEnvironment(
349 config,
350 plugin,
351 userConfig,
352 errors,
353 )
354 }
355
356 // Add plugin scope
357 return addPluginScopeToLspServers(resolvedServers, plugin.name)
358}
359
360/**
361 * Extract all LSP servers from loaded plugins

Callers 1

getAllLspServersFunction · 0.85

Calls 5

loadPluginLspServersFunction · 0.85
getPluginStorageIdFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected