Documentation
¶
Index ¶
- Variables
- func ConfigureLSPServers(rootDir string) (map[string]ServerInfo, error)
- func DetectLanguages(rootDir string) (map[string]LanguageInfo, error)
- func GetLanguageIDFromExtension(ext string) string
- func GetLanguageIDFromPath(path string) string
- func GetLanguageIDFromProtocol(langKind string) string
- func IntegrateLSPServers(workingDir string) error
- type LanguageInfo
- type ProjectFile
- type ServerInfo
Constants ¶
This section is empty.
Variables ¶
var LanguageServerMap = map[string]ServerInfo{ "go": { Command: "gopls", InstallCmd: "go install golang.org/x/tools/gopls@latest", }, "typescript": { Command: "typescript-language-server", Args: []string{"--stdio"}, InstallCmd: "npm install -g typescript-language-server typescript", }, "javascript": { Command: "typescript-language-server", Args: []string{"--stdio"}, InstallCmd: "npm install -g typescript-language-server typescript", }, "python": { Command: "pylsp", InstallCmd: "pip install python-lsp-server", }, "rust": { Command: "rust-analyzer", InstallCmd: "rustup component add rust-analyzer", }, "java": { Command: "jdtls", InstallCmd: "Install Eclipse JDT Language Server", }, "c": { Command: "clangd", InstallCmd: "Install clangd from your package manager", }, "cpp": { Command: "clangd", InstallCmd: "Install clangd from your package manager", }, "php": { Command: "intelephense", Args: []string{"--stdio"}, InstallCmd: "npm install -g intelephense", }, "ruby": { Command: "solargraph", Args: []string{"stdio"}, InstallCmd: "gem install solargraph", }, "lua": { Command: "lua-language-server", InstallCmd: "Install lua-language-server from your package manager", }, "html": { Command: "vscode-html-language-server", Args: []string{"--stdio"}, InstallCmd: "npm install -g vscode-langservers-extracted", }, "css": { Command: "vscode-css-language-server", Args: []string{"--stdio"}, InstallCmd: "npm install -g vscode-langservers-extracted", }, "json": { Command: "vscode-json-language-server", Args: []string{"--stdio"}, InstallCmd: "npm install -g vscode-langservers-extracted", }, "yaml": { Command: "yaml-language-server", Args: []string{"--stdio"}, InstallCmd: "npm install -g yaml-language-server", }, }
LanguageServerMap maps language IDs to their corresponding LSP servers
Functions ¶
func ConfigureLSPServers ¶
func ConfigureLSPServers(rootDir string) (map[string]ServerInfo, error)
ConfigureLSPServers detects languages and configures LSP servers
func DetectLanguages ¶
func DetectLanguages(rootDir string) (map[string]LanguageInfo, error)
DetectLanguages scans a directory to identify programming languages used in the project
func GetLanguageIDFromExtension ¶
GetLanguageIDFromExtension returns the language ID for a given file extension
func GetLanguageIDFromPath ¶
GetLanguageIDFromPath determines the language ID from a file path
func GetLanguageIDFromProtocol ¶
GetLanguageIDFromProtocol converts a protocol.LanguageKind to our language ID string
func IntegrateLSPServers ¶
IntegrateLSPServers discovers languages and LSP servers and integrates them into the application configuration
Types ¶
type LanguageInfo ¶
type LanguageInfo struct {
// Language identifier (e.g., "go", "typescript", "python")
ID string
// Number of files detected for this language
FileCount int
// Project files associated with this language (e.g., go.mod, package.json)
ProjectFiles []string
// Whether this is likely a primary language in the project
IsPrimary bool
}
LanguageInfo stores information about a detected language
type ProjectFile ¶
type ProjectFile struct {
// File name or pattern to match
Name string
// Associated language ID
LanguageID string
// Whether this file strongly indicates the language is primary
IsPrimary bool
}
ProjectFile represents a project configuration file
type ServerInfo ¶
type ServerInfo struct {
// Command to run the server
Command string
// Arguments to pass to the command
Args []string
// Command to install the server (for user guidance)
InstallCmd string
// Whether this server is available
Available bool
// Full path to the executable (if found)
Path string
}
ServerInfo contains information about an LSP server
func FindLSPServer ¶
func FindLSPServer(languageID string) (ServerInfo, error)
FindLSPServer searches for an LSP server for the given language