diff options
Diffstat (limited to 'internal/lsp/document_test.go')
| -rw-r--r-- | internal/lsp/document_test.go | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/internal/lsp/document_test.go b/internal/lsp/document_test.go index 00e4548..c8b6e2e 100644 --- a/internal/lsp/document_test.go +++ b/internal/lsp/document_test.go @@ -9,15 +9,32 @@ import ( ) func newTestServer() *Server { - s := &Server{ - logger: log.New(io.Discard, "", 0), - docs: make(map[string]*document), - inlineOpen: ">", - inlineClose: ">", - chatSuffix: ">", - chatPrefixes: []string{"?", "!", ":", ";"}, - } - // Keep package-level helpers in sync for tests using free functions + s := &Server{ + logger: log.New(io.Discard, "", 0), + docs: make(map[string]*document), + inlineOpen: ">", + inlineClose: ">", + chatSuffix: ">", + chatPrefixes: []string{"?", "!", ":", ";"}, + } + // Default prompt templates (mirror app defaults) + s.promptCompSysParams = "You are a code completion engine for function signatures. Return only the parameter list contents (without parentheses), no braces, no prose. Prefer idiomatic names and types." + s.promptCompUserParams = "Cursor is inside the function parameter list. Suggest only the parameter list (no parentheses).\nFunction line: {{function}}\nCurrent line (cursor at {{char}}): {{current}}" + s.promptCompSysGeneral = "You are a terse code completion engine. Return only the code to insert, no surrounding prose or backticks. Only continue from the cursor; never repeat characters already present to the left of the cursor on the current line (e.g., if 'name :=' is already typed, only return the right-hand side expression)." + s.promptCompUserGeneral = "Provide the next likely code to insert at the cursor.\nFile: {{file}}\nFunction/context: {{function}}\nAbove line: {{above}}\nCurrent line (cursor at character {{char}}): {{current}}\nBelow line: {{below}}\nOnly return the completion snippet." + s.promptCompSysInline = "You are a precise code completion/refactoring engine. Output only the code to insert with no prose, no comments, and no backticks. Return raw code only." + s.promptCompExtraHeader = "Additional context:\n{{context}}" + s.promptNativeCompletion = "// Path: {{path}}\n{{before}}" + s.promptChatSystem = "You are a helpful coding assistant. Answer concisely and clearly." + s.promptRewriteSystem = "You are a precise code refactoring engine. Rewrite the given code strictly according to the instruction. Return only the updated code with no prose or backticks. Preserve formatting where reasonable." + s.promptDiagnosticsSystem = "You are a precise code fixer. Resolve the given diagnostics by editing only the selected code. Return only the corrected code with no prose or backticks. Keep behavior and style, and avoid unrelated changes." + s.promptDocumentSystem = "You are a precise code documentation engine. Add idiomatic documentation comments to the given code. Preserve exact behavior and formatting as much as possible. Return only the updated code with comments, no prose or backticks." + s.promptRewriteUser = "Instruction: {{instruction}}\n\nSelected code to transform:\n{{selection}}" + s.promptDiagnosticsUser = "Diagnostics to resolve (selection only):\n{{diagnostics}}\n\nSelected code:\n{{selection}}" + s.promptDocumentUser = "Add documentation comments to this code:\n{{selection}}" + s.promptGoTestSystem = "You are a precise Go unit test generator. Given a Go function, write one or more Test* functions using the testing package. Do NOT include package or imports, only the test function(s). Prefer table-driven tests. Keep it minimal and idiomatic." + s.promptGoTestUser = "Function under test:\n{{function}}" + // Keep package-level helpers in sync for tests using free functions inlineOpenChar = '>' inlineCloseChar = '>' chatSuffixChar = '>' |
