返回 DeepSeek-Reasonix
lsp_specs.go
根目录 / internal / boot / lsp_specs.go
1 package boot
2
3 import (
4 "reasonix/internal/config"
5 "reasonix/internal/lsp"
6 )
7
8 // LSPSpecs returns the language → server map: the built-in defaults overlaid
9 // with user overrides. Empty fields keep the language default. An explicit
10 // command replaces the built-in command family, including fallback names.
11 func LSPSpecs(cfg config.LSPConfig) map[string]lsp.ServerSpec {
12 specs := lsp.DefaultSpecs()
13 for lang, s := range cfg.Servers {
14 spec := specs[lang]
15 if s.Command != "" {
16 spec.Command = s.Command
17 spec.Fallbacks = nil
18 }
19 if s.Args != nil {
20 spec.Args = s.Args
21 }
22 if s.Env != nil {
23 spec.Env = s.Env
24 }
25 if s.LanguageID != "" {
26 spec.LanguageID = s.LanguageID
27 }
28 if s.Extensions != nil {
29 spec.Extensions = s.Extensions
30 }
31 if s.InstallHint != "" {
32 spec.InstallHint = s.InstallHint
33 }
34 if spec.LanguageID == "" {
35 spec.LanguageID = lang
36 }
37 specs[lang] = spec
38 }
39 return specs
40 }
41
41 lines GO