Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wet-lamps-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-language-server': patch
---

fix: support experimental feature in "Show compiled Code"
8 changes: 6 additions & 2 deletions packages/language-server/src/plugins/svelte/SveltePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@
async getCompiledResult(document: Document): Promise<SvelteCompileResult | null> {
try {
const svelteDoc = await this.getSvelteDoc(document);
// @ts-ignore is 'client' in Svelte 5
return svelteDoc.getCompiledWith({ generate: 'dom' });
const options: any = { generate: 'dom' }; // 'client' in Svelte 5
if (document.config?.compilerOptions?.experimental) {

Check failure on line 114 in packages/language-server/src/plugins/svelte/SveltePlugin.ts

View workflow job for this annotation

GitHub Actions / test

Property 'experimental' does not exist on type 'CompileOptions'.
// Svelte 5 only; we gotta write it like this else Svelte 4 fails on unknown key
options.experimental = document.config.compilerOptions.experimental;

Check failure on line 116 in packages/language-server/src/plugins/svelte/SveltePlugin.ts

View workflow job for this annotation

GitHub Actions / test

Property 'experimental' does not exist on type 'CompileOptions'.
}
return await svelteDoc.getCompiledWith(options);
} catch (error) {
return null;
}
Expand Down
Loading