mirror of
https://github.com/fancive/obsidian-parallel-reader.git
synced 2026-07-22 06:53:43 +00:00
fix: clear Obsidian review unused bindings
Change-Id: I0f41318fd4bd723de818213941dda9de3c0f33fd
This commit is contained in:
parent
714b6a368b
commit
50c76f528e
6 changed files with 28 additions and 20 deletions
4
main.ts
4
main.ts
|
|
@ -756,7 +756,7 @@ class ParallelReaderPlugin extends Plugin {
|
|||
try {
|
||||
const pos = cm.posAtCoords({ x: rect.left + 20, y: topY });
|
||||
if (pos != null) topLine = cm.state.doc.lineAt(pos).number - 1;
|
||||
} catch (_: unknown) {
|
||||
} catch {
|
||||
/* posAtCoords/lineAt can throw during editor state transitions — safe to ignore */
|
||||
return;
|
||||
}
|
||||
|
|
@ -801,7 +801,7 @@ class ParallelReaderPlugin extends Plugin {
|
|||
try {
|
||||
mdView.editor.setCursor({ line, ch: 0 });
|
||||
mdView.editor.scrollIntoView({ from: { line, ch: 0 }, to: { line, ch: 0 } }, true);
|
||||
} catch (_: unknown) {
|
||||
} catch {
|
||||
/* setCursor/scrollIntoView can throw during view transitions — safe to ignore */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export class CacheManager {
|
|||
try {
|
||||
if (typeof this.adapter.exists === 'function' && (await this.adapter.exists(dir))) return;
|
||||
await this.adapter.mkdir(dir);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
/* ignore race */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export function resolveCliPath(name: string, override: string): string {
|
|||
const p = path.join(dir, name + ext);
|
||||
try {
|
||||
if (fs.existsSync(p)) return p;
|
||||
} catch (_) {
|
||||
} catch {
|
||||
// Ignore unreadable candidate paths and keep searching.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export function extractJson(text: string): string {
|
|||
try {
|
||||
JSON.parse(raw);
|
||||
return raw;
|
||||
} catch (_) {
|
||||
} catch {
|
||||
/* continue */
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ export function extractJson(text: string): string {
|
|||
try {
|
||||
JSON.parse(fenced);
|
||||
return fenced;
|
||||
} catch (_) {
|
||||
} catch {
|
||||
/* continue */
|
||||
}
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ export function extractJson(text: string): string {
|
|||
try {
|
||||
JSON.parse(c);
|
||||
return c;
|
||||
} catch (_) {
|
||||
} catch {
|
||||
/* skip */
|
||||
}
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ export function repairTruncatedCardsJson(text: string): string | null {
|
|||
try {
|
||||
JSON.parse(c);
|
||||
validCards.push(c);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
/* skip malformed card */
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ export function parseCardsJson(text: string, settings?: PluginSettings | null):
|
|||
let parsed: unknown;
|
||||
try {
|
||||
parsed = JSON.parse(jsonText);
|
||||
} catch (_e) {
|
||||
} catch {
|
||||
// Attempt to salvage complete cards from truncated output
|
||||
const repaired = repairTruncatedCardsJson(text);
|
||||
if (repaired) {
|
||||
|
|
@ -119,7 +119,7 @@ export function parseCardsJson(text: string, settings?: PluginSettings | null):
|
|||
'complete cards. Consider increasing max tokens.',
|
||||
);
|
||||
return normalizeCardsPayload(parsed, settings);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
/* repair failed, fall through to error */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,18 +150,22 @@ export async function streamingRequestUrl(
|
|||
|
||||
if (signal) {
|
||||
if (signal.aborted) throw new Error('Streaming request aborted');
|
||||
abortPromise = new Promise<never>((_, reject) => {
|
||||
abortListener = () => reject(new Error('Streaming request aborted'));
|
||||
signal.addEventListener('abort', abortListener, { once: true });
|
||||
});
|
||||
abortPromise = (async () => {
|
||||
await new Promise<void>((resolve) => {
|
||||
abortListener = resolve;
|
||||
signal.addEventListener('abort', abortListener, { once: true });
|
||||
});
|
||||
throw new Error('Streaming request aborted');
|
||||
})();
|
||||
}
|
||||
|
||||
let timeoutId: number | null = null;
|
||||
const timeoutPromise = new Promise<never>((_, reject) => {
|
||||
timeoutId = activeWindow.setTimeout(() => {
|
||||
reject(new Error(`Streaming timed out after ${timeoutMs}ms`));
|
||||
}, timeoutMs);
|
||||
});
|
||||
const timeoutPromise = (async () => {
|
||||
await new Promise<void>((resolve) => {
|
||||
timeoutId = activeWindow.setTimeout(resolve, timeoutMs);
|
||||
});
|
||||
throw new Error(`Streaming timed out after ${timeoutMs}ms`);
|
||||
})();
|
||||
|
||||
try {
|
||||
const requestPromise = doStreamingRequestUrl(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@ export function folderPathsForTarget(folderPath: string): string[] {
|
|||
const normalized = normalizeVaultPath(folderPath);
|
||||
if (!normalized) return [];
|
||||
const parts = normalized.split('/');
|
||||
return parts.map((_, idx) => parts.slice(0, idx + 1).join('/'));
|
||||
const folders: string[] = [];
|
||||
for (let idx = 0; idx < parts.length; idx++) {
|
||||
folders.push(parts.slice(0, idx + 1).join('/'));
|
||||
}
|
||||
return folders;
|
||||
}
|
||||
|
||||
export async function ensureVaultFolder(app: App, folderPath: string) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue