MCPcopy Create free account
hub / github.com/diillson/chatcli / ServerForFile

Function ServerForFile

cli/agent/lsp/servers.go:43–55  ·  view source on GitHub ↗

ServerForFile returns the server spec for a file based on its extension, applying any env override of the command.

(path string)

Source from the content-addressed store, hash-verified

41// ServerForFile returns the server spec for a file based on its extension,
42// applying any env override of the command.
43func ServerForFile(path string) (ServerSpec, bool) {
44 ext := strings.ToLower(filepath.Ext(path))
45 spec, ok := extensionServers[ext]
46 if !ok {
47 return ServerSpec{}, false
48 }
49 if spec.EnvKey != "" {
50 if override := strings.TrimSpace(os.Getenv(spec.EnvKey)); override != "" {
51 spec.Command = strings.Fields(override)
52 }
53 }
54 return spec, true
55}
56
57// SupportedExtensions lists the recognized file extensions (for help/UX).
58func SupportedExtensions() []string {

Callers 3

handleLSPCommandMethod · 0.92
AcquireMethod · 0.85
TestServerForFileFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestServerForFileFunction · 0.68