pi-hashline-edit-pro 0.16.9 → 0.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +4 -2
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { regReplaceFlat } from "./src/replace-flat";
|
|
|
7
7
|
import { regReplaceUndo } from "./src/replace-undo";
|
|
8
8
|
import { regRead, fmtReadPreview } from "./src/read";
|
|
9
9
|
import { toLF, stripBOM } from "./src/replace-diff";
|
|
10
|
+
import { resolveTarget } from "./src/fs-write";
|
|
10
11
|
import { visLines } from "./src/utils";
|
|
11
12
|
import { AUTO_READ_MAX } from "./src/constants";
|
|
12
13
|
import {
|
|
@@ -88,13 +89,14 @@ export default function (pi: ExtensionAPI): void {
|
|
|
88
89
|
|
|
89
90
|
try {
|
|
90
91
|
const absolutePath = isAbsolute(filePath) ? filePath : join(ctx.cwd, filePath);
|
|
91
|
-
const
|
|
92
|
+
const resolvedPath = await resolveTarget(absolutePath);
|
|
93
|
+
const content = await readFile(resolvedPath, "utf-8");
|
|
92
94
|
const { text: rawContent } = stripBOM(content);
|
|
93
95
|
const normalized = toLF(rawContent);
|
|
94
96
|
|
|
95
97
|
if (visLines(normalized).length === 0) return;
|
|
96
98
|
|
|
97
|
-
const preview = await fmtReadPreview(normalized, { limit: AUTO_READ_MAX }, undefined,
|
|
99
|
+
const preview = await fmtReadPreview(normalized, { limit: AUTO_READ_MAX }, undefined, resolvedPath);
|
|
98
100
|
|
|
99
101
|
return {
|
|
100
102
|
content: [
|
package/package.json
CHANGED