Changesets · Branches · Tags · Compare
| Changeset | db9477902ab48976058995086ba61a7ce8330afefdabd152d0438248560f341c |
|---|---|
| Author | Jacob Kim <jacob@continue.dev> · 2025-07-07 19:20 -07:00 |
| Committer | Jacob Kim <jacob@continue.dev> · 2025-07-07 19:20 -07:00 |
| Parents | 84415195a78d |
2 files changed
modified core/autocomplete/context/static-context/StaticContextService.ts +26 −6
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import * as fs from "fs/promises"; |
| 2 | 2 | import path from "path"; |
| 3 | +import { pathToFileURL } from "url"; | |
| 3 | 4 | import Parser from "web-tree-sitter"; |
| 4 | 5 | import { IDE, Position } from "../../.."; |
| 5 | 6 | import { localPathOrUriToPath } from "../../../util/pathToUri"; |
| @@ -153,14 +154,33 @@ | ||
| 153 | 154 | |
| 154 | 155 | this.logAutocompleteStaticSnippet(ctx); |
| 155 | 156 | |
| 156 | - console.log(end - start); | |
| 157 | + // console.log(end - start); | |
| 157 | 158 | |
| 158 | - return [ | |
| 159 | - { | |
| 159 | + const snippets: AutocompleteStaticSnippet[] = []; | |
| 160 | + | |
| 161 | + snippets.push({ | |
| 162 | + type: AutocompleteSnippetType.Static, | |
| 163 | + filepath: pathToFileURL(path.resolve(holeContext.source)).toString(), | |
| 164 | + content: holeContext.fullHoverResult, | |
| 165 | + }); | |
| 166 | + | |
| 167 | + for (const [filepath, typs] of ctx.relevantTypes.entries()) { | |
| 168 | + snippets.push({ | |
| 169 | + type: AutocompleteSnippetType.Static, | |
| 170 | + filepath: pathToFileURL(path.resolve(filepath)).toString(), | |
| 171 | + content: typs.join("\n"), | |
| 172 | + }); | |
| 173 | + } | |
| 174 | + | |
| 175 | + for (const [filepath, headers] of ctx.relevantHeaders.entries()) { | |
| 176 | + snippets.push({ | |
| 160 | 177 | type: AutocompleteSnippetType.Static, |
| 161 | - content: StaticContextService.formatAutocompleteStaticSnippet(ctx), | |
| 162 | - }, | |
| 163 | - ]; | |
| 178 | + filepath: pathToFileURL(path.resolve(filepath)).toString(), | |
| 179 | + content: headers.join("\n"), | |
| 180 | + }); | |
| 181 | + } | |
| 182 | + | |
| 183 | + return snippets; | |
| 164 | 184 | } |
| 165 | 185 | |
| 166 | 186 | private async getHoleContext( |
modified core/autocomplete/snippets/types.ts +1 −0
| @@ -26,6 +26,7 @@ | ||
| 26 | 26 | |
| 27 | 27 | export interface AutocompleteStaticSnippet extends BaseAutocompleteSnippet { |
| 28 | 28 | type: AutocompleteSnippetType.Static; |
| 29 | + filepath: string; | |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | export type AutocompleteSnippet = |