diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-24 23:21:43 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-24 23:21:43 +0300 |
| commit | c3c71345db9086392cd9b7529c7f5287009c226e (patch) | |
| tree | d227894ab900d6050cbe1418984526088a692db5 /internal/lsp/context.go | |
| parent | 127844a4ee481590ef53b6777d34bf2114cb3ab1 (diff) | |
Add runtime config store and reload command
Diffstat (limited to 'internal/lsp/context.go')
| -rw-r--r-- | internal/lsp/context.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/lsp/context.go b/internal/lsp/context.go index 5a4983c..8b584fb 100644 --- a/internal/lsp/context.go +++ b/internal/lsp/context.go @@ -14,7 +14,7 @@ import ( // - file-on-new-func: include full file only when defining a new function // - always-full: always include the full file func (s *Server) buildAdditionalContext(newFunc bool, uri string, pos Position) (string, bool) { - mode := s.contextMode + mode := s.contextMode() switch mode { case "minimal": return "", false @@ -40,7 +40,7 @@ func (s *Server) windowContext(uri string, pos Position) string { return "" } n := len(d.lines) - half := s.windowLines / 2 + half := s.windowLines() / 2 start := pos.Line - half if start < 0 { start = 0 @@ -50,7 +50,7 @@ func (s *Server) windowContext(uri string, pos Position) string { end = n } text := strings.Join(d.lines[start:end], "\n") - return truncateToApproxTokens(text, s.maxContextTokens) + return truncateToApproxTokens(text, s.maxContextTokens()) } func (s *Server) fullFileContext(uri string) string { @@ -59,7 +59,7 @@ func (s *Server) fullFileContext(uri string) string { logging.Logf("lsp ", "context: full-file requested but document not open; skipping uri=%s", uri) return "" } - return truncateToApproxTokens(d.text, s.maxContextTokens) + return truncateToApproxTokens(d.text, s.maxContextTokens()) } // truncateToApproxTokens naively truncates the input to fit approx N tokens. |
