off by one range rif error - fix clickable context items and symbols
This commit is contained in:
parent
9603c719f1
commit
ab74a4efba
4 changed files with 7 additions and 6 deletions
|
|
@ -29,6 +29,7 @@ export function rifWithContentsToContextItem(
|
|||
|
||||
export function ctxItemToRifWithContents(
|
||||
item: ContextItemWithId,
|
||||
linesOffByOne = false,
|
||||
): RangeInFileWithContents {
|
||||
let startLine = 0;
|
||||
let endLine = 0;
|
||||
|
|
@ -37,8 +38,8 @@ export function ctxItemToRifWithContents(
|
|||
|
||||
if (nameSplit.length > 1) {
|
||||
const lines = nameSplit[1].split(")")[0].split("-");
|
||||
startLine = Number.parseInt(lines[0], 10) - 1;
|
||||
endLine = Number.parseInt(lines[1], 10) - 1;
|
||||
startLine = Number.parseInt(lines[0], 10) - (linesOffByOne ? 1 : 0);
|
||||
endLine = Number.parseInt(lines[1], 10) - (linesOffByOne ? 1 : 0);
|
||||
}
|
||||
|
||||
const rif: RangeInFileWithContents = {
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.245",
|
||||
"version": "0.9.246",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.245",
|
||||
"version": "0.9.246",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/fetch": "^1.0.3",
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ async function resolveEditorContent({
|
|||
} else if (p.type === "codeBlock") {
|
||||
if (p.attrs?.item) {
|
||||
const contextItem = p.attrs.item as ContextItemWithId;
|
||||
const rif = ctxItemToRifWithContents(contextItem);
|
||||
const rif = ctxItemToRifWithContents(contextItem, true);
|
||||
// If not editing, include codeblocks in the prompt
|
||||
// If editing is handled by selectedCode below
|
||||
if (!contextItem.editing) {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ function CodeSnippetPreview(props: CodeSnippetPreviewProps) {
|
|||
filepath: props.item.uri.value,
|
||||
});
|
||||
} else if (props.item.id.providerTitle === "code") {
|
||||
const rif = ctxItemToRifWithContents(props.item);
|
||||
const rif = ctxItemToRifWithContents(props.item, true);
|
||||
ideMessenger.ide.showLines(
|
||||
rif.filepath,
|
||||
rif.range.start.line,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue