path -> uri: code to edit, some commands
This commit is contained in:
parent
c566eae06c
commit
f664092925
3 changed files with 5 additions and 3 deletions
|
|
@ -38,8 +38,8 @@ export function ctxItemToRifWithContents(
|
|||
|
||||
if (nameSplit.length > 1) {
|
||||
const lines = nameSplit[1].split(")")[0].split("-");
|
||||
startLine = Number.parseInt(lines[0], 10);
|
||||
endLine = Number.parseInt(lines[1], 10);
|
||||
startLine = Number.parseInt(lines[0], 10) - 1;
|
||||
endLine = Number.parseInt(lines[1], 10) - 1;
|
||||
}
|
||||
|
||||
const rif: RangeInFileWithContents = {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { getLastNPathParts } from ".";
|
||||
import {
|
||||
getLastNUriRelativePathParts,
|
||||
getRelativePath,
|
||||
|
|
@ -156,7 +157,7 @@ describe("getRelativePath", () => {
|
|||
describe("getLastNPathParts", () => {
|
||||
test("returns the last N parts of a filepath with forward slashes", () => {
|
||||
const filepath = "home/user/documents/project/file.txt";
|
||||
expect(getLastNUriRelativePathParts(filepath, 2)).toBe("project/file.txt");
|
||||
expect(getLastNPathParts(filepath, 2)).toBe("project/file.txt");
|
||||
});
|
||||
|
||||
test("returns the last N parts of a filepath with backward slashes", () => {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ export default function CodeToEditListItem({
|
|||
}: CodeToEditListItemProps) {
|
||||
const [showCodeSnippet, setShowCodeSnippet] = useState(false);
|
||||
|
||||
const x = useMemo(() => {}, [code.contents, code.filepath]);
|
||||
const context = useMemo(() => {
|
||||
return rifWithContentsToContextItem({
|
||||
contents: code.contents,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue