diff --git a/packages/svelte-vscode/src/sveltekit/generateFiles/templates/error.ts b/packages/svelte-vscode/src/sveltekit/generateFiles/templates/error.ts
index 1a6407cc6..b8afe9476 100644
--- a/packages/svelte-vscode/src/sveltekit/generateFiles/templates/error.ts
+++ b/packages/svelte-vscode/src/sveltekit/generateFiles/templates/error.ts
@@ -8,6 +8,14 @@ const defaultScriptTemplate = `
{$page.status}: {$page.error.message}
`;
+const jsSv5ScriptTemplateAppState = `
+
+
+{page.status}: {page.error.message}
+`;
+
const tsScriptTemplate = `
+
+{page.status}: {page.error?.message}
+`;
+
export default async function (config: GenerateConfig): ReturnType {
- const { withTs } = config.kind;
+ const { withTs, withAppState } = config.kind;
let template = defaultScriptTemplate;
- if (withTs) {
+ if (withAppState && withTs) {
+ template = tsSv5ScriptTemplateAppState;
+ } else if (withAppState && !withTs) {
+ template = jsSv5ScriptTemplateAppState;
+ } else if (!withAppState && withTs) {
template = tsScriptTemplate;
+ } else if (!withAppState && !withTs) {
+ template = defaultScriptTemplate;
}
return template.trim();
diff --git a/packages/svelte-vscode/src/sveltekit/generateFiles/types.ts b/packages/svelte-vscode/src/sveltekit/generateFiles/types.ts
index 978e4dc2c..21d8f5a94 100644
--- a/packages/svelte-vscode/src/sveltekit/generateFiles/types.ts
+++ b/packages/svelte-vscode/src/sveltekit/generateFiles/types.ts
@@ -39,6 +39,7 @@ export interface GenerateConfig {
withSatisfies: boolean;
withRunes: boolean;
withProps: boolean;
+ withAppState: boolean;
};
pageExtension: string;
scriptExtension: string;
diff --git a/packages/svelte-vscode/src/sveltekit/utils.ts b/packages/svelte-vscode/src/sveltekit/utils.ts
index cce8e2de9..b08740638 100644
--- a/packages/svelte-vscode/src/sveltekit/utils.ts
+++ b/packages/svelte-vscode/src/sveltekit/utils.ts
@@ -47,6 +47,13 @@ export async function checkProjectKind(path: string): Promise= jsconfig.length);
let withSatisfies = false;
if (withTs) {
@@ -70,7 +77,8 @@ export async function checkProjectKind(path: string): Promise