Skip to content

Commit 07a837a

Browse files
authored
fix: add support for Svelte (#3874)
fix: #3873
1 parent 865898e commit 07a837a

File tree

7 files changed

+78
-0
lines changed

7 files changed

+78
-0
lines changed

packages/cspell-bundled-dicts/cspell-default.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ const settings = {
5050
languageId: 'typescript,typescriptreact,mdx',
5151
dictionaries: ['typescript', 'node', 'npm'],
5252
},
53+
{
54+
languageId: 'svelte',
55+
dictionaries: ['typescript', 'npm', 'html', 'html-symbol-entities', 'css', 'fonts'],
56+
},
5357
{
5458
languageId: 'javascriptreact,typescriptreact,mdx',
5559
dictionaries: ['html', 'html-symbol-entities', 'css', 'fonts'],
@@ -99,6 +103,7 @@ const settings = {
99103
ignoreRegExpList: ['MARKDOWN-link-reference', 'MARKDOWN-link-footer', 'MARKDOWN-link', 'MARKDOWN-anchor'],
100104
},
101105
],
106+
enableFiletypes: ['svelte'],
102107
import: [
103108
'./cspell-compatibility.json',
104109
'@cspell/dict-ada/cspell-ext.json',

packages/cspell-bundled-dicts/cspell-default.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ const settings: AdvancedCSpellSettings = {
5353
languageId: 'typescript,typescriptreact,mdx',
5454
dictionaries: ['typescript', 'node', 'npm'],
5555
},
56+
{
57+
languageId: 'svelte',
58+
dictionaries: ['typescript', 'npm', 'html', 'html-symbol-entities', 'css', 'fonts'],
59+
},
5660
{
5761
languageId: 'javascriptreact,typescriptreact,mdx',
5862
dictionaries: ['html', 'html-symbol-entities', 'css', 'fonts'],
@@ -102,6 +106,7 @@ const settings: AdvancedCSpellSettings = {
102106
ignoreRegExpList: ['MARKDOWN-link-reference', 'MARKDOWN-link-footer', 'MARKDOWN-link', 'MARKDOWN-anchor'],
103107
},
104108
],
109+
enableFiletypes: ['svelte'],
105110
import: [
106111
'./cspell-compatibility.json',
107112
'@cspell/dict-ada/cspell-ext.json',

packages/cspell-lib/src/LanguageIds.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export const languageExtensionDefinitions: LanguageDefinitions = [
112112
],
113113
},
114114
{ id: 'sql', extensions: ['.sql', '.dsql'] },
115+
{ id: 'svelte', extensions: ['.svelte'] },
115116
{ id: 'swift', extensions: ['.swift'] },
116117
{ id: 'toml', extensions: ['.toml'] },
117118
{ id: 'typescript', extensions: ['.ts', '.cts', '.mts'] },
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Support Svelte
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This config file can be used before `.svelte` support is added.
2+
enableFiletypes:
3+
- svelte
4+
languageSettings:
5+
- caseSensitive: false
6+
languageId: svelte
7+
dictionaries: ['typescript', 'npm', 'html', 'html-symbol-entities', 'css', 'fonts']
8+
overrides:
9+
- filename: '**/*.svelte'
10+
languageId: svelte
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<script>
2+
let scoops = 1;
3+
let flavours = ['Mint choc chip'];
4+
5+
let menu = [
6+
'Cookies and cream',
7+
'Mint choc chip',
8+
'Raspberry ripple'
9+
];
10+
11+
function join(flavours) {
12+
if (typeof flavours !== 'object') return '';
13+
if (flavours.length === 1) return flavours[0];
14+
return `${flavours.slice(0, -1).join(', ')} and ${flavours[flavours.length - 1]}`;
15+
}
16+
</script>
17+
18+
<h2>Size</h2>
19+
20+
<label>
21+
<input type=radio bind:group={scoops} value={1}>
22+
One scoop
23+
</label>
24+
25+
<label>
26+
<input type=radio bind:group={scoops} value={2}>
27+
Two scoops
28+
</label>
29+
30+
<label>
31+
<input type=radio bind:group={scoops} value={3}>
32+
Three scoops
33+
</label>
34+
35+
<h2>Flavours</h2>
36+
37+
<select multiple bind:value={flavours}>
38+
{#each menu as flavour}
39+
<option value={flavour}>
40+
{flavour}
41+
</option>
42+
{/each}
43+
</select>
44+
45+
{#if flavours.length === 0}
46+
<p>Please select at least one flavour</p>
47+
{:else if flavours.length > scoops}
48+
<p>Can't order more flavours than scoops!</p>
49+
{:else}
50+
<p>
51+
You ordered {scoops} {scoops === 1 ? 'scoop' : 'scoops'}
52+
of {join(flavours)}
53+
</p>
54+
{/if}

0 commit comments

Comments
 (0)