-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) add support for svelte:element (#1437)
- Loading branch information
1 parent
d745f5d
commit cd98a53
Showing
16 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/language-server/test/plugins/svelte/testfiles/diagnostics-module.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<script context="module" lang="ts"> | ||
export let name: string; | ||
$: console.log('foo'); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
...server/test/plugins/typescript/features/diagnostics/fixtures/svelte-element/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ | ||
{ | ||
"range": { "start": { "line": 10, "character": 0 }, "end": { "line": 10, "character": 0 } }, | ||
"severity": 1, | ||
"source": "js", | ||
"message": "<svelte:element> must have a 'this' attribute", | ||
"code": -1 | ||
} | ||
] |
9 changes: 9 additions & 0 deletions
9
...rver/test/plugins/typescript/features/diagnostics/fixtures/svelte-element/expectedv2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ | ||
{ | ||
"range": { "start": { "line": 10, "character": 0 }, "end": { "line": 10, "character": 0 } }, | ||
"severity": 1, | ||
"source": "js", | ||
"message": "<svelte:element> must have a 'this' attribute", | ||
"code": -1 | ||
} | ||
] |
11 changes: 11 additions & 0 deletions
11
...-server/test/plugins/typescript/features/diagnostics/fixtures/svelte-element/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
let tag = 'div'; | ||
</script> | ||
|
||
<!-- valid --> | ||
<svelte:element this={tag} /> | ||
<svelte:element this={tag}>{tag}</svelte:element> | ||
<svelte:element this={tag} on:click={() => tag} /> | ||
|
||
<!-- error --> | ||
<svelte:element /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/svelte2tsx/test/svelte2tsx/samples/svelte-element/expected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
///<reference types="svelte" /> | ||
<></>;function render() { | ||
|
||
let tag = 'div'; | ||
; | ||
() => (<> | ||
|
||
<svelteelement this={tag} /> | ||
<svelteelement this={tag}>{tag}</svelteelement> | ||
<svelteelement this={tag} onclick={() => tag} /></>); | ||
return { props: {}, slots: {}, getters: {}, events: {} }} | ||
|
||
export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) { | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/svelte2tsx/test/svelte2tsx/samples/svelte-element/expectedv2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
///<reference types="svelte" /> | ||
;function render() { | ||
|
||
let tag = 'div'; | ||
; | ||
async () => { | ||
|
||
{ svelteHTML.createElement("svelteelement", { });} | ||
{ svelteHTML.createElement("svelteelement", { });tag; } | ||
{ svelteHTML.createElement("svelteelement", { "onclick":() => tag,});}}; | ||
return { props: {}, slots: {}, getters: {}, events: {} }} | ||
|
||
export default class Input__SvelteComponent_ extends __sveltets_1_createSvelte2TsxComponent(__sveltets_1_partial(__sveltets_1_with_any_event(render()))) { | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/svelte2tsx/test/svelte2tsx/samples/svelte-element/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script> | ||
let tag = 'div'; | ||
</script> | ||
|
||
<svelte:element this={tag} /> | ||
<svelte:element this={tag}>{tag}</svelte:element> | ||
<svelte:element this={tag} on:click={() => tag} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters