Compare commits
3
Commits
43c8cfd85a
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cabc3e303 | ||
|
|
0e69f5a179 | ||
|
|
7b0cc2a807 |
@@ -110,7 +110,7 @@
|
||||
: 'border-[var(--color-line)] text-[var(--color-ink-muted)] hover:bg-[var(--color-surface-muted)]'}"
|
||||
onclick={() => (index = position)}
|
||||
>
|
||||
{#if choices[position].includes("<<<<<<<")}
|
||||
{#if choices[position]?.includes("<<<<<<<")}
|
||||
<Icon icon="ph:warning" class="text-[var(--color-danger)]" />
|
||||
{:else}
|
||||
<Icon icon="ph:check-circle" class="text-[var(--color-success)]" />
|
||||
|
||||
@@ -70,6 +70,12 @@
|
||||
|
||||
const isToml = $derived(filePath.toLowerCase().endsWith(".toml"));
|
||||
|
||||
function disableTypstLanguage() {
|
||||
queueMicrotask(() => {
|
||||
view?.dispatch({ effects: languageSlot.reconfigure([]) });
|
||||
});
|
||||
}
|
||||
|
||||
function resilientSync(parser: any) {
|
||||
return StateField.define<null>({
|
||||
create: () => null,
|
||||
@@ -78,7 +84,11 @@
|
||||
transaction.startState.facet(language) !==
|
||||
transaction.state.facet(language)
|
||||
) {
|
||||
try {
|
||||
parser.clearParser();
|
||||
} catch {
|
||||
disableTypstLanguage();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -94,7 +104,13 @@
|
||||
for (const edit of edits.edits) parser.applyTreeEdit(edit);
|
||||
});
|
||||
} catch {
|
||||
try {
|
||||
parser.clearParser();
|
||||
} catch {
|
||||
// The wasm parser instance panicked and is no longer usable.
|
||||
// Drop syntax highlighting rather than crash on every keystroke.
|
||||
disableTypstLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -688,7 +688,7 @@ async function tryOpenCollab(file: string, diskContent: string) {
|
||||
);
|
||||
|
||||
const synced = await new Promise<boolean>((resolve) => {
|
||||
session.provider.once("synced", (isSynced: boolean) => resolve(isSynced));
|
||||
session.provider.once("sync", (isSynced: boolean) => resolve(isSynced));
|
||||
}).catch(() => false);
|
||||
|
||||
if (app.activePath !== file) {
|
||||
|
||||
Reference in New Issue
Block a user