Open Extarys opened 2 hours ago
We'll definitely need a reproduction to help you. Formatting usually only works with the current file so it shouldn't use that much memory that would crash the process. I suspect it might be some infinite loop/recursive call. Can you try copying the problematic files or the prettier config file to an empty svelte-kit project to see if you can reproduce it? If you still can't find a reproduction, please at least provide the dependencies and devDependencies in your package.json, the tsconfig.json/jsconfig.json and the prettier config file.
I'll get started on some of those right away:
package.json
{
"devDependencies": {
"@repo/api-hono": "workspace:*",
"@repo/dto": "workspace:*",
"@repo/edgedb": "workspace:*",
"@fortawesome/fontawesome-pro": "^6.6.0",
"@fortawesome/free-brands-svg-icons": "^6.6.0",
"@fortawesome/pro-duotone-svg-icons": "^6.6.0",
"@fortawesome/pro-light-svg-icons": "^6.6.0",
"@fortawesome/pro-regular-svg-icons": "^6.6.0",
"@fortawesome/pro-solid-svg-icons": "^6.6.0",
"@fortawesome/pro-thin-svg-icons": "^6.6.0",
"@fortawesome/sharp-duotone-solid-svg-icons": "^6.6.0",
"@fortawesome/sharp-light-svg-icons": "^6.6.0",
"@fortawesome/sharp-regular-svg-icons": "^6.6.0",
"@fortawesome/sharp-solid-svg-icons": "^6.6.0",
"@fortawesome/sharp-thin-svg-icons": "^6.6.0",
"@fortawesome/svelte-fontawesome": "^0.2.2",
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.5.26",
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
"@types/eslint": "^9.6.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^5.0.0-next.245",
"svelte-check": "^4.0.0",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
"vite": "^5.0.3",
"vitest": "^2.0.0",
"tailwindcss": "^3.4.4",
"postcss": "^8.4.38",
"autoprefixer": "^10.4.19",
"@tailwindcss/typography": "^0.5.15",
"prettier-plugin-tailwindcss": "^0.6.4"
},
"type": "module",
"dependencies": {
"@cartamd/plugin-attachment": "^4.0.2",
"@cartamd/plugin-code": "^4.0.6",
"@cartamd/plugin-component": "^1.0.2",
"@cartamd/plugin-emoji": "^4.1.3",
"@cartamd/plugin-slash": "^4.0.2",
"@internationalized/date": "^3.5.5",
"@paralleldrive/cuid2": "^2.2.2",
"@tiptap/core": "^2.7.2",
"@tiptap/extension-dropcursor": "^2.7.2",
"@tiptap/extension-link": "^2.7.2",
"@tiptap/extension-underline": "^2.7.2",
"@tiptap/pm": "^2.7.2",
"@tiptap/starter-kit": "^2.7.2",
"bits-ui": "^0.21.13",
"carta-md": "^4.4.5",
"clsx": "^2.1.1",
"cmdk-sv": "^0.0.18",
"formsnap": "^1.0.1",
"isomorphic-dompurify": "^2.15.0",
"lucide-svelte": "^0.439.0",
"mode-watcher": "^0.4.1",
"paneforge": "^0.0.5",
"svelte-fa": "^4.0.2",
"svelte-persisted-store": "^0.11.0",
"svelte-tiptap": "^1.1.3",
"sveltekit-superforms": "^2.17.0",
"tailwind-merge": "^2.5.2",
"tailwind-variants": "^0.2.1",
"zod": "^3.23.8"
}
}
tsconfig:
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
Prettier
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
Exemple of file that make the extension crash:
<script lang="ts">
import { zod } from 'sveltekit-superforms/adapters';
import { goto } from '$app/navigation';
import SuperDebug, {
type SuperValidated,
type Infer,
superForm,
setMessage,
defaults
} from 'sveltekit-superforms';
import { loginFormSchema } from '@repo/dto';
// UI elements
import * as Card from '$lib/components/ui/card/index.js';
import * as Form from '$lib/components/ui/form';
import { Input } from '$lib/components/ui/input';
import { Button } from '$lib/components/ui/button';
const form = superForm(defaults(zod(loginFormSchema)), {
SPA: true,
resetForm: false,
validators: zod(loginFormSchema),
dataType: 'json',
delayMs: 500,
timeoutMs: 4000,
onUpdate: async ({ form }) => {
}
});
const { form: formData, enhance, errors, submitting, delayed, timeout, validate, message } = form;
</script>
<div class="grid place-items-center h-screen shadow">
<form use:enhance>
<Card.Root class="flex flex-col w-96 h-96 rounded-sm border shadow-lg">
<Card.Header>Title</Card.Header>
<Card.Content>
<Form.Field {form} name="username">
<Form.Control let:attrs>
<Form.Label>Username</Form.Label>
<Input {...attrs} bind:value={$formData.identifier} />
</Form.Control>
<Form.FieldErrors />
</Form.Field>
<Form.Field {form} name="username">
<Form.Control let:attrs>
<Form.Label>Password</Form.Label>
<Input {...attrs} bind:value={$formData.clearPassword} type="password" />
</Form.Control>
<Form.FieldErrors />
</Form.Field>
</Card.Content>
<Card.Footer class="flex flex-row">
<Button type="submit" class="ml-auto">Login</Button>
</Card.Footer>
</Card.Root>
</form>
</div>
<style lang="postcss">
</style>
I'll try to make a reproduction tomorrow ;) But in the meantime maybe there is a hint somewhere in there.
Is there a way to make the extension logs more verbose to help pinpoint the issue?
Describe the bug
Every time I try to run "Format document", after 10-20 seconds I get an error in Output > Svelte and nothing happens
(I have a lot of those)
Output > Extension Host
Reproduction
I have this issue with VSCodium rpm and VSCodium flatpak. No idea how to reproduce.
Monorepo with a ui folder, containing svelte.config.js (Sveltekit, vite).
Formatting work on a 25 LOC file, but another component with 95 LOC make it crash every single time. I tried multiple page and they mostly all make the language server crash.
I don't really know what you need, please let me know. It was working fine 2 days ago, I didn't update any npm package, but I have no idea if vscode did update extensions in the background, so I erased all tmp and config files and tested with flatpak too, issue still persist.
Expected behaviour
The extension shouldn't crash; The document should get formatted
System Info
Which package is the issue about?
Svelte for VS Code extension, svelte-language-server
Additional Information, eg. Screenshots
Old similar issue: https://github.com/jamesbirtles/svelte-vscode/issues/26