add initial lsp support

This commit is contained in:
Kujtim Hoxha
2025-04-03 15:20:15 +02:00
parent afd9ad0560
commit cfdd687216
47 changed files with 13996 additions and 456 deletions

View File

@@ -67,7 +67,7 @@ Never commit changes unless the user explicitly asks you to.`
envInfo := getEnvironmentInfo()
return fmt.Sprintf("%s\n\n%s", basePrompt, envInfo)
return fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation())
}
func CoderAnthropicSystemPrompt() string {
@@ -168,7 +168,7 @@ You MUST answer concisely with fewer than 4 lines of text (not including tool us
envInfo := getEnvironmentInfo()
return fmt.Sprintf("%s\n\n%s", basePrompt, envInfo)
return fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation())
}
func getEnvironmentInfo() string {
@@ -198,6 +198,25 @@ func isGitRepo(dir string) bool {
return err == nil
}
func lspInformation() string {
cfg := config.Get()
hasLSP := false
for _, v := range cfg.LSP {
if !v.Disabled {
hasLSP = true
break
}
}
if !hasLSP {
return ""
}
return `# LSP Information
Tools that support it will also include useful diagnostics such as linting and typechecking.
These diagnostics will be automatically enabled when you run the tool, and will be displayed in the output at the bottom within the <file_diagnostics></file_diagnostics> and <project_diagnostics></project_diagnostics> tags.
Take necessary actions to fix the issues.
`
}
func boolToYesNo(b bool) string {
if b {
return "Yes"