@lvce-editor/text-search-worker 3.33.0 → 3.34.0
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/dist/textSearchWorkerMain.js +12 -10
- package/package.json +1 -1
|
@@ -1917,7 +1917,7 @@ const getChildCount = (expanded, matchCount) => {
|
|
|
1917
1917
|
const pathBaseName = path => {
|
|
1918
1918
|
return path.slice(path.lastIndexOf('/') + 1);
|
|
1919
1919
|
};
|
|
1920
|
-
const
|
|
1920
|
+
const getRelativePath = relativePath => {
|
|
1921
1921
|
if (relativePath.startsWith('./')) {
|
|
1922
1922
|
return `/${relativePath.slice(2)}`; // TODO support windows paths
|
|
1923
1923
|
}
|
|
@@ -1926,7 +1926,7 @@ const getAbsolutePath = relativePath => {
|
|
|
1926
1926
|
|
|
1927
1927
|
const getSearchDisplayResultFile = (results, fileIcons, i, setSize, collapsedPaths, text, posInSet, relativeIndex, focused, originalResults) => {
|
|
1928
1928
|
const path = text;
|
|
1929
|
-
const absolutePath =
|
|
1929
|
+
const absolutePath = getRelativePath(path);
|
|
1930
1930
|
const baseName = pathBaseName(path);
|
|
1931
1931
|
const index = originalResults.indexOf(results[i]);
|
|
1932
1932
|
const matchCount = getMatchCount(results, index);
|
|
@@ -3388,10 +3388,6 @@ const selectIndexFile = async (state, searchResult, index) => {
|
|
|
3388
3388
|
};
|
|
3389
3389
|
};
|
|
3390
3390
|
|
|
3391
|
-
const openUri = async (path, focus = true, props = {}) => {
|
|
3392
|
-
await invoke$2(/* Main.openUri */'Main.openUri', /* uri */path, /* focus */focus, props);
|
|
3393
|
-
};
|
|
3394
|
-
|
|
3395
3391
|
const getFileIndex = (items, index) => {
|
|
3396
3392
|
for (let i = index; i >= 0; i--) {
|
|
3397
3393
|
const item = items[i];
|
|
@@ -3401,9 +3397,15 @@ const getFileIndex = (items, index) => {
|
|
|
3401
3397
|
}
|
|
3402
3398
|
return -1;
|
|
3403
3399
|
};
|
|
3400
|
+
|
|
3401
|
+
const openUri = async (path, focus = true, props = {}) => {
|
|
3402
|
+
await invoke$2(/* Main.openUri */'Main.openUri', /* uri */path, /* focus */focus, props);
|
|
3403
|
+
};
|
|
3404
|
+
|
|
3404
3405
|
const selectIndexPreview = async (state, searchResult, index) => {
|
|
3405
3406
|
const {
|
|
3406
|
-
items
|
|
3407
|
+
items,
|
|
3408
|
+
workspacePath
|
|
3407
3409
|
} = state;
|
|
3408
3410
|
const fileIndex = getFileIndex(items, index);
|
|
3409
3411
|
if (fileIndex === -1) {
|
|
@@ -3413,9 +3415,9 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
3413
3415
|
lineNumber
|
|
3414
3416
|
} = searchResult;
|
|
3415
3417
|
const fileResult = items[fileIndex];
|
|
3416
|
-
const
|
|
3417
|
-
|
|
3418
|
-
await openUri(
|
|
3418
|
+
const relativePath = getRelativePath(fileResult.text);
|
|
3419
|
+
const absolutePath = `${workspacePath}${relativePath}`;
|
|
3420
|
+
await openUri(absolutePath, true, {
|
|
3419
3421
|
selections: new Uint32Array([lineNumber, 0, lineNumber, 0])
|
|
3420
3422
|
});
|
|
3421
3423
|
return {
|