Changesets · Branches · Tags · Compare
| Changeset | fac44fafd88d432a597d2415eaa7a08c7e7539fd74ecd56804c4e0c463d08e08 |
|---|---|
| Author | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-07 11:23 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-07 11:23 -07:00 |
| Parents | fa19d07829f1, a68de2065882 |
5 files changed
modified core/codeRenderer/CodeRenderer.ts +122 −15
| @@ -8,8 +8,19 @@ | ||
| 8 | 8 | * we rarely ever need syntax highlighting outside of |
| 9 | 9 | * creating a render of it. |
| 10 | 10 | */ |
| 11 | +import { | |
| 12 | + transformerMetaHighlight, | |
| 13 | + transformerNotationDiff, | |
| 14 | + transformerNotationFocus, | |
| 15 | + transformerNotationHighlight, | |
| 16 | +} from "@shikijs/transformers"; | |
| 11 | 17 | import { JSDOM } from "jsdom"; |
| 12 | -import { BundledTheme, codeToHtml, getSingletonHighlighter } from "shiki"; | |
| 18 | +import { | |
| 19 | + BundledLanguage, | |
| 20 | + BundledTheme, | |
| 21 | + getSingletonHighlighter, | |
| 22 | + Highlighter, | |
| 23 | +} from "shiki"; | |
| 13 | 24 | import { escapeForSVG, kebabOfStr } from "../util/text"; |
| 14 | 25 | |
| 15 | 26 | interface CodeRendererOptions { |
| @@ -42,6 +53,8 @@ | ||
| 42 | 53 | private currentTheme: string = "dark-plus"; |
| 43 | 54 | private editorBackground: string = "#000000"; |
| 44 | 55 | private editorForeground: string = "#FFFFFF"; |
| 56 | + private editorLineHighlight: string = "#000000"; | |
| 57 | + private highlighter: Highlighter | null = null; | |
| 45 | 58 | |
| 46 | 59 | private constructor() {} |
| 47 | 60 | |
| @@ -62,13 +75,17 @@ | ||
| 62 | 75 | ? "dark-plus" |
| 63 | 76 | : kebabOfStr(themeName); |
| 64 | 77 | |
| 65 | - const highlighter = await getSingletonHighlighter({ | |
| 78 | + this.highlighter = await getSingletonHighlighter({ | |
| 79 | + langs: ["typescript"], | |
| 66 | 80 | themes: [this.currentTheme], |
| 67 | 81 | }); |
| 68 | 82 | |
| 69 | - const th = highlighter.getTheme(this.currentTheme); | |
| 83 | + const th = this.highlighter.getTheme(this.currentTheme); | |
| 84 | + | |
| 70 | 85 | this.editorBackground = th.bg; |
| 71 | 86 | this.editorForeground = th.fg; |
| 87 | + this.editorLineHighlight = | |
| 88 | + th.colors!["editor.lineHighlightBackground"] ?? "#000000"; | |
| 72 | 89 | } else { |
| 73 | 90 | this.currentTheme = "dark-plus"; |
| 74 | 91 | } |
| @@ -148,10 +165,29 @@ | ||
| 148 | 165 | async highlightCode( |
| 149 | 166 | code: string, |
| 150 | 167 | language: string = "javascript", |
| 168 | + currLineOffsetFromTop: number, | |
| 151 | 169 | ): Promise<string> { |
| 152 | - return await codeToHtml(code, { | |
| 170 | + const annotatedCode = code | |
| 171 | + .split("\n") | |
| 172 | + .map((line, i) => | |
| 173 | + i === currLineOffsetFromTop | |
| 174 | + ? line + " \/\/ \[\!code highlight\]" | |
| 175 | + : line, | |
| 176 | + ) | |
| 177 | + .join("\n"); | |
| 178 | + | |
| 179 | + await this.highlighter!.loadLanguage(language as BundledLanguage); | |
| 180 | + | |
| 181 | + return this.highlighter!.codeToHtml(annotatedCode, { | |
| 153 | 182 | lang: language, |
| 154 | 183 | theme: this.currentTheme, |
| 184 | + transformers: [ | |
| 185 | + // transformerColorizedBrackets(), | |
| 186 | + transformerMetaHighlight(), | |
| 187 | + transformerNotationHighlight(), | |
| 188 | + transformerNotationDiff(), | |
| 189 | + transformerNotationFocus(), | |
| 190 | + ], | |
| 155 | 191 | }); |
| 156 | 192 | } |
| 157 | 193 | |
| @@ -163,23 +199,40 @@ | ||
| 163 | 199 | dimensions: Dimensions, |
| 164 | 200 | lineHeight: number, |
| 165 | 201 | options: ConversionOptions, |
| 202 | + currLineOffsetFromTop: number, | |
| 166 | 203 | ): Promise<Buffer> { |
| 167 | - const highlightedCodeHtml = await this.highlightCode(code, language); | |
| 204 | + const strokeWidth = 1; | |
| 205 | + const highlightedCodeHtml = await this.highlightCode( | |
| 206 | + code, | |
| 207 | + language, | |
| 208 | + currLineOffsetFromTop, | |
| 209 | + ); | |
| 210 | + // console.log(highlightedCodeHtml); | |
| 168 | 211 | |
| 169 | - const guts = this.convertShikiHtmlToSvgGut( | |
| 212 | + const { guts, lineBackgrounds } = this.convertShikiHtmlToSvgGut( | |
| 170 | 213 | highlightedCodeHtml, |
| 171 | 214 | fontSize, |
| 172 | 215 | fontFamily, |
| 173 | 216 | lineHeight, |
| 217 | + dimensions, | |
| 174 | 218 | ); |
| 175 | 219 | const backgroundColor = this.getBackgroundColor(highlightedCodeHtml); |
| 176 | 220 | |
| 177 | - const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${dimensions.width}" height="${dimensions.height}"> | |
| 221 | + const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${dimensions.width}" height="${dimensions.height}" shape-rendering="crispEdges"> | |
| 222 | + <style> | |
| 223 | + :root { | |
| 224 | + --purple: rgb(112, 114, 209); | |
| 225 | + --green: rgb(136, 194, 163); | |
| 226 | + --blue: rgb(107, 166, 205); | |
| 227 | + } | |
| 228 | + </style> | |
| 178 | 229 | <g> |
| 179 | - <rect width="${dimensions.width}" height="${dimensions.height}" fill="${backgroundColor}" stroke="${this.editorForeground}" stroke-width="1" /> | |
| 230 | + <rect x="0" y="0" rx="10" ry="10" width="${dimensions.width}" height="${dimensions.height}" fill="${this.editorBackground}" shape-rendering="crispEdges" /> | |
| 231 | + ${lineBackgrounds} | |
| 180 | 232 | ${guts} |
| 181 | 233 | </g> |
| 182 | 234 | </svg>`; |
| 235 | + console.log(svg); | |
| 183 | 236 | |
| 184 | 237 | return Buffer.from(svg, "utf8"); |
| 185 | 238 | } |
| @@ -189,7 +242,8 @@ | ||
| 189 | 242 | fontSize: number, |
| 190 | 243 | fontFamily: string, |
| 191 | 244 | lineHeight: number, |
| 192 | - ): string { | |
| 245 | + dimensions: Dimensions, | |
| 246 | + ): { guts: string; lineBackgrounds: string } { | |
| 193 | 247 | const dom = new JSDOM(shikiHtml); |
| 194 | 248 | const document = dom.window.document; |
| 195 | 249 | |
| @@ -204,19 +258,70 @@ | ||
| 204 | 258 | const el = node as HTMLElement; |
| 205 | 259 | const style = el.getAttribute("style") || ""; |
| 206 | 260 | const colorMatch = style.match(/color:\s*(#[0-9a-fA-F]{6})/); |
| 207 | - const fill = colorMatch ? ` fill="${colorMatch[1]}"` : ""; | |
| 261 | + const classes = el.getAttribute("class") || ""; | |
| 262 | + let fill = colorMatch ? ` fill="${colorMatch[1]}"` : ""; | |
| 263 | + if (classes.includes("highlighted")) { | |
| 264 | + fill = ` fill="${this.editorLineHighlight}"`; | |
| 265 | + } | |
| 208 | 266 | const content = el.textContent || ""; |
| 209 | 267 | return `<tspan xml:space="preserve"${fill}>${escapeForSVG(content)}</tspan>`; |
| 210 | 268 | }) |
| 211 | 269 | .join(""); |
| 212 | 270 | |
| 213 | - const y = (index + 1) * lineHeight; | |
| 214 | - return `<text x="0" y="${y}" font-family="${fontFamily}" font-size="${fontSize.toString()}" xml:space="preserve">${spans}</text>`; | |
| 271 | + // Typography notes: | |
| 272 | + // Each line of code is a <text> inside a <rect>. | |
| 273 | + // Math becomes interesting here; the y value is actually aligned to the topmost border. | |
| 274 | + // So y = 0 will have the rect be flush with the top border. | |
| 275 | + // More importantly, text will also be positioned that way. | |
| 276 | + // Since y = 0 is the axis the text will align itself to, the default settings will actually have the text sitting "on top of" the y = 0 axis, which effectively shifts them up. | |
| 277 | + // To prevent this, we want the alignment axis to be at the middle of each rect, and have the text align itself vertically to the center (skwered by the axis). | |
| 278 | + // The first step is to add lineHeight / 2 to move the axis down. | |
| 279 | + // The second step is to add 'dominant-baseline="central"' to vertically center the text. | |
| 280 | + // Note that we choose "central" over "middle". "middle" will center the text too perfectly, which is actually undesirable! | |
| 281 | + const y = index * lineHeight + lineHeight / 2; | |
| 282 | + return `<text x="0" y="${y}" font-family="${fontFamily}" font-size="${fontSize.toString()}" xml:space="preserve" dominant-baseline="central" shape-rendering="crispEdges">${spans}</text>`; | |
| 215 | 283 | }); |
| 216 | 284 | |
| 217 | - return ` | |
| 218 | - ${svgLines.join("\n")} | |
| 219 | - `.trim(); | |
| 285 | + const lineBackgrounds = lines | |
| 286 | + .map((line, index) => { | |
| 287 | + const classes = line?.getAttribute("class") || ""; | |
| 288 | + const bgColor = classes.includes("highlighted") | |
| 289 | + ? this.editorLineHighlight | |
| 290 | + : this.editorBackground; | |
| 291 | + const y = index * lineHeight; | |
| 292 | + const isFirst = index === 0; | |
| 293 | + const isLast = index === lines.length - 1; | |
| 294 | + const radius = 10; | |
| 295 | + // SVG notes: | |
| 296 | + // By default SVGs have anti-aliasing on. | |
| 297 | + // This is undesirable in our case because pixel-perfect alignment of these rectangles will introduce thin gaps. | |
| 298 | + // Turning it off with 'shape-rendering="crispEdges"' solves the issue. | |
| 299 | + return isFirst | |
| 300 | + ? `<path d="M ${0} ${y + lineHeight} | |
| 301 | + L ${0} ${y + radius} | |
| 302 | + Q ${0} ${y} ${radius} ${y} | |
| 303 | + L ${dimensions.width - radius} ${y} | |
| 304 | + Q ${dimensions.width} ${y} ${dimensions.width} ${y + radius} | |
| 305 | + L ${dimensions.width} ${y + lineHeight} | |
| 306 | + Z" | |
| 307 | + fill="${bgColor}" />` | |
| 308 | + : isLast | |
| 309 | + ? `<path d="M ${0} ${y} | |
| 310 | + L ${0} ${y + lineHeight - radius} | |
| 311 | + Q ${0} ${y + lineHeight} ${radius} ${y + lineHeight} | |
| 312 | + L ${dimensions.width - radius} ${y + lineHeight} | |
| 313 | + Q ${dimensions.width} ${y + lineHeight} ${dimensions.width} ${y + lineHeight - 10} | |
| 314 | + L ${dimensions.width} ${y} | |
| 315 | + Z" | |
| 316 | + fill="${bgColor}" />` | |
| 317 | + : `<rect x="0" y="${y}" rx="${radius}" ry="${radius}" width="100%" height="${lineHeight}" fill="${bgColor}" shape-rendering="crispEdges" />`; | |
| 318 | + }) | |
| 319 | + .join("\n"); | |
| 320 | + | |
| 321 | + return { | |
| 322 | + guts: svgLines.join("\n"), | |
| 323 | + lineBackgrounds, | |
| 324 | + }; | |
| 220 | 325 | } |
| 221 | 326 | |
| 222 | 327 | getBackgroundColor(shikiHtml: string): string { |
| @@ -244,6 +349,7 @@ | ||
| 244 | 349 | dimensions: Dimensions, |
| 245 | 350 | lineHeight: number, |
| 246 | 351 | options: ConversionOptions, |
| 352 | + currLineOffsetFromTop: number, | |
| 247 | 353 | ): Promise<DataUri> { |
| 248 | 354 | switch (options.imageType) { |
| 249 | 355 | // case "png": |
| @@ -265,6 +371,7 @@ | ||
| 265 | 371 | dimensions, |
| 266 | 372 | lineHeight, |
| 267 | 373 | options, |
| 374 | + currLineOffsetFromTop, | |
| 268 | 375 | ); |
| 269 | 376 | return `data:image/svg+xml;base64,${svgBuffer.toString("base64")}`; |
| 270 | 377 | } |
modified core/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified core/package.json +2 −0
| @@ -18,6 +18,8 @@ | ||
| 18 | 18 | "@babel/preset-env": "^7.24.7", |
| 19 | 19 | "@biomejs/biome": "1.6.4", |
| 20 | 20 | "@google/generative-ai": "^0.11.4", |
| 21 | + "@shikijs/colorized-brackets": "^3.7.0", | |
| 22 | + "@shikijs/transformers": "^3.7.0", | |
| 21 | 23 | "@types/diff": "^7.0.1", |
| 22 | 24 | "@types/follow-redirects": "^1.14.4", |
| 23 | 25 | "@types/jest": "^29.5.12", |
modified extensions/vscode/src/activation/NextEditWindowManager.ts +67 −36
| @@ -23,14 +23,30 @@ | ||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | const SVG_CONFIG = { |
| 26 | - stroke: "#999998", | |
| 26 | + // stroke: "#999998", | |
| 27 | + stroke: "#666667", | |
| 27 | 28 | strokeWidth: 1, |
| 28 | 29 | textColor: "#999998", |
| 29 | - filter: "drop-shadow(0 2px 2px rgba(0,0,0,0.2))", | |
| 30 | + purple: "rgba(112, 114, 209)", | |
| 31 | + blue: "rgba(107, 166, 205)", | |
| 32 | + green: "rgba(136 194 163)", | |
| 33 | + // filter: "drop-shadow(0 2px 2px rgba(0,0,0,0.2))", | |
| 34 | + // filter: "drop-shadow(0 2px 2px rgba(255,255,255,0.2))", | |
| 35 | + // filter: | |
| 36 | + // "drop-shadow(0 2px 4px rgb(112, 114, 209)) drop-shadow(0 4px 8px rgb(136, 194, 163)) drop-shadow(0 6px 12px rgb(107, 166, 205));", | |
| 37 | + // filter: | |
| 38 | + // "drop-shadow(0 3px 6px rgba(112, 114, 209, 0.4)) drop-shadow(0 3px 6px rgba(136, 194, 163, 0.4)) drop-shadow(0 3px 6px rgba(107, 166, 205, 0.4));", | |
| 39 | + // filter: `drop-shadow(4px 4px 0px rgba(112, 114, 209, 0.4)) | |
| 40 | + // drop-shadow(8px 8px 0px rgba(107, 166, 205, 0.3)) | |
| 41 | + // drop-shadow(12px 12px 0px rgba(136, 194, 163, 0.2));`, | |
| 42 | + filter: `drop-shadow(4px 4px 0px rgba(112, 114, 209, 0.4)) | |
| 43 | + drop-shadow(-2px 4px 0px rgba(107, 166, 205, 0.3)) | |
| 44 | + drop-shadow(4px -2px 0px rgba(136, 194, 163, 0.2)) | |
| 45 | + drop-shadow(-2px -2px 0px rgba(112, 114, 209, 0.2));`, | |
| 30 | 46 | radius: 3, |
| 31 | 47 | leftMargin: 40, |
| 32 | 48 | defaultText: "", |
| 33 | - lineSpacing: 1.2, // Line spacing multiplier | |
| 49 | + lineSpacing: 1.3, // Line spacing multiplier | |
| 34 | 50 | cursorOffset: 4, // Spaces to offset from cursor |
| 35 | 51 | |
| 36 | 52 | get fontSize() { |
| @@ -244,6 +260,7 @@ | ||
| 244 | 260 | editor: vscode.TextEditor, |
| 245 | 261 | currCursorPos: vscode.Position, |
| 246 | 262 | editableRegionStartLine: number, |
| 263 | + oldEditRangeSlice: string, | |
| 247 | 264 | newEditRangeSlice: string, |
| 248 | 265 | diffLines: DiffLine[], |
| 249 | 266 | ) { |
| @@ -278,7 +295,13 @@ | ||
| 278 | 295 | ); |
| 279 | 296 | |
| 280 | 297 | // Create and apply decoration with the text. |
| 281 | - await this.renderTooltip(editor, currCursorPos, newEditRangeSlice); | |
| 298 | + await this.renderTooltip( | |
| 299 | + editor, | |
| 300 | + currCursorPos, | |
| 301 | + oldEditRangeSlice, | |
| 302 | + newEditRangeSlice, | |
| 303 | + editableRegionStartLine, | |
| 304 | + ); | |
| 282 | 305 | |
| 283 | 306 | // Reserve tab and esc to either accept or reject the displayed next edit contents. |
| 284 | 307 | await NextEditWindowManager.reserveTabAndEsc(); |
| @@ -507,6 +530,7 @@ | ||
| 507 | 530 | */ |
| 508 | 531 | private async createCodeRender( |
| 509 | 532 | text: string, |
| 533 | + currLineOffsetFromTop: number, | |
| 510 | 534 | ): Promise< |
| 511 | 535 | | { uri: vscode.Uri; dimensions: { width: number; height: number } } |
| 512 | 536 | | undefined |
| @@ -529,6 +553,7 @@ | ||
| 529 | 553 | { |
| 530 | 554 | imageType: "svg", |
| 531 | 555 | }, |
| 556 | + currLineOffsetFromTop, | |
| 532 | 557 | ); |
| 533 | 558 | |
| 534 | 559 | return { |
| @@ -547,9 +572,16 @@ | ||
| 547 | 572 | * @returns The decoration. |
| 548 | 573 | */ |
| 549 | 574 | private async createCodeRenderDecoration( |
| 550 | - code: string, | |
| 575 | + originalCode: string, | |
| 576 | + predictedCode: string, | |
| 577 | + position: vscode.Position, | |
| 578 | + editableRegionStartLine: number, | |
| 551 | 579 | ): Promise<vscode.TextEditorDecorationType | undefined> { |
| 552 | - const uriAndDimensions = await this.createCodeRender(code); | |
| 580 | + const currLineOffsetFromTop = position.line - editableRegionStartLine; | |
| 581 | + const uriAndDimensions = await this.createCodeRender( | |
| 582 | + predictedCode, | |
| 583 | + currLineOffsetFromTop, | |
| 584 | + ); | |
| 553 | 585 | if (!uriAndDimensions) { |
| 554 | 586 | return undefined; |
| 555 | 587 | } |
| @@ -558,38 +590,30 @@ | ||
| 558 | 590 | const tipWidth = dimensions.width; |
| 559 | 591 | const tipHeight = dimensions.height; |
| 560 | 592 | |
| 593 | + const offsetFromTop = | |
| 594 | + (position.line - editableRegionStartLine) * SVG_CONFIG.lineHeight; | |
| 595 | + | |
| 596 | + // Set the margin-left so that it's never covering code inside the editable region. | |
| 597 | + const marginLeft = | |
| 598 | + SVG_CONFIG.getTipWidth(originalCode) - | |
| 599 | + SVG_CONFIG.getTipWidth(originalCode.split("\n")[currLineOffsetFromTop]); | |
| 600 | + | |
| 601 | + console.log(marginLeft); | |
| 602 | + console.log(SVG_CONFIG.getTipWidth(originalCode)); | |
| 603 | + console.log( | |
| 604 | + SVG_CONFIG.getTipWidth(originalCode.split("\n")[currLineOffsetFromTop]), | |
| 605 | + ); | |
| 606 | + console.log(originalCode.split("\n")[currLineOffsetFromTop]); | |
| 561 | 607 | return vscode.window.createTextEditorDecorationType({ |
| 562 | - after: { | |
| 608 | + before: { | |
| 563 | 609 | contentIconPath: uri, |
| 564 | - // border: `;box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px ${backgroundColour}; | |
| 565 | - // border-radius: ${SVG_CONFIG.radius}px; | |
| 566 | - // filter: ${SVG_CONFIG.filter}`, | |
| 567 | - // width: `${tipWidth}px`, | |
| 568 | - // height: `${tipHeight}px`, | |
| 569 | - // border: `transparent; position: absolute; z-index: 1000; | |
| 570 | - // box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, | |
| 571 | - // inset 0 0 0 ${tipHeight}px ${backgroundColour}; | |
| 572 | - // border-radius: ${SVG_CONFIG.radius}px; | |
| 573 | - // filter: ${SVG_CONFIG.filter}; | |
| 574 | - // margin-left: ${SVG_CONFIG.cursorOffset * 8}px;`, | |
| 575 | - border: `transparent; position: absolute; z-index: 1000; | |
| 576 | - box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px; | |
| 577 | - filter: ${SVG_CONFIG.filter}; | |
| 578 | - border-radius: ${SVG_CONFIG.radius}px; | |
| 579 | - margin-left: ${SVG_CONFIG.cursorOffset * 8}px;`, | |
| 580 | - // border: `solid 1px white; position: absolute; z-index: 1000; | |
| 581 | - // margin-left: ${SVG_CONFIG.cursorOffset * 8}px; | |
| 582 | - // margin-top: 0em;`, | |
| 583 | - // border: `solid 1px white; position: absolute; z-index: 1000; | |
| 584 | - // margin: 0em; padding: 0em; | |
| 585 | - // margin-left: ${SVG_CONFIG.cursorOffset * 8}px; | |
| 586 | - // margin-top: 0em;`, | |
| 610 | + border: `transparent; position: absolute; z-index: 2147483647; | |
| 611 | + filter: ${SVG_CONFIG.filter}; | |
| 612 | + margin-top: ${-1 * offsetFromTop}px; | |
| 613 | + margin-left: ${marginLeft}px;`, | |
| 587 | 614 | width: `${tipWidth}px`, |
| 588 | 615 | height: `${tipHeight}px`, |
| 589 | - // textDecoration: `none; transform: translateY(-100%);`, | |
| 590 | 616 | }, |
| 591 | - // Set a negative margin to make the decoration float if it starts to displace text. | |
| 592 | - // Also use absolute positioning. | |
| 593 | 617 | rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed, |
| 594 | 618 | }); |
| 595 | 619 | } |
| @@ -684,16 +708,23 @@ | ||
| 684 | 708 | private async renderTooltip( |
| 685 | 709 | editor: vscode.TextEditor, |
| 686 | 710 | position: vscode.Position, |
| 687 | - text: string, | |
| 711 | + originalCode: string, | |
| 712 | + predictedCode: string, | |
| 713 | + editableRegionStartLine: number, | |
| 688 | 714 | ) { |
| 689 | 715 | console.log("renderTooltip"); |
| 690 | 716 | // Capture document version to detect changes. |
| 691 | 717 | const docVersion = editor.document.version; |
| 692 | 718 | |
| 693 | 719 | // Create a new decoration with the text. |
| 694 | - const decoration = await this.createCodeRenderDecoration(text); | |
| 720 | + const decoration = await this.createCodeRenderDecoration( | |
| 721 | + originalCode, | |
| 722 | + predictedCode, | |
| 723 | + position, | |
| 724 | + editableRegionStartLine, | |
| 725 | + ); | |
| 695 | 726 | if (!decoration) { |
| 696 | - console.error("Failed to create decoration for text:", text); | |
| 727 | + console.error("Failed to create decoration for text:", predictedCode); | |
| 697 | 728 | return; |
| 698 | 729 | } |
| 699 | 730 |
modified extensions/vscode/src/autocomplete/completionProvider.ts +1 −0
| @@ -420,6 +420,7 @@ | ||
| 420 | 420 | editor, |
| 421 | 421 | currCursorPos, |
| 422 | 422 | editableRegionStartLine, |
| 423 | + oldEditRangeSlice, | |
| 423 | 424 | newEditRangeSlice, |
| 424 | 425 | diffLines, |
| 425 | 426 | ); |