From cfdd687216799cb5b47f099f1e7cd5dd16b3bdd0 Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Thu, 3 Apr 2025 15:20:15 +0200 Subject: add initial lsp support --- internal/llm/prompt/coder.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'internal/llm/prompt/coder.go') diff --git a/internal/llm/prompt/coder.go b/internal/llm/prompt/coder.go index cd71bc005..27bb7e431 100644 --- a/internal/llm/prompt/coder.go +++ b/internal/llm/prompt/coder.go @@ -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 and tags. +Take necessary actions to fix the issues. +` +} + func boolToYesNo(b bool) string { if b { return "Yes" -- cgit v1.2.3