diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-03 15:20:15 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-03 17:23:41 +0200 |
| commit | cfdd687216799cb5b47f099f1e7cd5dd16b3bdd0 (patch) | |
| tree | a822bfde1463a7080c0ea06dd17796d7a1617d3d /internal/llm/prompt/coder.go | |
| parent | afd9ad0560d76c2a6d161dad52553b10ff428905 (diff) | |
| download | opencode-cfdd687216799cb5b47f099f1e7cd5dd16b3bdd0.tar.gz opencode-cfdd687216799cb5b47f099f1e7cd5dd16b3bdd0.zip | |
add initial lsp support
Diffstat (limited to 'internal/llm/prompt/coder.go')
| -rw-r--r-- | internal/llm/prompt/coder.go | 23 |
1 files changed, 21 insertions, 2 deletions
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 <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" |
