fix: correct 'occured' typo in svelte:boundary onerror description - #3039
Merged
dummdidumm merged 2 commits intoJun 2, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 0fc41f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
dummdidumm
approved these changes
Jun 2, 2026
Merged
ghostdevv
pushed a commit
to ghostdevv/language-tools
that referenced
this pull request
Jun 6, 2026
…veltejs#3039) * fix: correct 'occured' typo in svelte:boundary onerror description * chore: add changeset for svelte:boundary onerror typo fix
sam-easygo
added a commit
to sam-easygo/language-tools
that referenced
this pull request
Aug 6, 2026
emitDts resolved every import with a bare ts.resolveModuleName call, so
nothing was cached across the program's files: each of the (typically
hundreds of) node_modules declaration files re-ran the full resolution
walk of open/stat/realpath syscalls for every import. Passing a
ts.createModuleResolutionCache makes resolution the cheap path. Each of
the two resolution hosts gets its own cache because they disagree about
whether virtual .svelte.ts paths exist.
Version Packages (#3086)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chore: tweak changeset (#3087)
fix: support TypeScript 7 under npm alias (#3073)
* fix: support TypeScript 7 rc under npm alias
* also check name for native-preview
* tweak message
* fix merge problem
it's intentionally different so master still does allow npm alias
* update instruction to install stable version
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* replace typescript-7 alias with @typescript/native
* exclude v7 in peer
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Merge pull request #3085 from sveltejs/changeset-release/master
Version Packages
Version Packages
Merge pull request #3084 from sveltejs/fix-lock
fix: ensure config loading happens sequentially
docs: update internal deployment docs
Version Packages (#3077)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: zero-config `+error.svelte` props (#3076)
* feat: zero-config `+error.svelte` props
* Update .changeset/grumpy-rabbits-chew.md
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Version Packages (#3075)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: report tsconfig errors in --tsgo-experimental-api (#3070)
* fix: report tsconfig errors in --tsgo-experimental-api
* maybe just support both for now
might wanted to support typescript7.0rc later
* it's still wrong
fix: resolve tsgo bin path with package.json (#3074)
Version Packages (#3069)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix (svelte-check): `--tsgo-experimental-api` option is not honored (#3067)
* Fix tsgo-experimental-api option
* tweak changeset message format
Version Packages (#3059)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: svelte-check tsgo support with experimental api (#3036)
* wip
* flatten message, utf8 position
* cache api service, parser error
* migrate NoopsInReactiveStatements
* enable stableTypeOrdering so more error message is the same
* wire up to svelte-check
* bump @typescript/native-preview
* fix $$Props check
* wrong api, support svelteKit files
* various svelte-check integration fixes
* import priority fixes
* watch mode, fix non-project file resolution, node18
* fix more test, skip some
* remove unused import
* bumps @typescript/native-preview to fix ts-check issue
* add svelte-check test
* port $store diagnostics
* remove skip
accidentally revert a change
* no longer need the utf8 workaround
* Tweak message, rename flag
* changeset
fix(svelte-check): stop excluding workspaces under dot-prefixed ancestors (#3037)
findFiles() ran each directory through `filePath.includes('/.')` to
skip hidden directories. That predicate also fires on any ancestor of
the workspace whose name starts with a dot, so every descendant under
the workspace got pruned and no virtual `.svelte` files were emitted
into the `.svelte-check` cache. The behaviour is invisible in the
default check path but in `--incremental` / `--tsgo` mode it surfaces
as missing endpoint-handler annotations and spurious implicit-any
errors on `+server.ts` handlers.
The fix narrows the exclude predicate to the directory name fdir
passes as the first argument, so only the descendants whose own name
starts with `.` (or that equal `node_modules`) are dropped. Workspaces
under `.local/`, `.config/`, custom worktree directories, etc. now
crawl normally.
Fixes #3034
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
perf: remove lodash (#3038)
* perf: remove lodash
* fix: missing params
* fix: correct defu usage
* tests: add extra
* fix: 🤦♀️
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: enable passing Svelte config file paths (#3066)
vite.config or svelte.config
Closes #3055
Fixes #3054 (by providing you the possiblity to set this file and turn off file crawling that way)
Also added a TODO for the next major: We should not recursively crawl for config files anymore if we find one in the root directory or next to the tsconfig.
fix: load esm version of Vite (#3065)
cjs version will be gone at some point, and it prints a warning already
fix(svelte2tsx): don't crash on array binding holes in destructured exports (#3058)
An array binding hole (`export let { d: [a, , c] } = obj`) is an
`OmittedExpression` with no `name`, so `addExportForBindingPattern` called
`ts.isIdentifier(undefined)` and threw
`TypeError: Cannot read properties of undefined (reading 'kind')`. Skip holes.
build: bump mocha to v11.7.6 (#3042)
mocha 9.2.0 does not work with nodejs v26.2.0
Merge pull request #3051 from ghostdevv/lint
chore: fix lint
chore: fix lint
fix: build load-config before language-server
* fix: build load-config before language-server
* refactor: make language-server dependency build robust
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
fix: add repository url to package.json (#3048)
Version Packages (#3040)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: adjust rollup config (#3047)
fix: adjust paths in PKG.json (#3046)
* fix: adjust paths in PKG.json
* Create ten-dolls-jam.md
chore: fix changeset (#3045)
feat: support reading Svelte config from vite.config.js/ts (#3031)
We're thinking about getting rid of `svelte.config.js` (or rather, soft-deprecating it): `vite.config.js/ts` is now pretty much the standard for new Svelte apps and generally a better place to put your config.
This is an important stepping stone towards that future. `svelte.config.js` was originally introduced for language-tools to read config options, now we can do the same by reading the Vite config.
With this PR, `vite.config.js` is read first / preferred if both exist, but if it does not exist or no options are retrieved through it then `svelte.config.js/ts` is used.
fix: mark optional members with a trailing ? in completion labels (#3043) (#3044)
Optional object/class members were shown in completions without the `?`
that the TypeScript language service (and vtsls) appends to their labels,
so `baz?: number` completed as `baz` instead of `baz?`.
TypeScript reports optional members via the `optional` kind modifier on
the completion entry. `getCompletionLabelAndInsert` ignored this modifier
and always used the bare name as the label. Detect the modifier and append
`?` to the label while keeping the inserted text as the bare name, so the
`?` is display-only and completion resolution (which keys off `data.name`)
is unaffected.
---------
Co-authored-by: MohammadYusif <MohammadYusif@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: don't show type inlay hint for component inside snippets (#3041)
fix: correct 'occured' typo in svelte:boundary onerror description (#3039)
* fix: correct 'occured' typo in svelte:boundary onerror description
* chore: add changeset for svelte:boundary onerror typo fix
Version Packages (#3018)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix(emitDts): drop declarations emitted outside declarationDir (#2965)
Adds a sample where a Svelte component imports a TypeScript module from
outside libRoot, triggering TypeScript to emit declarations outside the
configured declarationDir.
Also extends the test runner to detect and clean up any .d.ts files
written outside declarationDir, asserting that none are produced.
feat: support Svelte 5 declaration tags (#3033)
fix: take into account component references when calculating snippet hoistability (#3032)
Fixes #3020
fix: handle prop named "slot" inside Svelte 5 snippets (#3030)
Fixes #2992.
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: add support for svelte config ts/mts files (#3009)
* feat: add support for svelte config ts/mts files
* don't add flag when runtime setting exists
* missed some spots
* skip if strip-types isn't enabled
* more
---------
Co-authored-by: Lyu, Wei-Da <36730922+jasonlyu123@users.noreply.github.com>
Co-authored-by: Lyu, Wei Da <jason.lyu@supergeo.com.tw>
fix: tweak "show compiled" icon (#3019)
Fixes #3001. Closes #3002
fix: prevent > in expression affects HTML folding (#3029)
fixes #2537
fix: support prettier.useEditorConfig setting (#3026)
feat: support CSS completions in nested style tags (#3022)
* fix: support CSS completions in nested style tags
* refactor: use findNodeAt for nested style lookup
* document highlight, disable js completion in style
fix: use local name for marking bindable props used (#3017)
Version Packages (#3015)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: typescript 6.0 support (#2985)
* wip
* bumps
* another default change
* changeset
* format
* fix svelte2tsx build for now
* more svelte2tsx migrate
* add node to be explicit
* avoid svelteHTML.mapElementTag in perf test for now
* update svelte5 snapshot
* update svelte-check smoke test to bundler
* try fix flaky test
it might have run too fast
* move typescript to peer in language server
* another drive-by fix
shouldn't matter in most cases but still restore the original logic
* use 6.0.3
Version Packages (#2999)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: flush stdout/stderr before exit in svelte-check (#3014)
* fix(svelte-check): flush stdout/stderr before exit
`process.stdout.write` is asynchronous on non-TTY pipes, and per Node's docs `process.exit` does not wait for queued I/O. Under heavy diagnostic load (1000+ ERROR/WARNING lines, enough to saturate the kernel pipe buffer) the trailing `COMPLETED` summary of `--output machine-verbose` was dropped when the CLI exited, even though the run was clean.
Replace the bare `process.exit(N)` calls in both CLI completion paths (default and `useVirtualFiles`) with the canonical flush-then-exit pattern.
Add a regression test `test-flush.js` (`pnpm run test:flush`) that runs the CLI against a fixture emitting 1500 diagnostics, throttles the consumer to keep the pipe full, and asserts the last non-empty line matches `^\d+ COMPLETED` across 10 runs.
This is useful for testing this fix but I don't know if it's worth actually commiting it to the repo or not.
`test-flush.js` is AI generated and manually reviewed.
* tweak changeset
* Running the flush test manually should be enough
fix: report diagnostics in tsconfig.json (#3005)
* fix: report diagnostics in tsconfig.json
* split changeset
* normalize path to deduplicate
* report global and config diagnostics as warnings in normal svelte-check
warning for now to avoid breaking change
---------
fix: prevent incorrect $types imports being injected in update import (#3010)
* fix ./$types imports
* formatting
* changeset
* remove log
* add test
* other regex
* separate tests
fix: properly place svelte-ignore comment in quickfix when `<script module>` presents (#3011)
* fix: svelte-ignore quickfix action could be improperly placed if a component contained a `<script module>` block
* rm
* changeset 2
* tweak changeset
---------
fix: prevent duplicate diagnostics (#3000)
fix: hoist self-referenced props interface (#2998)
fix #2935
Version Packages (#2977)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: support js/ts config section in VSCode (#2996)
feat: add command to show compiled CSS in preview window (#2993)
* feat: add command to show compiled CSS in preview window
add caching to switch between compiled code and CSS previews, and handle null response for compiled CSS output in both previews
* feat: add SVG icons for compiled CSS preview in light and dark modes
fix: prevent config loading message in svelte-check --incremental (#2974)
* fix: prevent config loading message in svelte-check --incremental
* one more
* load by default
* skip some config loading in test
fix: resolve svelte files under NodeNext (#2990)
* fix: resolve svelte files under --tsgo + NodeNext
* old ts too
* actually incremental in old ts doesn't work either
* unused jsdoc
* bump manifest version
use e18e recommendation (#2986)
fix: typescript 6.0 compatibility (#2988)
* fix: typescript 6.0 compatibility
* tweak
fix: ts-ignore for Svelte 4/5 type differences
feat: pull diagnostics support (#2978)
This switches the diagnostics from push model (server to client) to the pull model when the client supports it. The advantage is that the client can prioritise sending the diagnostic request for the visible tab. With this, we can check the document split to the side immediately and don't need to check all open files after a file save. The pull mode has a way to tell the client that the diagnostics haven't changed. I implement this mostly because VSCode sends another diagnostic request for the same files when switching files in the editor, even if the file isn't changed.
I also lowered the debounce delay in the push-mode diagnostics. I've been wondering if some of the performance complaints are actually just because the artificial delay is too long for some people. The pull mode also has a much lower artificial delay. I think we can give it a try. If people are complaining about it, we can switch to an approach similar to the "smart" mode.
chore(deps): replace vscode-tmgrammar-test with textmate-grammar-test (#2976)
* add textmate-grammar-test
* update snap files
new:
- file headers
- line break tokenization
* update readme
* update to 0.6.0
a minor format change
fix: prevent error with escape sequence in attribute (#2968)
Fixes #2964
fix: accomodate for dynamic compile options
https://github.com/sveltejs/svelte/pull/17801 introduced dynamic compile options; had to adjust one occurence as a result
fix: pluginHost low/smart null check (#2979)
perf: micro-optimizations in hot paths (#2960)
* perf: micro-optimizations in hot paths for faster completions and diagnostics
Replace O(n²) flatten() with Array.prototype.flat(), remove lodash flatten
dependency from PluginHost, use Object.create instead of object spread in
svelteNodeAt AST walking, cache getExistingImports per document, use
RegExp.test() over .match(), replace regex with charCode check in
possiblyComponent, use cached line offsets for lineCount, and optimize
iteration in SnapshotManager.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in PluginHost.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Create big-clocks-care.md
* fix: prettier formatting in changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* address pr feedback: remove flatten util, use charCodeAt, fix code style
- Replace all flatten() call sites with .flat()/.flatMap() and remove
the flatten utility function entirely
- Use charCodeAt(0) directly in possiblyComponent instead of char comparison
- Use block syntax for single-line for loops in SnapshotManager
- Remove ineffective existingImportsCache from CompletionProvider
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
perf: enable incremental TypeScript reparsing via getChangeRange (#2961)
* perf: enable incremental TypeScript reparsing via getChangeRange
Previously, both SvelteDocumentSnapshot and JSOrTSDocumentSnapshot
returned undefined from getChangeRange(), forcing TypeScript to do a
full reparse on every snapshot update. This adds a computeChangeRange()
function that scans for the minimal diff between old and new text,
enabling TS's incremental parser.
Benchmarks show 2-5x faster reparsing for structural edits and
near-instant reparsing for token-level edits (e.g. typing/renaming).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* add changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in benchmark file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* format changeset
* test: add realistic full-file tests for computeChangeRange
Adds tests using realistic svelte2tsx output (~150 lines with script,
store subscriptions, template, and component export) and a full
TypeScript service class (~200 lines with decorators, generics, and
multiple methods). Tests cover common edit patterns on these files
and verify that incremental TS reparsing produces correct ASTs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* trim tests and remove benchmark per review feedback
- Remove incremental-reparse-benchmark.ts (served its purpose)
- Trim DocumentSnapshot.test.ts from 152 to 31 tests, keeping only
essential coverage: basic operations, edge cases, reconstruction
invariant, snapshot integration, and in-place update tests
- Remove redundant/over-tested sections
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR review feedback for incremental reparsing
- JSOrTSDocumentSnapshot.update() returns new snapshot instead of mutating in-place
- SvelteDocumentSnapshot.getChangeRange returns undefined on scriptKind/parserError changes
- Trim tests to essential coverage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in test file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
perf: various optimization with ast walk (#2969)
Version Packages (#2971)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: use Promise<Response> for async kit handler return types (#2966)
* fix: use Promise<Response> return type for async kit handlers
When svelte-check adds type annotations to SvelteKit route handlers
(GET, POST, etc.), it was using `Response | Promise<Response>` as the
return type for all functions regardless of whether they were async.
TypeScript requires async functions to return `Promise<T>`, not
`T | Promise<T>` (TS1064). This caused false positives in
`--incremental` mode where tsc runs on the generated files directly.
The fix checks if the function has an async modifier and, if so,
extracts just the `Promise<Response>` part of the return type union.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: format sveltekit.ts with prettier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix async kit handler return types
Updated async kit handler return types to use Promise<Response>.
* style: format changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: use asyncReturnType parameter instead of string splitting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Version Packages (#2958)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: pass filename to `warningFilter` (#2959)
Fixes #2953
fix: more robust detection of `lang="ts"` attribute (#2957)
Fixes #2956
fix: resolve svelte files under path alias in `--incremental/tsgo` mode (#2955)
Fixes #2952
Version Packages (#2951)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: respect `@ts-ignore` etc comments within tags (#2950)
We now actually output comments into the svelte2tsx output so that stuff like `@ts-ignore` or `eslint-disable` works
Version Packages (#2949)
* Version Packages
* Fix formatting in CHANGELOG for JSDoc @satisfies
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: detect existing JSDoc @satisfies to prevent duplicate injection (#2946)
fix: include `references` in generated `tsconfig.json` in `--incremental/tsgo` mode
They're not inherited by the extends mechanism
Fixes #2948
fix: resolve shims correctly in `--incremental/tsgo` mode
They are places in the svelte-check directory, not inside svelte2tsx which is likely not available
Fixes #2947
fix: support toggle-comment-key in start tags
Use `//` instead of html comments in start tags now.
Requires setting up a new embedded language which only matches within start tags and is basically the svelte config only with the comment functionality changed.
Version Packages (#2945)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: support for comments in tags (#2944)
see https://github.com/sveltejs/svelte/pull/17671
Version Packages (#2940)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chore: remove outdated "experimental-modules" runtime flag (#2898)
* remove outdated runtime flag
* Create long-cups-lie.md
* format
* Delete .changeset/long-cups-lie.md
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: rewrite relative imports reaching outside root (#2942)
When using svelte-check's `--incremental/--tsgo` flags the files are written to a generated folder, making use of the rootDirs tsconfig feature. This has one limitation: when a relative import within a generated file reaches into a directory that is not covered by rootDirs, it cannot be resolved.
This therefore adds a new option to svelte2tsx to rewrite imports as part of the transformation. Note that this will not help with transforming files outside of the working directory, but when you e.g. import a regular TS/JS file that way it now works.
fix: extract style/script tag followed by destructuring in the template (#2921)
* fix: extract style/script tag followed by destructuring in the template
* tweak
* move back to utils
* tweak
* rewrite
* fix some case with attribute, revert getAttributeContext to using scanner
* tweak
* fix svelte-check build
* removed unused variable
* Update packages/language-server/test/lib/documents/parseHtml.test.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: support SvelteKit zero-types with svelte-check --incremental (#2939)
- add jsdoc-type variants for SvelteKit transform helpers
- use those helpers in svelte-check to transform files. Transformed files are written into the generated folder
- filter out diagnostics of original files which have a transformed sibling; sometimes those original files end up in the TS module graph
- remove unused map generation along the way and simplify/deduplicate a few things
Version Packages (#2929)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: add links to diagnostic error codes via codeDescription (#2936)
closes #2933
fix(svelte-check): ignore Unix domain sockets in file watcher (#2931)
svelte-check crashes when encountering Unix domain sockets (e.g., .sock files)
in watch mode because chokidar cannot watch these special files. This adds a
check to ignore sockets using stats.isSocket(), preventing the crash and
allowing svelte-check to continue operating normally.
chore: add changeset for unix socket fix
feat: svelte-check `--incremental` / `--tsgo` (#2932)
Adds two new flags:
- `--incremental`: Opts into TypeScript's incremental build cache, which speeds up subsequent runs. Saved within `.svelte-kit` or if not available within `.svelte-check`. This might result in slightly different type check outcomes, and certain patterns are not supported. Specifically, anything that is not in the root dir of your tsconfig.json and is a Svelte file will not be properly loaded and type-checked.
- `--tsgo`: Use TypeScript's Go implementation. Needs to have `@typescript/native-preview` installed. Subject to the same limitations as `--incremental`
Part of #2733
closes #2131
Huge kudos to https://github.com/astralhpi/svelte-fast-check and https://svelte-check-rs.vercel.app/ , both of which heavily inspired this PR
fix: properly use machine output by default for Claude Code
#2897
Version Packages (#2928)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: apply text synchronize change in order (#2927)
Version Packages (#2919)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: compatibility with prettier-plugin-tailwindcss in monorepo (#2925)
fix: don't hoist type/snippet referencing $store (#2926)
* fix: don't hoist type/snippet referencing $store
* svelte-check changeset
perf: only parse html once in a batch update (#2923)
fix: remove outdated documentation with --ignore (#2920)
feat: support emmet.extensionsPath config (#2918)
feat: Use custom element's JSDoc as doc for completion/hover (#2879)
* ✨ Use custom element's JSDoc as doc for completion
With support for markdown
* ✨ Use custom element's JSDoc as doc for hover
With support for markdown
* ✏️ Typo in description of getNodeIfIsInTagName
* resolve one documentation at a time
* changeset
---------
Co-authored-by: Lyu, Wei Da <jason.lyu@supergeo.com.tw>
fix: add tokenTypes config for JSDoc completion (#2916)
Version Packages (#2896)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
perf: only create objects for completion items for svelte syntax once (#2900)
* only create objects for completion items for svelte syntax once
* Optimize completion items handling for Svelte syntax
* format
fix(syntax): sveltejs ts highlighting when trailing type alias misses semicolon (#2905)
* fix(syntax): svelte ts highlighting when trailing type alias misses semicolon
* test: add fixtures
* fix: allows empty single script tag
* fix style lang=ts
fix: add some limit to store auto-import (#2909)
perf: optimize path normalization (#2907)
perf: avoid global completion in component start tag (#2904)
chore: skip document symbols timeout in test (#2903)
perf: optimize module resolution cache invalidation check (#2902)
* perf: only check for module cache invalidation when there are new files
* another one
[perf]: early return in getCompletions if in style or script tag (#2899)
* early return in getCompletions if in style or script tag
* Create big-cheetahs-admire.md
* format
fix: ensure await-block type is preserved in the latest Svelte version (#2895)
fix: skipLibCheck in svelte-check smoke test (#2893)
Version Packages (#2869)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: support experimental feature in "Show compiled Code" (#2884)
#2857
feat: quick fix for adding lang="ts" (#2882)
#2876
feat: support hierarchical document symbols (#2817)
Closes #1519
Return hierarchical DocumentSymbol, useful for breadcrumb feature in various clients.
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
chore: turn changeset into patch
a minor would be like a major for language-server since we're in 0.x range
feat: use machine format when run by Claude Code (#2870)
* feat: use machine format when run by Claude Code
Fixes #2868
Co-Authored-By: Claude <noreply@anthropic.com>
* Change commit type from feat to chore
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: use moustache for svelte5 onhandler completion (#2883)
chore: slight optimize
forgot to reuse the variable
fix: treat a script tag as top-level if it's the first tag in file (#2886)
docs: update command for setting up TailwindCSS (#2880)
Remove deprecated svelte-add and change it to sv add
feat: implement 'source.removeUnusedImports' code action (#2875)
* feat: implement 'source.removeUnusedImports' code action
* add source action kind to server capability; revert code action removal
* add changeset
fix: restrict emmet completion with emmet specific triggerCharacter (#2873)
* wip
* test
* changeset
* format
fix: support for @nativescript-community/svelte-native (#2867)
* fix: support for @nativescript-community/svelte-native
We moved the svelte-native plugin to @nativescript-community.
This supports it while still supporting the old package
* Add changeset for svelte-language-server patch
Add a changeset for patching svelte-language-server.
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Version Packages (#2861)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: allow `undefined` and `null` values for `#each` in Svelte 5 (#2863)
* fix: allow `undefined` and `null` values for `#each` in Svelte 5
* switch
fix: prevent file watcher issue (#2859)
* fix: prevent file watcher issue
* perf: check if file content changed in tsconfig file watch
chore: fix svelte-check build
Version Packages (#2848)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
perf: rework snapshot hot paths (#2852)
* perf: rework snapshot hot paths
**`fromNonSveltePath`**
This function was originally using `replace` to unix-ify paths before
then testing against them with `endsWith`.
We can instead use static patterns on the unaltered path regardless of
separator.
**`getLastPartOfPath`**
This now uses `slice` on the last separator rather than splitting only
to retrieve the last part.
* perf: avoid garbage collection on diagnostics
Reverts the `getKey` change and updates diagnostics iteration to avoid
allocating an array we later discard.
* Tweak snapshot hot paths for performance
* chore: make linter happy
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
perf: use failed path to invalidate module cache (#2853)
* perf: use failed path to invalidate module cache
* Don't emit both document events in open
This makes the test do extra work after everything is done and creates weird race conditions, which I have already tried to fix many times
* changeset
* remove unnecessary Array.from
fix(svelte2tsx): support for runes={false} in svelte:options (#2847)
Description
The <svelte:options runes/> were not checking for the value, so it was always true. When using <svelte:options runes={false}/> the props exported were Record<string, never> which is incorrect.
Related issues
Fixes #2843
---------
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
(deps) Replace `pascal-case` with `scule` (Maintained & Lighter) (#2842)
* (deps) Replace pascal-case with change-case (Maintained & Lighter)
* add changeset
chore: set vscode package to private
because it's not a real npm pkg
chore: fix release script
Version Packages (#2846)
* Version Packages
* Update packages/svelte2tsx/CHANGELOG.md
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
chore: add missing changeset formatting package
chore: fix branch name trigger
fix: respect moduleResolution setting in emitDts (#2845)
see #2837 for more info
---------
Co-authored-by: Mattias Granlund <mtsgrd@gmail.com>
chore: bump package versions to latest
so changesets knows where to start from. also removes vscode from the list of packages to create changesets for
chore: setup changesets + oidc (#2844)
- setup changesets: all packages are now released through changesets, only the extension is released via tag as before
- remove pkg deploy flows in favor of one
- that flow will use oidc, so no npm token anymore
- also harden the workflows
fix: respect tsconfig/jsconfig exclude patterns in file watcher (#2807)
* fix: respect tsconfig exclude patterns in file watcher
- Add getProjectConfig() to language server to expose parsed tsconfig
- Process wildcard directories in svelte-check to determine watch paths
- Support both recursive and non-recursive directory watching based on TypeScript's configuration
- Handle relative paths correctly for directories outside workspace
This ensures svelte-check only watches directories included by the tsconfig, improving performance and avoiding unnecessary file watching.
* refactor: separate watcher updates from diagnostics scheduling
* prettier fix
* fix: discover missed watch directories with snapshots
* refactor(check): clarify snapshot callback and simplify directory watching; ignore .crush
* fix: order-of-operations for diagnostics and watch directories
* fix: update watch directories before initial diagnostics
---------
fix: builtin custom elements check when transforming attributes (#2824)
* Fix builtin custom elements check when transforming attributes
* Fix lint issue
chore: add CONTRIBUTING.md (#2816)
* chore: add CONTRIBUTING.md
* fix: lint-fix CONTRIBUTING.md
* slim down, deduplicate
* lint
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
fix: Update +error.svelte creation template in vscode extension (#2811)
* Update +error.svelte creation syntax (#2810)
* Add Svelte 5 variants to +error.svelte creation syntax template (#2810)
* Change withRunes to withProps in +error.svelte template
* Add withAppState option
* Change withRunes to withAppState in +error.svelte template
* Remove trailing comma
* Add type for withAppState
Revert "feat: support `<svelte:html>` (#2599)" (#2826)
This reverts commit cd1758b16f4cb6b176980b2c868efa3c98d30343.
chore: bump to typescript 5.9 (#2808)
* chore: bump to typescript 5.9
* typescript-plugin also needs support for the new parameters
fix: prevent organize imports from removing snippet (#2809)
* wip
* test, fix leftover indent
fix: handle object literal in MustacheTag (#2805)
fix: Better detection version (#2801)
* step 1 of version
* start managing things
* adding semver to test
* let's not redo semver!
* better fallback
* not only this ;)
* Update version.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: add `await` support (#2799)
For the new Svelte 5 "await at the top level / in template" feature
feat: add `xxxProps` support to VS Code snippets (#2796)
fixes: #2782
fix: strip doctype using AST instead of regex (#2798)
#2791
chore: make human output more concise and readable (#2748)
* style(svelte-check): make human output more concise and readable
* Update packages/svelte-check/src/writers.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: zero types for `params` (#2795)
Companion to #13999
docs: use svelte 5 syntax in readme (#2785)
Co-authored-by: tijn <tijnjh@proton.me>
fix: enable fallback watcher when dynamicRegistration is false (#2783)
fix: support "Build-Free Editing with Project References" in SvelteKit page.ts files (#2788)
feat: workspace symbols support (#2769)
#2375.
Adding support in the Svelte language server so that you don't need to open ts/js files to use this feature. You can trigger this feature with Ctrl + T and search for symbol names. Some of the handling is also synced to the typescript-plugin so that it's more consistent, which also means vscode can better deduplicate the results from both tsserver and Svelte language server.
fix: invalidate project file cache and handle watcher race condition (#2779)
#2773
This delays the file reading in svelte-check --watch until we're sure the new file is a project file. I still added a file existence check before reading, but it might be more of a fail-safe because the chance of it being deleted at this point is much smaller.
While checking this, I also found that the new file watch is broken because it now caches the tsconfig parsing result. So I changed the "read the config again" logic to the one language server used to invalidate the project files cache.
fix: key block can have its own block scope (#2768)
#2762
fix: don't treat derived imported from svelte/store as a potential store (#2780)
#2772
fix: prevent error with `bind:this={get, set}` (#2781)
This transform bind:this={get, set} with a similar method as bind:this={ele}, but by invoking the set function. The get function is ignored.
perf: bail on giant export maps when initializing auto import cache
implemented within typescript-auto-import-cache dependency
chore: remove "Run tests with debugger" task. (#2764)
feat: support generics on snippets (#2761)
* feat: support generics on snippets
* chore: remove log
* adjust grammar (holy shit that was fucked up)
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
fix: deduplicate definition for rune-mode components (#2759)
Wrap it in ignore comments so they're filtered out
#2697
fix: more robust solution project check for ts < 5.7 in ts plugin (#2758)
#2756
The problem is that in TypeScript before 5.7, the project files were added later than plugin initialisation. Thus, the IsSolution method will always return true in any project using project references during plugin initialisation.
feat: support attachments (#2760)
sveltejs/svelte#15000
fix: invalidate module resolution when higher priority file is added (#2754)
part of #2738
fix: prevent error with unclosed tag followed by LF or end of file (#2750)
#2742
The reason that it happens to LF but not CRLF is that CRLF has two characters, so it doesn't touch the range of the start tag name, and therefore won't trigger the magic string error. This should also improve auto-import performance a bit because TypeScript only needs to compute auto-imports for Button and not a global auto-import.
fix: Move hoisted snippet to right after import (#2753)
#2653
chore: bump vscode-html/css-language-service (#2752)
* chore: bump vscode-html/css-language-service
* update test
feat: support "add missing imports on save" (#2744)
Fixes #2616
Adds the source action to addMissingImports, reusing the same quick fix action as "import all missing"
fix: ensure typed exports are marked as used (#2746)
#2717
fix: various hoistability check (#2740)
#2671 #2727
Added color CLI options (#2678)
* Added color CLI options
* add comment
---------
fix: don't provides quickfix to add async to the script tag (#2737)
fix: highlight one-character component (#2736)
fix: don't create new output channel after restart (#2722)
fix: don't highlight component as a parameter in the template (#2732)
chore: standardize author field (#2723)
feat: directive keyword autocomplete (#2707)
#2696
fix: ensure exports in runes mode are marked as used (#2719)
Ensure they are read as part of exporting the types
#2717
fix: prevent unused variable error for bindable (#2710)
#2268
fix: prevent extra bracket with import statement completion (#2713)
chore: bump to typescript 5.8 (#2704)
fix: highlight type annotation in `@const` tags
#2690
fix: handle booleanish popover (#2702)
`<div popover></div>` actually means `<div popover=""></div>`
#2688
perf: cache files during emitDts (#2701)
closes #2691
fix: correctly handle unclosed tags with same type tag inside (#2682)
fix: use referenced project's compiler option to get resolution mode (#2676)
#2673 Fixing the actual problem that makes the OP want this option. The problem is that the referenced project is a common js project which allows extensionless import. But when we used the wrong compiler option to check for the resolution mode. TypeScript thus used the ESM strategy to resolve the import.
fix: prevent error when the script tag is removed in nodenext projects (#2635)
* fix error when script tag is removed in node16/nodenext
* need to have syntax error
* two more cases tracked it in git so we can reenable it later
* cleanup
* patch update as well
* Mark it as clean first so at least it doesn't stuck in an old version even if lang="ts" is added back
* try finally instead
chore: bump vscode-html/css-language-service (#2677)
#2675 #2388. For svelte-check. The extension should already be shipping with these versions.
fix: properly transform `$props.id` when `$props` is assigned to `props` (#2694)
* fix: properly transform `$props.id` when `$props` is assigned to `props`
* chore: add comments
fix: don't show html tag completion with namespace component (#2685)
#2684 The problem is that the HTML tag completion takes priority over the ts completion and the TextEdit from HTML tag completion includes the whole dot notation. VSCode doesn't like it spans over the word span and filters it out.
fix: disambiguate `render` in module script (#2667)
call it $$render to ensure it's not going to clash with a username, and make it a exported name for better consistency
fix: support workspace symbol excludeLibrarySymbols config in ts-plugin (#2674)
fix: take other snippets into account when checking for hoistability (#2668)
Closes #2664
fix: don't hoist types referencing stores or destructured variables (#2661)
#2659
#2660
fix: Update prettier-options-schema.json (#2658)
sync with `options.ts` in sveltejs/prettier-plugin-svelte
fixes #2657
fix: move snippets to correct place when only module script present
#2640
fix: safely access Svelte config during startup
#2656
fix: better hoistability analysis (#2655)
Instead of collecting the types/values that are allowed, we collect the types/values that are _disallowed_ - this makes it possible to reference global values/types and still have them properly be declared as hoistable
#2640
feat: Semantic document highlight (#1408)
* ts, html, css
* WIP
* fast forward
* general svelte blocks and tag
* only same file highlights
* else highlights for if block
* await block
* highlight in style attribute
* exclude unsupported
* don't filter out highlights if original is not in it
function and class highlght its name
* config
* ts, html and css test
* svelte test
* format
* merge two utils files
* revert unnecessary changes
* single config, mark as experimental
* move the svelte highlight to ts using ast returned by svelte2tsx
* config description
* word based highlight for unsupported languages
* format
* ignore for svelte 5
* fix svelte 5 issues. workaround the await block issue and fixing it separately
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* prevent word-base fallback
* fix nested if, if block without else if
* remove experimental
keep the config so people can still go back to the word base highlight
* fix svelte 4 again
* fix
* Update packages/language-server/src/plugins/PluginHost.ts
* fix the fix
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
feat: support `generics` attribute for JSDoc (#2624)
#2618
feat: TypeScript 5.7 support (#2585)
* feat: typescript 5.7 support
* bumps to stable
* update svelte 5 snapshot
chore: run Svelte 5 tests in loose parser mode (#2652)
can help catch regressions in that area
fix: reword plugin modal options (#2646) (#2647)
In accordance with VS Code style guidelines + shorter so you can see the source
Fixes #2646
fix: correct the selection range of the last import that doesn't have a semicolon (#2651)
fix: README typo (#2645)
"run a commands" → "run a command"
feat: make use of loose Svelte parser and provide better intellisense (#2631)
This adds support for the Svelte parser with its new loose mode (https://github.com/sveltejs/svelte/pull/14691) and adjusts code paths to make use of it properly. As a result, intellisense should be a lot more useful in situations where code is in the middle of being typed and the Svelte file is in a broken state.
fix: no autocompletion when in block name
chore: tweak completions (#2630)
- In Svelte 5, prefer `onclick` over `on:click` suggestions
- Ignore completions in more Text positions
- Only prefer runes/components in the script tag and in opening tags; should give more accurate completions in the template (as part of this I refactered the compiler usage a bit; it's reusable/shared between documents now)
chore: fix tests for Svelte 5 (#2626)
fix: don't patch solution project in ts plugin (#2617)
part of #2612
fix: support `each` without `as` (#2615)
fix: make sure snapshots are shared per ProjectService (#2614)
The ProjectService contains snapshots. Multiple TypeScript plugins may be instantiated for one projectservice. Ensure we share our internal Svelte snapshots between those instances.
#2602
fix: ensure imports without semicolon doesn't break intellisense (#2610)
...by adding a generated semicolon at the end. That prevents TypeScript from going up until the next semicolon it finds, which may be from another generated code, messing up the generated->original end position
#2608
#2607
chore: update tests
chore: pin TS to 5.6 for now
until we properly investigated supporting it
fix: ensure organize imports doesn't mess with generated $$Component type
#2594
fix: preserve `bind:...` mapping on elements for better source maps
else an error like "X is not assignable to bind:Y" is shown on the previous attribute, if there is one
feat: support `bind:value={get, set}`
Companion to https://github.com/sveltejs/svelte/pull/14307
chore: bump prettier-plugin-svelte
feat: hoist snippets to module context if possible (#2601)
https://github.com/sveltejs/svelte/issues/10350
chore: consolidate template walking logic (#2600)
right now some of the logic of walking the template is within the svelte2tsx part, some in the htmlxtojsx part. This makes it hard to decide where to put new stuff and represents an arbitrary barrier for features that may need to work across both.
This PR therefore moves all the logic from the svelte2tsx part into the htmlxtojsx part.
feat: support `<svelte:html>` (#2599)
feat: support `<svelte:bounday>` (#2598)
companion to https://github.com/sveltejs/svelte/pull/14211
test skipped while feature is not merged yet
fix: ensure hoisted interfaces are moved after hoisted imports (#2597)
#2594
As a drive-by, I also ensures that the dts generation knows about the hoisted interfaces so it does not transform them into types anymore
fix: don't move appended content from previous node while hoisting interface (#2596)
#2592
fix: use original file path casing for shim files (#2591)
#2584
Use original casing here: people could have their VS Code extensions in a case insensitive folder but their project in a case sensitive one; and if we copy the shims into the case sensitive part it would break when canonicalizing it.
fix: detect shadowed variables/types during type hoisting (#2590)
#2589
fix: hoist types related to `$props` rune if possible (#2571)
This allows TypeScript to resolve the type more easily, especialy when in dts mode. The advantage is that now the type would be preserved as written, whereas without it the type would be inlined/infered, i.e. the interface that declares the props would not be kept
fix: robustify and fix file writing
- throw an error if writing didn't work (ts doesn't throw itself)
- fix html path logic
#2584
perf: check for and return promise instead of awaiting (#2586)
There are some checks in `SvelteDocument` where we do the work once in case it hasn't started yet. But we're potentially doing the work more often than necessary, because we're awaiting the result before assigning it to the "chache" and returning it. That way, if another request would come in while the promise isn't resolve yet, we would kick off another needless compile. This fixes that by assigning the promise to the "cache" instead.
fix: fall back to `any` instead of `unknown` for untyped `$props` (#2582)
The idea was to be conservative about it, but this causes problems for people not wanting strict type checking but only a basic form of it. Falling back to `any` is the more pragmatic choice
#2556
fix: use user's Svelte parser when formatting if necessary (#2578)
This makes formatting "just work" if users use Svelte 5 but don't have prettier (and the plugin) installed in their workspace
Depends on https://github.com/sveltejs/prettier-plugin-svelte/pull/471
#2542
fix: adjust generated `+layout.svelte` file contents (#2580)
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
chore: update Svelte documentation links for template syntax (#2579)
fix: infer types for `$bindable`, infer function type from arrow function
#2577
fix: make it possible to disable runes/legacy mode code lens
fix: ensure code lenses from different sources are merged
chore: run CI with node 20 (#2574)
openvsx currently fails on deploy because it requires it
fix: move globrex to dependencies (#2576)
fix: keep `linkedEditing` working when tag name contains `.` (#2570)
#2569
Since Svelte 5, dots are allowed and indicate a component name
fix: ignore exported variable declarations that aren't simple identifiers
While this wouldn't surface invalid exports, it more importantly doesn't have false positives anymore
#2566
fix: copy global types into hidden folder in IDE contexts (#2561)
Since the global types now reference `svelte/...` imports, they need to be placed in the same context the users' Svelte package lives in. Else these imports would load the types of the Svelte version that comes bundled with the IDE.
#2493
(side note: we had this problem before in #2109 when loading `svelte/elements`, but that solution is not applicable here)
fix: prevent false-positive auto completions on Svelte components (#2564)
Because Svelte components take precedence, we leave out commit characters to not auto complete in weird places (e.g. when you have `foo.filter(a => a)`) and get autocomplete for component A, then a commit character of `.` would auto import the component which is not what we want
Found after merging #2545 and playing around with it a bit
fix: take complex/mapped typed into account during prop completions (#2563)
#2549
fix: infer object and array shapes from fallback types (#2562)
#2556
feat: support typescript 5.6 (#2545)
* feat: support typescript 5.6
* fix build
* autoImportSpecifierExcludeRegexes and organizeImports preference
* what
* bumps typescript-auto-import-cache
* missed one
* use commit characters from typescript when possible
* format
* bump language server dep
feat: add runes mode indicator (#2554)
adds a runes mode indicator atop of the file via a code lens. Will show "runes mode" if the components is in that mode, "legacy mode" if not, and nothing if it's not Svelte 5
#2418
fix: properly highlight svelte 5 <component.dot.notation /> (#2552)
#2525
feat: provide component instance type in Svelte 5 (#2553)
While it's a gotcha for people declaring their own types, the vast majority of people will use component types via importing other components, and as such it makes sense to provide the same convenience we know from class components
#2522
feat(svelte2tsx): autotype `const load = ...` declarations (#2540)
fix: migrate glob file watch for chokidar v4 (#2551)
#2539
chokidar v4 removes all glob support. This migrates fallback watcher and CSS global var to use the ignored config
fix: add Sveltekit snippets for Svelte 5 (#2548)
---------
Co-authored-by: Alexandre Oger <alexandre.oger@fabernovel.ey.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: correctly position quick fixes in instance and module (#2531)
closes #2529
feat: provide Svelte 5 component migration command
fix: include named exports in svelte 5 type (#2528)
fixes sveltejs/svelte#13508
fix: relax component constructor type (#2524)
Since , we're no longer adding the `[evt: string]: CustomEvent<any>` index signature to components in runes mode not using `createEventDispatcher`. This revealed a type bug in our `ATypedSvelteComponent` type. It was to restricting, because TypeScript will resolve the empty event object to a handler with callback type `never`, which then means the `__sveltets_2_ensureComponent` generic no longer picks the right type, resulting in generics not being resolved properly. Fix this by relaxing the constraints.
Fixes #2523
chore: upgrade to chokidar 4 (#2502)
Also remove long-obsolete sapper handling
fix: check project files update more aggressively before assigning service (#2518)
#2516
Most of the time, the didOpen request is earlier than the watcher event. So if the file doesn't exist in the GlobalSnapshotManager we manually invoke the project file update check. This won't cause 2 project files check because if the file already is a project file we won't check project files.
breaking(svelte5): only generate function component shape in runes mode (#2517)
When a component is in runes mode and not using slots or events, adjust the output to only create the function type that mimics the underlying real shape of components in Svelte 5. This is a breaking change because previously the type was enhanced such that it also had the legacy class shape. As a result, users now may need to switch to `typeof Component` when using the component inside types.
Sadly, due to a combination of requirements and TypeScript limitations, we need to always create both a legacy class component and function component type.
- Constraints: Need to support Svelte 4 class component types, therefore we need to use __sveltets_2_ensureComponent to transform function components to classes
- Limitations: TypeScript is not able to preserve generics during said transformation (i.e. there's no way to express keeping the generic etc)
TODO Svelte 6/7: Switch this around and not use new Component in svelte2tsx anymore, which means we can remove the legacy class component. We need something like _ensureFnComponent then.
perf: auto import cache for svelte-kit language service proxy (#2513)
#2464
getPackageJsonsVisibleToFile and getGlobalTypingsCacheLocation are singleton so this should definitely be fine. The proxy language service has the exact list of entry files and the auto-typing also doesn't add any export so it should be fine to just proxy these methods.
fix: revert additional two-way-binding checks (#2508)
This reverts commit 8c080cf36286984439b468e089e6e4eaacd4230e.
This reverts #2477. Sadly, the idea didn't work out, as shown by two opened bug reports:
- #2506: A type union can be narrowed on the input, but not on the way back out
- #2494: A generic nested within a bound value is not properly resolved and not falling back to `any` (in #2477 we thought of the generic case, but only for when the generic is the whole value type, not when it's nested)
For these reasons I don't see a way to properly implement #1392 at the moment.
chore: revert accidental commit
fix: make no Svelte files found a warning (#2507)
There were reports that this was too overzealous as some people use this potentially not knowing whether or not this is a Svelte-projects, too. Therefore only issue a warning instead of an error.
fix: include files indirectly belonging to a project into correct project (#2488)
Fixes #2486
Fixes #2485
fix: silence type error in old d.ts files
svelte-jsx and svelte-shims are used for Svelte 3 only, and are likely out of date, yet we don't want to invest time into adjusting them anymore, therefore silence any type errors in it.
Helps with #2498
fix: update SvelteKit trailingSlash types (#2496)
fix: add constraint to inference
Else the type is not properly resolved sometimes
Fixes a type issue with Threlte
fix: remove process declaration
Likely added during ancient times for Svelte Native. It now gets in the way, and SvelteNative folks can add a declaration themselves if they need to
Fixes #2483
chore: add homepage/repository fields
chore: show more error diagnostics for emitDts
closes #2371
fix: detect `<script module>` tag (#2482)
This was missing in #2473
Possibly related to sveltejs/svelte#13039
feat: allow autoImportFileExcludePatterns to ignore files outside the root (#2480)
part of #2479
fix: Svelte module resolution tweaks (#2481)
Svelte files are now resolved by intercepting checks for .d.svelte.ts instead of .svelte.ts. As a consequence, we can handle sibling foo.svelte / foo.svelte.ts files and importing both. When doing import Foo from './foo.svelte this now resolves to the Svelte file (prio to #2463 it would resovle to the .svelte.ts file), and doing import Foo from './foo.svelte.js will resolve to the TS file.
feat: better type checking for bindings in Svelte 5 (#2477)
#1392
This adds enhanced type checking for bindings in Svelte 5: We're not only passing the variable in, we're also assigning the value of the component property back to the variable. That way, we can catch type errors like the child binding having a wider type as the input we give it.
It's done for Svelte 5 only because it's a) easier there b) doesn't break as much code (people who upgrade can then also upgrade the types, or use type assertions in the template, which is only possible in Svelte 5).
There's one limitation: Because of how the transformation works, we cannot infer generics. In other words, we will not catch type errors for bindings that rely on a generic type. The combination of generics + bindings is probably rare enough that this is okay, and we can revisit this later to try to find a way to make it work, if it comes up.
Also note that this does not affect DOM element bindings like <input bind:value={...} />, this is only about component bindings.
chore: bump magic-string (#2476)
requires adjustments of mapping tests and a fix in the InlayHintProvider, because more things are mappable now
fix: add server bin to package exports
breaking: vs code / language-server major (#2475)
- use Svelte 4 as built-in version now
- add exports map
- bump vs code ls/client version to 9
- require Node 18 / VS Code 1.82 minimum
- drive-by fix of __sveltets_2_ensureComponent (the previous version didn't work after all)
fix: check error length
breaking: project reference support (#2463)
- closes #2148
- fixes #1234 - due to the change of how files are resolved (breaking change)
- fixes #1976 - less options are now forced (breaking change)
- fixes #2154 (breaking change)
breaking: svelte-check v4 (#2453)
- breaking: make TypeScript a peer dependency
- breaking: require node 18 or later
- breaking: require Svelte 4 or later (devDependencies pinned to Svelte 3 because other packages in this repo still use it. Theoretically we still support Svelte 3 with svelte-check v4 but this gives us the opportunity to adjust that later without a major)
- chore: switch from fast-glob to fdir (#2433)
closes #2397
fixes #2364
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
fix: support module script attribute (#2473)
fixes #2472
chore: publish package provenance info (#2469)
According to https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow
closes #2461
chore: fix test
feat: support specifying tsconfig for emitDts (#2454)
part of #2355
feat: replace svelte-preprocess with barebones TS preprocessor (#2452)
Removes the need for a dependency on svelte-preprocess in svelte-language-server, since that was all we used it for.
closes:
- #1683 and #1259, because the situation no longer arises (because we no longer have svelte-preprocess inside the VS Code extension)
- #2391
typo fix in DisagnosticsProvider (#2468)
Co-authored-by: Eric Muckley <22535087+ericmuckley@users.noreply.github.com>
fix: add legacy methods to own component shape (#2451)
see https://github.com/sveltejs/svelte/pull/12666 for why we need this
fix: normalize paths in emitDts map
bug introduced in #2443, affecting windows systems
feat: reference/implementation codelens (#2378)
#2130 Porting VSCode's implementation/reference code lens. This is not enabled by default. To enable this, you'll need to enable the typescript.implementationsCodeLens.enabled config or the typescript.referencesCodeLens.enabled config for lang="ts" and javascript.referencesCodeLens.enabled for js components. Note that we reuse config for ts/js files so it'll also enable the feature in ts/js files.
fix: correctly handle HTML between implicit snippet props (#2450)
The transformation util was wrong: It did not stop moving content between transformations that were after the end marker
#2441
docs: mention `vitePreprocess` (#2440)
fix: various snippet fixes (#2449)
#2444 #2417 #2425 #2385 (comment)
The snippet is now transformed into a function with the return type so that The default parameter type can be inferred:
`const foo = (a: string, b = 1): ReturnType<import('svelte').Snippet> => {}`
fix: map refactor/quick-fix of svelte files in typescript plugin (#2439)
#2435
fix: correctly detect real Svelte files for declarationMap (#2443)
#2442
chore: better "cannot use `bind:`" error message (#2429)
feat: warn on likely failed d.ts file generation (#2428)
emitDts now warns when it detects diagnostics that likely mean the `d.ts` file was not generated
fix: no implicit children prop when using slot (#2427)
Using a slot tag means we're in a legacy component, which means we shouldn't pass the children prop implicitly
fixes https://github.com/sveltejs/svelte/issues/12240
chore: bump html/css language service (#2424)
#2224 #2265 #2390
fix: always set bindings/exports in Svelte 5 (#2423)
Those two methods are needed in Svelte 5, but we don't always set them. That was fine until TS 5.5, which infers generics slightly differently and turns `Exports` and `Bindings` to `never` if they don't show up in the input (before they were not)
fix: detect root snippets correctly
previously snippets inside top level if blocks etc where wrongfully detected as being a root snippet
fix: handle issues with svelte file watching (#2421)
Fix the neovim file-watching issue mentioned in Discord by checking if a directory actually exists before watching it.
Also fixes #2419 through several measures:
- don't close a document when it was changed
- fix the retrieval of the document (pathToUrl) was missing
fix: prevent false positive store declarations (#2422)
variable declarations not at the top level can't be subscribed to using the `$` prefix
fix: more robust start tag detection
make sure we do the cheaper component/element autocompletion lookup in more cases
#2394
chore: upgrade to TS 5.5 (#2415)
fix: handle optional args in snippets (#2414)
#2406
fix: watch svelte files and project files outside workspace (#2299)
#2233 #2393
update project files(tsconfig.include) when a new client file is opened. So files included in both tsocnfig.json will be loaded into the respecting language service.
fix: snippets with TS incorrect transformation (#2412)
After sveltejs/svelte#12070 the AST for the SnippetBlock has changed (to be more correct).
The problem is that svelte2tsx was using that wrong information for the transformation. This means that currently last version of svelte produces wrong ts code from svelte2tsx.
chore: remove import-fresh dependency (#2413)
No dependency inside svelte-check uses it anymore. If it creeps back in check if the dependency uses a version that fixed https://github.com/sindresorhus/import-fresh/issues/18
chore: move fast-glob to devDependencies (#2400)
Was always bundled, no need to have in dependencies
fix: support more types of component type defintion in completion (#2407)
* fix: support more types of component type definition
* ts-ignore Component import
* format
fix: adjust ambient module snipping logic
Since https://github.com/sveltejs/svelte/pull/12061 the `declare module "*.svelte" {..}` declaration contains more closing braces and the logic to snip it out is now outdated. This updates the logic to instead look for the first bracket that comes directly after one line.
chore: adjust test snapshot for latest svelte 5 (#2402)
chore: upgrade to pnpm 9 (#2398)
chore: update github workflows (#2399)
chore: speed up regex
#2363
fix: typo in CSS service code (#2389)
fix: account for added code in the range of inlay hint (#2387)
feat: Svelte 5 component class/function interop (#2380)
Svelte 5 uses functions to define components under the hood. This should be represented in the types. We can't just switch to using functions though because d.ts files created from Svelte 4 libraries should still w…
sam-easygo
added a commit
to sam-easygo/language-tools
that referenced
this pull request
Aug 6, 2026
emitDts resolved every import with a bare ts.resolveModuleName call, so
nothing was cached across the program's files: each of the (typically
hundreds of) node_modules declaration files re-ran the full resolution
walk of open/stat/realpath syscalls for every import. Passing a
ts.createModuleResolutionCache makes resolution the cheap path. Each of
the two resolution hosts gets its own cache because they disagree about
whether virtual .svelte.ts paths exist.
Version Packages (#3086)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chore: tweak changeset (#3087)
fix: support TypeScript 7 under npm alias (#3073)
* fix: support TypeScript 7 rc under npm alias
* also check name for native-preview
* tweak message
* fix merge problem
it's intentionally different so master still does allow npm alias
* update instruction to install stable version
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* replace typescript-7 alias with @typescript/native
* exclude v7 in peer
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Merge pull request #3085 from sveltejs/changeset-release/master
Version Packages
Version Packages
Merge pull request #3084 from sveltejs/fix-lock
fix: ensure config loading happens sequentially
docs: update internal deployment docs
Version Packages (#3077)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: zero-config `+error.svelte` props (#3076)
* feat: zero-config `+error.svelte` props
* Update .changeset/grumpy-rabbits-chew.md
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Version Packages (#3075)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: report tsconfig errors in --tsgo-experimental-api (#3070)
* fix: report tsconfig errors in --tsgo-experimental-api
* maybe just support both for now
might wanted to support typescript7.0rc later
* it's still wrong
fix: resolve tsgo bin path with package.json (#3074)
Version Packages (#3069)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix (svelte-check): `--tsgo-experimental-api` option is not honored (#3067)
* Fix tsgo-experimental-api option
* tweak changeset message format
Version Packages (#3059)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: svelte-check tsgo support with experimental api (#3036)
* wip
* flatten message, utf8 position
* cache api service, parser error
* migrate NoopsInReactiveStatements
* enable stableTypeOrdering so more error message is the same
* wire up to svelte-check
* bump @typescript/native-preview
* fix $$Props check
* wrong api, support svelteKit files
* various svelte-check integration fixes
* import priority fixes
* watch mode, fix non-project file resolution, node18
* fix more test, skip some
* remove unused import
* bumps @typescript/native-preview to fix ts-check issue
* add svelte-check test
* port $store diagnostics
* remove skip
accidentally revert a change
* no longer need the utf8 workaround
* Tweak message, rename flag
* changeset
fix(svelte-check): stop excluding workspaces under dot-prefixed ancestors (#3037)
findFiles() ran each directory through `filePath.includes('/.')` to
skip hidden directories. That predicate also fires on any ancestor of
the workspace whose name starts with a dot, so every descendant under
the workspace got pruned and no virtual `.svelte` files were emitted
into the `.svelte-check` cache. The behaviour is invisible in the
default check path but in `--incremental` / `--tsgo` mode it surfaces
as missing endpoint-handler annotations and spurious implicit-any
errors on `+server.ts` handlers.
The fix narrows the exclude predicate to the directory name fdir
passes as the first argument, so only the descendants whose own name
starts with `.` (or that equal `node_modules`) are dropped. Workspaces
under `.local/`, `.config/`, custom worktree directories, etc. now
crawl normally.
Fixes #3034
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
perf: remove lodash (#3038)
* perf: remove lodash
* fix: missing params
* fix: correct defu usage
* tests: add extra
* fix: 🤦♀️
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: enable passing Svelte config file paths (#3066)
vite.config or svelte.config
Closes #3055
Fixes #3054 (by providing you the possiblity to set this file and turn off file crawling that way)
Also added a TODO for the next major: We should not recursively crawl for config files anymore if we find one in the root directory or next to the tsconfig.
fix: load esm version of Vite (#3065)
cjs version will be gone at some point, and it prints a warning already
fix(svelte2tsx): don't crash on array binding holes in destructured exports (#3058)
An array binding hole (`export let { d: [a, , c] } = obj`) is an
`OmittedExpression` with no `name`, so `addExportForBindingPattern` called
`ts.isIdentifier(undefined)` and threw
`TypeError: Cannot read properties of undefined (reading 'kind')`. Skip holes.
build: bump mocha to v11.7.6 (#3042)
mocha 9.2.0 does not work with nodejs v26.2.0
Merge pull request #3051 from ghostdevv/lint
chore: fix lint
chore: fix lint
fix: build load-config before language-server
* fix: build load-config before language-server
* refactor: make language-server dependency build robust
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
fix: add repository url to package.json (#3048)
Version Packages (#3040)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: adjust rollup config (#3047)
fix: adjust paths in PKG.json (#3046)
* fix: adjust paths in PKG.json
* Create ten-dolls-jam.md
chore: fix changeset (#3045)
feat: support reading Svelte config from vite.config.js/ts (#3031)
We're thinking about getting rid of `svelte.config.js` (or rather, soft-deprecating it): `vite.config.js/ts` is now pretty much the standard for new Svelte apps and generally a better place to put your config.
This is an important stepping stone towards that future. `svelte.config.js` was originally introduced for language-tools to read config options, now we can do the same by reading the Vite config.
With this PR, `vite.config.js` is read first / preferred if both exist, but if it does not exist or no options are retrieved through it then `svelte.config.js/ts` is used.
fix: mark optional members with a trailing ? in completion labels (#3043) (#3044)
Optional object/class members were shown in completions without the `?`
that the TypeScript language service (and vtsls) appends to their labels,
so `baz?: number` completed as `baz` instead of `baz?`.
TypeScript reports optional members via the `optional` kind modifier on
the completion entry. `getCompletionLabelAndInsert` ignored this modifier
and always used the bare name as the label. Detect the modifier and append
`?` to the label while keeping the inserted text as the bare name, so the
`?` is display-only and completion resolution (which keys off `data.name`)
is unaffected.
---------
Co-authored-by: MohammadYusif <MohammadYusif@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: don't show type inlay hint for component inside snippets (#3041)
fix: correct 'occured' typo in svelte:boundary onerror description (#3039)
* fix: correct 'occured' typo in svelte:boundary onerror description
* chore: add changeset for svelte:boundary onerror typo fix
Version Packages (#3018)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix(emitDts): drop declarations emitted outside declarationDir (#2965)
Adds a sample where a Svelte component imports a TypeScript module from
outside libRoot, triggering TypeScript to emit declarations outside the
configured declarationDir.
Also extends the test runner to detect and clean up any .d.ts files
written outside declarationDir, asserting that none are produced.
feat: support Svelte 5 declaration tags (#3033)
fix: take into account component references when calculating snippet hoistability (#3032)
Fixes #3020
fix: handle prop named "slot" inside Svelte 5 snippets (#3030)
Fixes #2992.
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: add support for svelte config ts/mts files (#3009)
* feat: add support for svelte config ts/mts files
* don't add flag when runtime setting exists
* missed some spots
* skip if strip-types isn't enabled
* more
---------
Co-authored-by: Lyu, Wei-Da <36730922+jasonlyu123@users.noreply.github.com>
Co-authored-by: Lyu, Wei Da <jason.lyu@supergeo.com.tw>
fix: tweak "show compiled" icon (#3019)
Fixes #3001. Closes #3002
fix: prevent > in expression affects HTML folding (#3029)
fixes #2537
fix: support prettier.useEditorConfig setting (#3026)
feat: support CSS completions in nested style tags (#3022)
* fix: support CSS completions in nested style tags
* refactor: use findNodeAt for nested style lookup
* document highlight, disable js completion in style
fix: use local name for marking bindable props used (#3017)
Version Packages (#3015)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: typescript 6.0 support (#2985)
* wip
* bumps
* another default change
* changeset
* format
* fix svelte2tsx build for now
* more svelte2tsx migrate
* add node to be explicit
* avoid svelteHTML.mapElementTag in perf test for now
* update svelte5 snapshot
* update svelte-check smoke test to bundler
* try fix flaky test
it might have run too fast
* move typescript to peer in language server
* another drive-by fix
shouldn't matter in most cases but still restore the original logic
* use 6.0.3
Version Packages (#2999)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: flush stdout/stderr before exit in svelte-check (#3014)
* fix(svelte-check): flush stdout/stderr before exit
`process.stdout.write` is asynchronous on non-TTY pipes, and per Node's docs `process.exit` does not wait for queued I/O. Under heavy diagnostic load (1000+ ERROR/WARNING lines, enough to saturate the kernel pipe buffer) the trailing `COMPLETED` summary of `--output machine-verbose` was dropped when the CLI exited, even though the run was clean.
Replace the bare `process.exit(N)` calls in both CLI completion paths (default and `useVirtualFiles`) with the canonical flush-then-exit pattern.
Add a regression test `test-flush.js` (`pnpm run test:flush`) that runs the CLI against a fixture emitting 1500 diagnostics, throttles the consumer to keep the pipe full, and asserts the last non-empty line matches `^\d+ COMPLETED` across 10 runs.
This is useful for testing this fix but I don't know if it's worth actually commiting it to the repo or not.
`test-flush.js` is AI generated and manually reviewed.
* tweak changeset
* Running the flush test manually should be enough
fix: report diagnostics in tsconfig.json (#3005)
* fix: report diagnostics in tsconfig.json
* split changeset
* normalize path to deduplicate
* report global and config diagnostics as warnings in normal svelte-check
warning for now to avoid breaking change
---------
fix: prevent incorrect $types imports being injected in update import (#3010)
* fix ./$types imports
* formatting
* changeset
* remove log
* add test
* other regex
* separate tests
fix: properly place svelte-ignore comment in quickfix when `<script module>` presents (#3011)
* fix: svelte-ignore quickfix action could be improperly placed if a component contained a `<script module>` block
* rm
* changeset 2
* tweak changeset
---------
fix: prevent duplicate diagnostics (#3000)
fix: hoist self-referenced props interface (#2998)
fix #2935
Version Packages (#2977)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: support js/ts config section in VSCode (#2996)
feat: add command to show compiled CSS in preview window (#2993)
* feat: add command to show compiled CSS in preview window
add caching to switch between compiled code and CSS previews, and handle null response for compiled CSS output in both previews
* feat: add SVG icons for compiled CSS preview in light and dark modes
fix: prevent config loading message in svelte-check --incremental (#2974)
* fix: prevent config loading message in svelte-check --incremental
* one more
* load by default
* skip some config loading in test
fix: resolve svelte files under NodeNext (#2990)
* fix: resolve svelte files under --tsgo + NodeNext
* old ts too
* actually incremental in old ts doesn't work either
* unused jsdoc
* bump manifest version
use e18e recommendation (#2986)
fix: typescript 6.0 compatibility (#2988)
* fix: typescript 6.0 compatibility
* tweak
fix: ts-ignore for Svelte 4/5 type differences
feat: pull diagnostics support (#2978)
This switches the diagnostics from push model (server to client) to the pull model when the client supports it. The advantage is that the client can prioritise sending the diagnostic request for the visible tab. With this, we can check the document split to the side immediately and don't need to check all open files after a file save. The pull mode has a way to tell the client that the diagnostics haven't changed. I implement this mostly because VSCode sends another diagnostic request for the same files when switching files in the editor, even if the file isn't changed.
I also lowered the debounce delay in the push-mode diagnostics. I've been wondering if some of the performance complaints are actually just because the artificial delay is too long for some people. The pull mode also has a much lower artificial delay. I think we can give it a try. If people are complaining about it, we can switch to an approach similar to the "smart" mode.
chore(deps): replace vscode-tmgrammar-test with textmate-grammar-test (#2976)
* add textmate-grammar-test
* update snap files
new:
- file headers
- line break tokenization
* update readme
* update to 0.6.0
a minor format change
fix: prevent error with escape sequence in attribute (#2968)
Fixes #2964
fix: accomodate for dynamic compile options
https://github.com/sveltejs/svelte/pull/17801 introduced dynamic compile options; had to adjust one occurence as a result
fix: pluginHost low/smart null check (#2979)
perf: micro-optimizations in hot paths (#2960)
* perf: micro-optimizations in hot paths for faster completions and diagnostics
Replace O(n²) flatten() with Array.prototype.flat(), remove lodash flatten
dependency from PluginHost, use Object.create instead of object spread in
svelteNodeAt AST walking, cache getExistingImports per document, use
RegExp.test() over .match(), replace regex with charCode check in
possiblyComponent, use cached line offsets for lineCount, and optimize
iteration in SnapshotManager.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in PluginHost.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Create big-clocks-care.md
* fix: prettier formatting in changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* address pr feedback: remove flatten util, use charCodeAt, fix code style
- Replace all flatten() call sites with .flat()/.flatMap() and remove
the flatten utility function entirely
- Use charCodeAt(0) directly in possiblyComponent instead of char comparison
- Use block syntax for single-line for loops in SnapshotManager
- Remove ineffective existingImportsCache from CompletionProvider
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
perf: enable incremental TypeScript reparsing via getChangeRange (#2961)
* perf: enable incremental TypeScript reparsing via getChangeRange
Previously, both SvelteDocumentSnapshot and JSOrTSDocumentSnapshot
returned undefined from getChangeRange(), forcing TypeScript to do a
full reparse on every snapshot update. This adds a computeChangeRange()
function that scans for the minimal diff between old and new text,
enabling TS's incremental parser.
Benchmarks show 2-5x faster reparsing for structural edits and
near-instant reparsing for token-level edits (e.g. typing/renaming).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* add changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in benchmark file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* format changeset
* test: add realistic full-file tests for computeChangeRange
Adds tests using realistic svelte2tsx output (~150 lines with script,
store subscriptions, template, and component export) and a full
TypeScript service class (~200 lines with decorators, generics, and
multiple methods). Tests cover common edit patterns on these files
and verify that incremental TS reparsing produces correct ASTs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* trim tests and remove benchmark per review feedback
- Remove incremental-reparse-benchmark.ts (served its purpose)
- Trim DocumentSnapshot.test.ts from 152 to 31 tests, keeping only
essential coverage: basic operations, edge cases, reconstruction
invariant, snapshot integration, and in-place update tests
- Remove redundant/over-tested sections
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR review feedback for incremental reparsing
- JSOrTSDocumentSnapshot.update() returns new snapshot instead of mutating in-place
- SvelteDocumentSnapshot.getChangeRange returns undefined on scriptKind/parserError changes
- Trim tests to essential coverage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in test file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
perf: various optimization with ast walk (#2969)
Version Packages (#2971)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: use Promise<Response> for async kit handler return types (#2966)
* fix: use Promise<Response> return type for async kit handlers
When svelte-check adds type annotations to SvelteKit route handlers
(GET, POST, etc.), it was using `Response | Promise<Response>` as the
return type for all functions regardless of whether they were async.
TypeScript requires async functions to return `Promise<T>`, not
`T | Promise<T>` (TS1064). This caused false positives in
`--incremental` mode where tsc runs on the generated files directly.
The fix checks if the function has an async modifier and, if so,
extracts just the `Promise<Response>` part of the return type union.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: format sveltekit.ts with prettier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix async kit handler return types
Updated async kit handler return types to use Promise<Response>.
* style: format changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: use asyncReturnType parameter instead of string splitting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Version Packages (#2958)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: pass filename to `warningFilter` (#2959)
Fixes #2953
fix: more robust detection of `lang="ts"` attribute (#2957)
Fixes #2956
fix: resolve svelte files under path alias in `--incremental/tsgo` mode (#2955)
Fixes #2952
Version Packages (#2951)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: respect `@ts-ignore` etc comments within tags (#2950)
We now actually output comments into the svelte2tsx output so that stuff like `@ts-ignore` or `eslint-disable` works
Version Packages (#2949)
* Version Packages
* Fix formatting in CHANGELOG for JSDoc @satisfies
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: detect existing JSDoc @satisfies to prevent duplicate injection (#2946)
fix: include `references` in generated `tsconfig.json` in `--incremental/tsgo` mode
They're not inherited by the extends mechanism
Fixes #2948
fix: resolve shims correctly in `--incremental/tsgo` mode
They are places in the svelte-check directory, not inside svelte2tsx which is likely not available
Fixes #2947
fix: support toggle-comment-key in start tags
Use `//` instead of html comments in start tags now.
Requires setting up a new embedded language which only matches within start tags and is basically the svelte config only with the comment functionality changed.
Version Packages (#2945)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: support for comments in tags (#2944)
see https://github.com/sveltejs/svelte/pull/17671
Version Packages (#2940)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chore: remove outdated "experimental-modules" runtime flag (#2898)
* remove outdated runtime flag
* Create long-cups-lie.md
* format
* Delete .changeset/long-cups-lie.md
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: rewrite relative imports reaching outside root (#2942)
When using svelte-check's `--incremental/--tsgo` flags the files are written to a generated folder, making use of the rootDirs tsconfig feature. This has one limitation: when a relative import within a generated file reaches into a directory that is not covered by rootDirs, it cannot be resolved.
This therefore adds a new option to svelte2tsx to rewrite imports as part of the transformation. Note that this will not help with transforming files outside of the working directory, but when you e.g. import a regular TS/JS file that way it now works.
fix: extract style/script tag followed by destructuring in the template (#2921)
* fix: extract style/script tag followed by destructuring in the template
* tweak
* move back to utils
* tweak
* rewrite
* fix some case with attribute, revert getAttributeContext to using scanner
* tweak
* fix svelte-check build
* removed unused variable
* Update packages/language-server/test/lib/documents/parseHtml.test.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: support SvelteKit zero-types with svelte-check --incremental (#2939)
- add jsdoc-type variants for SvelteKit transform helpers
- use those helpers in svelte-check to transform files. Transformed files are written into the generated folder
- filter out diagnostics of original files which have a transformed sibling; sometimes those original files end up in the TS module graph
- remove unused map generation along the way and simplify/deduplicate a few things
Version Packages (#2929)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: add links to diagnostic error codes via codeDescription (#2936)
closes #2933
fix(svelte-check): ignore Unix domain sockets in file watcher (#2931)
svelte-check crashes when encountering Unix domain sockets (e.g., .sock files)
in watch mode because chokidar cannot watch these special files. This adds a
check to ignore sockets using stats.isSocket(), preventing the crash and
allowing svelte-check to continue operating normally.
chore: add changeset for unix socket fix
feat: svelte-check `--incremental` / `--tsgo` (#2932)
Adds two new flags:
- `--incremental`: Opts into TypeScript's incremental build cache, which speeds up subsequent runs. Saved within `.svelte-kit` or if not available within `.svelte-check`. This might result in slightly different type check outcomes, and certain patterns are not supported. Specifically, anything that is not in the root dir of your tsconfig.json and is a Svelte file will not be properly loaded and type-checked.
- `--tsgo`: Use TypeScript's Go implementation. Needs to have `@typescript/native-preview` installed. Subject to the same limitations as `--incremental`
Part of #2733
closes #2131
Huge kudos to https://github.com/astralhpi/svelte-fast-check and https://svelte-check-rs.vercel.app/ , both of which heavily inspired this PR
fix: properly use machine output by default for Claude Code
#2897
Version Packages (#2928)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: apply text synchronize change in order (#2927)
Version Packages (#2919)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: compatibility with prettier-plugin-tailwindcss in monorepo (#2925)
fix: don't hoist type/snippet referencing $store (#2926)
* fix: don't hoist type/snippet referencing $store
* svelte-check changeset
perf: only parse html once in a batch update (#2923)
fix: remove outdated documentation with --ignore (#2920)
feat: support emmet.extensionsPath config (#2918)
feat: Use custom element's JSDoc as doc for completion/hover (#2879)
* ✨ Use custom element's JSDoc as doc for completion
With support for markdown
* ✨ Use custom element's JSDoc as doc for hover
With support for markdown
* ✏️ Typo in description of getNodeIfIsInTagName
* resolve one documentation at a time
* changeset
---------
Co-authored-by: Lyu, Wei Da <jason.lyu@supergeo.com.tw>
fix: add tokenTypes config for JSDoc completion (#2916)
Version Packages (#2896)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
perf: only create objects for completion items for svelte syntax once (#2900)
* only create objects for completion items for svelte syntax once
* Optimize completion items handling for Svelte syntax
* format
fix(syntax): sveltejs ts highlighting when trailing type alias misses semicolon (#2905)
* fix(syntax): svelte ts highlighting when trailing type alias misses semicolon
* test: add fixtures
* fix: allows empty single script tag
* fix style lang=ts
fix: add some limit to store auto-import (#2909)
perf: optimize path normalization (#2907)
perf: avoid global completion in component start tag (#2904)
chore: skip document symbols timeout in test (#2903)
perf: optimize module resolution cache invalidation check (#2902)
* perf: only check for module cache invalidation when there are new files
* another one
[perf]: early return in getCompletions if in style or script tag (#2899)
* early return in getCompletions if in style or script tag
* Create big-cheetahs-admire.md
* format
fix: ensure await-block type is preserved in the latest Svelte version (#2895)
fix: skipLibCheck in svelte-check smoke test (#2893)
Version Packages (#2869)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: support experimental feature in "Show compiled Code" (#2884)
#2857
feat: quick fix for adding lang="ts" (#2882)
#2876
feat: support hierarchical document symbols (#2817)
Closes #1519
Return hierarchical DocumentSymbol, useful for breadcrumb feature in various clients.
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
chore: turn changeset into patch
a minor would be like a major for language-server since we're in 0.x range
feat: use machine format when run by Claude Code (#2870)
* feat: use machine format when run by Claude Code
Fixes #2868
Co-Authored-By: Claude <noreply@anthropic.com>
* Change commit type from feat to chore
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: use moustache for svelte5 onhandler completion (#2883)
chore: slight optimize
forgot to reuse the variable
fix: treat a script tag as top-level if it's the first tag in file (#2886)
docs: update command for setting up TailwindCSS (#2880)
Remove deprecated svelte-add and change it to sv add
feat: implement 'source.removeUnusedImports' code action (#2875)
* feat: implement 'source.removeUnusedImports' code action
* add source action kind to server capability; revert code action removal
* add changeset
fix: restrict emmet completion with emmet specific triggerCharacter (#2873)
* wip
* test
* changeset
* format
fix: support for @nativescript-community/svelte-native (#2867)
* fix: support for @nativescript-community/svelte-native
We moved the svelte-native plugin to @nativescript-community.
This supports it while still supporting the old package
* Add changeset for svelte-language-server patch
Add a changeset for patching svelte-language-server.
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Version Packages (#2861)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: allow `undefined` and `null` values for `#each` in Svelte 5 (#2863)
* fix: allow `undefined` and `null` values for `#each` in Svelte 5
* switch
fix: prevent file watcher issue (#2859)
* fix: prevent file watcher issue
* perf: check if file content changed in tsconfig file watch
chore: fix svelte-check build
Version Packages (#2848)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
perf: rework snapshot hot paths (#2852)
* perf: rework snapshot hot paths
**`fromNonSveltePath`**
This function was originally using `replace` to unix-ify paths before
then testing against them with `endsWith`.
We can instead use static patterns on the unaltered path regardless of
separator.
**`getLastPartOfPath`**
This now uses `slice` on the last separator rather than splitting only
to retrieve the last part.
* perf: avoid garbage collection on diagnostics
Reverts the `getKey` change and updates diagnostics iteration to avoid
allocating an array we later discard.
* Tweak snapshot hot paths for performance
* chore: make linter happy
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
perf: use failed path to invalidate module cache (#2853)
* perf: use failed path to invalidate module cache
* Don't emit both document events in open
This makes the test do extra work after everything is done and creates weird race conditions, which I have already tried to fix many times
* changeset
* remove unnecessary Array.from
fix(svelte2tsx): support for runes={false} in svelte:options (#2847)
Description
The <svelte:options runes/> were not checking for the value, so it was always true. When using <svelte:options runes={false}/> the props exported were Record<string, never> which is incorrect.
Related issues
Fixes #2843
---------
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
(deps) Replace `pascal-case` with `scule` (Maintained & Lighter) (#2842)
* (deps) Replace pascal-case with change-case (Maintained & Lighter)
* add changeset
chore: set vscode package to private
because it's not a real npm pkg
chore: fix release script
Version Packages (#2846)
* Version Packages
* Update packages/svelte2tsx/CHANGELOG.md
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
chore: add missing changeset formatting package
chore: fix branch name trigger
fix: respect moduleResolution setting in emitDts (#2845)
see #2837 for more info
---------
Co-authored-by: Mattias Granlund <mtsgrd@gmail.com>
chore: bump package versions to latest
so changesets knows where to start from. also removes vscode from the list of packages to create changesets for
chore: setup changesets + oidc (#2844)
- setup changesets: all packages are now released through changesets, only the extension is released via tag as before
- remove pkg deploy flows in favor of one
- that flow will use oidc, so no npm token anymore
- also harden the workflows
fix: respect tsconfig/jsconfig exclude patterns in file watcher (#2807)
* fix: respect tsconfig exclude patterns in file watcher
- Add getProjectConfig() to language server to expose parsed tsconfig
- Process wildcard directories in svelte-check to determine watch paths
- Support both recursive and non-recursive directory watching based on TypeScript's configuration
- Handle relative paths correctly for directories outside workspace
This ensures svelte-check only watches directories included by the tsconfig, improving performance and avoiding unnecessary file watching.
* refactor: separate watcher updates from diagnostics scheduling
* prettier fix
* fix: discover missed watch directories with snapshots
* refactor(check): clarify snapshot callback and simplify directory watching; ignore .crush
* fix: order-of-operations for diagnostics and watch directories
* fix: update watch directories before initial diagnostics
---------
fix: builtin custom elements check when transforming attributes (#2824)
* Fix builtin custom elements check when transforming attributes
* Fix lint issue
chore: add CONTRIBUTING.md (#2816)
* chore: add CONTRIBUTING.md
* fix: lint-fix CONTRIBUTING.md
* slim down, deduplicate
* lint
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
fix: Update +error.svelte creation template in vscode extension (#2811)
* Update +error.svelte creation syntax (#2810)
* Add Svelte 5 variants to +error.svelte creation syntax template (#2810)
* Change withRunes to withProps in +error.svelte template
* Add withAppState option
* Change withRunes to withAppState in +error.svelte template
* Remove trailing comma
* Add type for withAppState
Revert "feat: support `<svelte:html>` (#2599)" (#2826)
This reverts commit cd1758b16f4cb6b176980b2c868efa3c98d30343.
chore: bump to typescript 5.9 (#2808)
* chore: bump to typescript 5.9
* typescript-plugin also needs support for the new parameters
fix: prevent organize imports from removing snippet (#2809)
* wip
* test, fix leftover indent
fix: handle object literal in MustacheTag (#2805)
fix: Better detection version (#2801)
* step 1 of version
* start managing things
* adding semver to test
* let's not redo semver!
* better fallback
* not only this ;)
* Update version.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: add `await` support (#2799)
For the new Svelte 5 "await at the top level / in template" feature
feat: add `xxxProps` support to VS Code snippets (#2796)
fixes: #2782
fix: strip doctype using AST instead of regex (#2798)
#2791
chore: make human output more concise and readable (#2748)
* style(svelte-check): make human output more concise and readable
* Update packages/svelte-check/src/writers.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: zero types for `params` (#2795)
Companion to #13999
docs: use svelte 5 syntax in readme (#2785)
Co-authored-by: tijn <tijnjh@proton.me>
fix: enable fallback watcher when dynamicRegistration is false (#2783)
fix: support "Build-Free Editing with Project References" in SvelteKit page.ts files (#2788)
feat: workspace symbols support (#2769)
#2375.
Adding support in the Svelte language server so that you don't need to open ts/js files to use this feature. You can trigger this feature with Ctrl + T and search for symbol names. Some of the handling is also synced to the typescript-plugin so that it's more consistent, which also means vscode can better deduplicate the results from both tsserver and Svelte language server.
fix: invalidate project file cache and handle watcher race condition (#2779)
#2773
This delays the file reading in svelte-check --watch until we're sure the new file is a project file. I still added a file existence check before reading, but it might be more of a fail-safe because the chance of it being deleted at this point is much smaller.
While checking this, I also found that the new file watch is broken because it now caches the tsconfig parsing result. So I changed the "read the config again" logic to the one language server used to invalidate the project files cache.
fix: key block can have its own block scope (#2768)
#2762
fix: don't treat derived imported from svelte/store as a potential store (#2780)
#2772
fix: prevent error with `bind:this={get, set}` (#2781)
This transform bind:this={get, set} with a similar method as bind:this={ele}, but by invoking the set function. The get function is ignored.
perf: bail on giant export maps when initializing auto import cache
implemented within typescript-auto-import-cache dependency
chore: remove "Run tests with debugger" task. (#2764)
feat: support generics on snippets (#2761)
* feat: support generics on snippets
* chore: remove log
* adjust grammar (holy shit that was fucked up)
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
fix: deduplicate definition for rune-mode components (#2759)
Wrap it in ignore comments so they're filtered out
#2697
fix: more robust solution project check for ts < 5.7 in ts plugin (#2758)
#2756
The problem is that in TypeScript before 5.7, the project files were added later than plugin initialisation. Thus, the IsSolution method will always return true in any project using project references during plugin initialisation.
feat: support attachments (#2760)
sveltejs/svelte#15000
fix: invalidate module resolution when higher priority file is added (#2754)
part of #2738
fix: prevent error with unclosed tag followed by LF or end of file (#2750)
#2742
The reason that it happens to LF but not CRLF is that CRLF has two characters, so it doesn't touch the range of the start tag name, and therefore won't trigger the magic string error. This should also improve auto-import performance a bit because TypeScript only needs to compute auto-imports for Button and not a global auto-import.
fix: Move hoisted snippet to right after import (#2753)
#2653
chore: bump vscode-html/css-language-service (#2752)
* chore: bump vscode-html/css-language-service
* update test
feat: support "add missing imports on save" (#2744)
Fixes #2616
Adds the source action to addMissingImports, reusing the same quick fix action as "import all missing"
fix: ensure typed exports are marked as used (#2746)
#2717
fix: various hoistability check (#2740)
#2671 #2727
Added color CLI options (#2678)
* Added color CLI options
* add comment
---------
fix: don't provides quickfix to add async to the script tag (#2737)
fix: highlight one-character component (#2736)
fix: don't create new output channel after restart (#2722)
fix: don't highlight component as a parameter in the template (#2732)
chore: standardize author field (#2723)
feat: directive keyword autocomplete (#2707)
#2696
fix: ensure exports in runes mode are marked as used (#2719)
Ensure they are read as part of exporting the types
#2717
fix: prevent unused variable error for bindable (#2710)
#2268
fix: prevent extra bracket with import statement completion (#2713)
chore: bump to typescript 5.8 (#2704)
fix: highlight type annotation in `@const` tags
#2690
fix: handle booleanish popover (#2702)
`<div popover></div>` actually means `<div popover=""></div>`
#2688
perf: cache files during emitDts (#2701)
closes #2691
fix: correctly handle unclosed tags with same type tag inside (#2682)
fix: use referenced project's compiler option to get resolution mode (#2676)
#2673 Fixing the actual problem that makes the OP want this option. The problem is that the referenced project is a common js project which allows extensionless import. But when we used the wrong compiler option to check for the resolution mode. TypeScript thus used the ESM strategy to resolve the import.
fix: prevent error when the script tag is removed in nodenext projects (#2635)
* fix error when script tag is removed in node16/nodenext
* need to have syntax error
* two more cases tracked it in git so we can reenable it later
* cleanup
* patch update as well
* Mark it as clean first so at least it doesn't stuck in an old version even if lang="ts" is added back
* try finally instead
chore: bump vscode-html/css-language-service (#2677)
#2675 #2388. For svelte-check. The extension should already be shipping with these versions.
fix: properly transform `$props.id` when `$props` is assigned to `props` (#2694)
* fix: properly transform `$props.id` when `$props` is assigned to `props`
* chore: add comments
fix: don't show html tag completion with namespace component (#2685)
#2684 The problem is that the HTML tag completion takes priority over the ts completion and the TextEdit from HTML tag completion includes the whole dot notation. VSCode doesn't like it spans over the word span and filters it out.
fix: disambiguate `render` in module script (#2667)
call it $$render to ensure it's not going to clash with a username, and make it a exported name for better consistency
fix: support workspace symbol excludeLibrarySymbols config in ts-plugin (#2674)
fix: take other snippets into account when checking for hoistability (#2668)
Closes #2664
fix: don't hoist types referencing stores or destructured variables (#2661)
#2659
#2660
fix: Update prettier-options-schema.json (#2658)
sync with `options.ts` in sveltejs/prettier-plugin-svelte
fixes #2657
fix: move snippets to correct place when only module script present
#2640
fix: safely access Svelte config during startup
#2656
fix: better hoistability analysis (#2655)
Instead of collecting the types/values that are allowed, we collect the types/values that are _disallowed_ - this makes it possible to reference global values/types and still have them properly be declared as hoistable
#2640
feat: Semantic document highlight (#1408)
* ts, html, css
* WIP
* fast forward
* general svelte blocks and tag
* only same file highlights
* else highlights for if block
* await block
* highlight in style attribute
* exclude unsupported
* don't filter out highlights if original is not in it
function and class highlght its name
* config
* ts, html and css test
* svelte test
* format
* merge two utils files
* revert unnecessary changes
* single config, mark as experimental
* move the svelte highlight to ts using ast returned by svelte2tsx
* config description
* word based highlight for unsupported languages
* format
* ignore for svelte 5
* fix svelte 5 issues. workaround the await block issue and fixing it separately
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* prevent word-base fallback
* fix nested if, if block without else if
* remove experimental
keep the config so people can still go back to the word base highlight
* fix svelte 4 again
* fix
* Update packages/language-server/src/plugins/PluginHost.ts
* fix the fix
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
feat: support `generics` attribute for JSDoc (#2624)
#2618
feat: TypeScript 5.7 support (#2585)
* feat: typescript 5.7 support
* bumps to stable
* update svelte 5 snapshot
chore: run Svelte 5 tests in loose parser mode (#2652)
can help catch regressions in that area
fix: reword plugin modal options (#2646) (#2647)
In accordance with VS Code style guidelines + shorter so you can see the source
Fixes #2646
fix: correct the selection range of the last import that doesn't have a semicolon (#2651)
fix: README typo (#2645)
"run a commands" → "run a command"
feat: make use of loose Svelte parser and provide better intellisense (#2631)
This adds support for the Svelte parser with its new loose mode (https://github.com/sveltejs/svelte/pull/14691) and adjusts code paths to make use of it properly. As a result, intellisense should be a lot more useful in situations where code is in the middle of being typed and the Svelte file is in a broken state.
fix: no autocompletion when in block name
chore: tweak completions (#2630)
- In Svelte 5, prefer `onclick` over `on:click` suggestions
- Ignore completions in more Text positions
- Only prefer runes/components in the script tag and in opening tags; should give more accurate completions in the template (as part of this I refactered the compiler usage a bit; it's reusable/shared between documents now)
chore: fix tests for Svelte 5 (#2626)
fix: don't patch solution project in ts plugin (#2617)
part of #2612
fix: support `each` without `as` (#2615)
fix: make sure snapshots are shared per ProjectService (#2614)
The ProjectService contains snapshots. Multiple TypeScript plugins may be instantiated for one projectservice. Ensure we share our internal Svelte snapshots between those instances.
#2602
fix: ensure imports without semicolon doesn't break intellisense (#2610)
...by adding a generated semicolon at the end. That prevents TypeScript from going up until the next semicolon it finds, which may be from another generated code, messing up the generated->original end position
#2608
#2607
chore: update tests
chore: pin TS to 5.6 for now
until we properly investigated supporting it
fix: ensure organize imports doesn't mess with generated $$Component type
#2594
fix: preserve `bind:...` mapping on elements for better source maps
else an error like "X is not assignable to bind:Y" is shown on the previous attribute, if there is one
feat: support `bind:value={get, set}`
Companion to https://github.com/sveltejs/svelte/pull/14307
chore: bump prettier-plugin-svelte
feat: hoist snippets to module context if possible (#2601)
https://github.com/sveltejs/svelte/issues/10350
chore: consolidate template walking logic (#2600)
right now some of the logic of walking the template is within the svelte2tsx part, some in the htmlxtojsx part. This makes it hard to decide where to put new stuff and represents an arbitrary barrier for features that may need to work across both.
This PR therefore moves all the logic from the svelte2tsx part into the htmlxtojsx part.
feat: support `<svelte:html>` (#2599)
feat: support `<svelte:bounday>` (#2598)
companion to https://github.com/sveltejs/svelte/pull/14211
test skipped while feature is not merged yet
fix: ensure hoisted interfaces are moved after hoisted imports (#2597)
#2594
As a drive-by, I also ensures that the dts generation knows about the hoisted interfaces so it does not transform them into types anymore
fix: don't move appended content from previous node while hoisting interface (#2596)
#2592
fix: use original file path casing for shim files (#2591)
#2584
Use original casing here: people could have their VS Code extensions in a case insensitive folder but their project in a case sensitive one; and if we copy the shims into the case sensitive part it would break when canonicalizing it.
fix: detect shadowed variables/types during type hoisting (#2590)
#2589
fix: hoist types related to `$props` rune if possible (#2571)
This allows TypeScript to resolve the type more easily, especialy when in dts mode. The advantage is that now the type would be preserved as written, whereas without it the type would be inlined/infered, i.e. the interface that declares the props would not be kept
fix: robustify and fix file writing
- throw an error if writing didn't work (ts doesn't throw itself)
- fix html path logic
#2584
perf: check for and return promise instead of awaiting (#2586)
There are some checks in `SvelteDocument` where we do the work once in case it hasn't started yet. But we're potentially doing the work more often than necessary, because we're awaiting the result before assigning it to the "chache" and returning it. That way, if another request would come in while the promise isn't resolve yet, we would kick off another needless compile. This fixes that by assigning the promise to the "cache" instead.
fix: fall back to `any` instead of `unknown` for untyped `$props` (#2582)
The idea was to be conservative about it, but this causes problems for people not wanting strict type checking but only a basic form of it. Falling back to `any` is the more pragmatic choice
#2556
fix: use user's Svelte parser when formatting if necessary (#2578)
This makes formatting "just work" if users use Svelte 5 but don't have prettier (and the plugin) installed in their workspace
Depends on https://github.com/sveltejs/prettier-plugin-svelte/pull/471
#2542
fix: adjust generated `+layout.svelte` file contents (#2580)
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
chore: update Svelte documentation links for template syntax (#2579)
fix: infer types for `$bindable`, infer function type from arrow function
#2577
fix: make it possible to disable runes/legacy mode code lens
fix: ensure code lenses from different sources are merged
chore: run CI with node 20 (#2574)
openvsx currently fails on deploy because it requires it
fix: move globrex to dependencies (#2576)
fix: keep `linkedEditing` working when tag name contains `.` (#2570)
#2569
Since Svelte 5, dots are allowed and indicate a component name
fix: ignore exported variable declarations that aren't simple identifiers
While this wouldn't surface invalid exports, it more importantly doesn't have false positives anymore
#2566
fix: copy global types into hidden folder in IDE contexts (#2561)
Since the global types now reference `svelte/...` imports, they need to be placed in the same context the users' Svelte package lives in. Else these imports would load the types of the Svelte version that comes bundled with the IDE.
#2493
(side note: we had this problem before in #2109 when loading `svelte/elements`, but that solution is not applicable here)
fix: prevent false-positive auto completions on Svelte components (#2564)
Because Svelte components take precedence, we leave out commit characters to not auto complete in weird places (e.g. when you have `foo.filter(a => a)`) and get autocomplete for component A, then a commit character of `.` would auto import the component which is not what we want
Found after merging #2545 and playing around with it a bit
fix: take complex/mapped typed into account during prop completions (#2563)
#2549
fix: infer object and array shapes from fallback types (#2562)
#2556
feat: support typescript 5.6 (#2545)
* feat: support typescript 5.6
* fix build
* autoImportSpecifierExcludeRegexes and organizeImports preference
* what
* bumps typescript-auto-import-cache
* missed one
* use commit characters from typescript when possible
* format
* bump language server dep
feat: add runes mode indicator (#2554)
adds a runes mode indicator atop of the file via a code lens. Will show "runes mode" if the components is in that mode, "legacy mode" if not, and nothing if it's not Svelte 5
#2418
fix: properly highlight svelte 5 <component.dot.notation /> (#2552)
#2525
feat: provide component instance type in Svelte 5 (#2553)
While it's a gotcha for people declaring their own types, the vast majority of people will use component types via importing other components, and as such it makes sense to provide the same convenience we know from class components
#2522
feat(svelte2tsx): autotype `const load = ...` declarations (#2540)
fix: migrate glob file watch for chokidar v4 (#2551)
#2539
chokidar v4 removes all glob support. This migrates fallback watcher and CSS global var to use the ignored config
fix: add Sveltekit snippets for Svelte 5 (#2548)
---------
Co-authored-by: Alexandre Oger <alexandre.oger@fabernovel.ey.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: correctly position quick fixes in instance and module (#2531)
closes #2529
feat: provide Svelte 5 component migration command
fix: include named exports in svelte 5 type (#2528)
fixes sveltejs/svelte#13508
fix: relax component constructor type (#2524)
Since , we're no longer adding the `[evt: string]: CustomEvent<any>` index signature to components in runes mode not using `createEventDispatcher`. This revealed a type bug in our `ATypedSvelteComponent` type. It was to restricting, because TypeScript will resolve the empty event object to a handler with callback type `never`, which then means the `__sveltets_2_ensureComponent` generic no longer picks the right type, resulting in generics not being resolved properly. Fix this by relaxing the constraints.
Fixes #2523
chore: upgrade to chokidar 4 (#2502)
Also remove long-obsolete sapper handling
fix: check project files update more aggressively before assigning service (#2518)
#2516
Most of the time, the didOpen request is earlier than the watcher event. So if the file doesn't exist in the GlobalSnapshotManager we manually invoke the project file update check. This won't cause 2 project files check because if the file already is a project file we won't check project files.
breaking(svelte5): only generate function component shape in runes mode (#2517)
When a component is in runes mode and not using slots or events, adjust the output to only create the function type that mimics the underlying real shape of components in Svelte 5. This is a breaking change because previously the type was enhanced such that it also had the legacy class shape. As a result, users now may need to switch to `typeof Component` when using the component inside types.
Sadly, due to a combination of requirements and TypeScript limitations, we need to always create both a legacy class component and function component type.
- Constraints: Need to support Svelte 4 class component types, therefore we need to use __sveltets_2_ensureComponent to transform function components to classes
- Limitations: TypeScript is not able to preserve generics during said transformation (i.e. there's no way to express keeping the generic etc)
TODO Svelte 6/7: Switch this around and not use new Component in svelte2tsx anymore, which means we can remove the legacy class component. We need something like _ensureFnComponent then.
perf: auto import cache for svelte-kit language service proxy (#2513)
#2464
getPackageJsonsVisibleToFile and getGlobalTypingsCacheLocation are singleton so this should definitely be fine. The proxy language service has the exact list of entry files and the auto-typing also doesn't add any export so it should be fine to just proxy these methods.
fix: revert additional two-way-binding checks (#2508)
This reverts commit 8c080cf36286984439b468e089e6e4eaacd4230e.
This reverts #2477. Sadly, the idea didn't work out, as shown by two opened bug reports:
- #2506: A type union can be narrowed on the input, but not on the way back out
- #2494: A generic nested within a bound value is not properly resolved and not falling back to `any` (in #2477 we thought of the generic case, but only for when the generic is the whole value type, not when it's nested)
For these reasons I don't see a way to properly implement #1392 at the moment.
chore: revert accidental commit
fix: make no Svelte files found a warning (#2507)
There were reports that this was too overzealous as some people use this potentially not knowing whether or not this is a Svelte-projects, too. Therefore only issue a warning instead of an error.
fix: include files indirectly belonging to a project into correct project (#2488)
Fixes #2486
Fixes #2485
fix: silence type error in old d.ts files
svelte-jsx and svelte-shims are used for Svelte 3 only, and are likely out of date, yet we don't want to invest time into adjusting them anymore, therefore silence any type errors in it.
Helps with #2498
fix: update SvelteKit trailingSlash types (#2496)
fix: add constraint to inference
Else the type is not properly resolved sometimes
Fixes a type issue with Threlte
fix: remove process declaration
Likely added during ancient times for Svelte Native. It now gets in the way, and SvelteNative folks can add a declaration themselves if they need to
Fixes #2483
chore: add homepage/repository fields
chore: show more error diagnostics for emitDts
closes #2371
fix: detect `<script module>` tag (#2482)
This was missing in #2473
Possibly related to sveltejs/svelte#13039
feat: allow autoImportFileExcludePatterns to ignore files outside the root (#2480)
part of #2479
fix: Svelte module resolution tweaks (#2481)
Svelte files are now resolved by intercepting checks for .d.svelte.ts instead of .svelte.ts. As a consequence, we can handle sibling foo.svelte / foo.svelte.ts files and importing both. When doing import Foo from './foo.svelte this now resolves to the Svelte file (prio to #2463 it would resovle to the .svelte.ts file), and doing import Foo from './foo.svelte.js will resolve to the TS file.
feat: better type checking for bindings in Svelte 5 (#2477)
#1392
This adds enhanced type checking for bindings in Svelte 5: We're not only passing the variable in, we're also assigning the value of the component property back to the variable. That way, we can catch type errors like the child binding having a wider type as the input we give it.
It's done for Svelte 5 only because it's a) easier there b) doesn't break as much code (people who upgrade can then also upgrade the types, or use type assertions in the template, which is only possible in Svelte 5).
There's one limitation: Because of how the transformation works, we cannot infer generics. In other words, we will not catch type errors for bindings that rely on a generic type. The combination of generics + bindings is probably rare enough that this is okay, and we can revisit this later to try to find a way to make it work, if it comes up.
Also note that this does not affect DOM element bindings like <input bind:value={...} />, this is only about component bindings.
chore: bump magic-string (#2476)
requires adjustments of mapping tests and a fix in the InlayHintProvider, because more things are mappable now
fix: add server bin to package exports
breaking: vs code / language-server major (#2475)
- use Svelte 4 as built-in version now
- add exports map
- bump vs code ls/client version to 9
- require Node 18 / VS Code 1.82 minimum
- drive-by fix of __sveltets_2_ensureComponent (the previous version didn't work after all)
fix: check error length
breaking: project reference support (#2463)
- closes #2148
- fixes #1234 - due to the change of how files are resolved (breaking change)
- fixes #1976 - less options are now forced (breaking change)
- fixes #2154 (breaking change)
breaking: svelte-check v4 (#2453)
- breaking: make TypeScript a peer dependency
- breaking: require node 18 or later
- breaking: require Svelte 4 or later (devDependencies pinned to Svelte 3 because other packages in this repo still use it. Theoretically we still support Svelte 3 with svelte-check v4 but this gives us the opportunity to adjust that later without a major)
- chore: switch from fast-glob to fdir (#2433)
closes #2397
fixes #2364
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
fix: support module script attribute (#2473)
fixes #2472
chore: publish package provenance info (#2469)
According to https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow
closes #2461
chore: fix test
feat: support specifying tsconfig for emitDts (#2454)
part of #2355
feat: replace svelte-preprocess with barebones TS preprocessor (#2452)
Removes the need for a dependency on svelte-preprocess in svelte-language-server, since that was all we used it for.
closes:
- #1683 and #1259, because the situation no longer arises (because we no longer have svelte-preprocess inside the VS Code extension)
- #2391
typo fix in DisagnosticsProvider (#2468)
Co-authored-by: Eric Muckley <22535087+ericmuckley@users.noreply.github.com>
fix: add legacy methods to own component shape (#2451)
see https://github.com/sveltejs/svelte/pull/12666 for why we need this
fix: normalize paths in emitDts map
bug introduced in #2443, affecting windows systems
feat: reference/implementation codelens (#2378)
#2130 Porting VSCode's implementation/reference code lens. This is not enabled by default. To enable this, you'll need to enable the typescript.implementationsCodeLens.enabled config or the typescript.referencesCodeLens.enabled config for lang="ts" and javascript.referencesCodeLens.enabled for js components. Note that we reuse config for ts/js files so it'll also enable the feature in ts/js files.
fix: correctly handle HTML between implicit snippet props (#2450)
The transformation util was wrong: It did not stop moving content between transformations that were after the end marker
#2441
docs: mention `vitePreprocess` (#2440)
fix: various snippet fixes (#2449)
#2444 #2417 #2425 #2385 (comment)
The snippet is now transformed into a function with the return type so that The default parameter type can be inferred:
`const foo = (a: string, b = 1): ReturnType<import('svelte').Snippet> => {}`
fix: map refactor/quick-fix of svelte files in typescript plugin (#2439)
#2435
fix: correctly detect real Svelte files for declarationMap (#2443)
#2442
chore: better "cannot use `bind:`" error message (#2429)
feat: warn on likely failed d.ts file generation (#2428)
emitDts now warns when it detects diagnostics that likely mean the `d.ts` file was not generated
fix: no implicit children prop when using slot (#2427)
Using a slot tag means we're in a legacy component, which means we shouldn't pass the children prop implicitly
fixes https://github.com/sveltejs/svelte/issues/12240
chore: bump html/css language service (#2424)
#2224 #2265 #2390
fix: always set bindings/exports in Svelte 5 (#2423)
Those two methods are needed in Svelte 5, but we don't always set them. That was fine until TS 5.5, which infers generics slightly differently and turns `Exports` and `Bindings` to `never` if they don't show up in the input (before they were not)
fix: detect root snippets correctly
previously snippets inside top level if blocks etc where wrongfully detected as being a root snippet
fix: handle issues with svelte file watching (#2421)
Fix the neovim file-watching issue mentioned in Discord by checking if a directory actually exists before watching it.
Also fixes #2419 through several measures:
- don't close a document when it was changed
- fix the retrieval of the document (pathToUrl) was missing
fix: prevent false positive store declarations (#2422)
variable declarations not at the top level can't be subscribed to using the `$` prefix
fix: more robust start tag detection
make sure we do the cheaper component/element autocompletion lookup in more cases
#2394
chore: upgrade to TS 5.5 (#2415)
fix: handle optional args in snippets (#2414)
#2406
fix: watch svelte files and project files outside workspace (#2299)
#2233 #2393
update project files(tsconfig.include) when a new client file is opened. So files included in both tsocnfig.json will be loaded into the respecting language service.
fix: snippets with TS incorrect transformation (#2412)
After sveltejs/svelte#12070 the AST for the SnippetBlock has changed (to be more correct).
The problem is that svelte2tsx was using that wrong information for the transformation. This means that currently last version of svelte produces wrong ts code from svelte2tsx.
chore: remove import-fresh dependency (#2413)
No dependency inside svelte-check uses it anymore. If it creeps back in check if the dependency uses a version that fixed https://github.com/sindresorhus/import-fresh/issues/18
chore: move fast-glob to devDependencies (#2400)
Was always bundled, no need to have in dependencies
fix: support more types of component type defintion in completion (#2407)
* fix: support more types of component type definition
* ts-ignore Component import
* format
fix: adjust ambient module snipping logic
Since https://github.com/sveltejs/svelte/pull/12061 the `declare module "*.svelte" {..}` declaration contains more closing braces and the logic to snip it out is now outdated. This updates the logic to instead look for the first bracket that comes directly after one line.
chore: adjust test snapshot for latest svelte 5 (#2402)
chore: upgrade to pnpm 9 (#2398)
chore: update github workflows (#2399)
chore: speed up regex
#2363
fix: typo in CSS service code (#2389)
fix: account for added code in the range of inlay hint (#2387)
feat: Svelte 5 component class/function interop (#2380)
Svelte 5 uses functions to define components under the hood. This should be represented in the types. We can't just switch to using functions though because d.ts files created from Svelte 4 libraries should still w…
sam-easygo
added a commit
to sam-easygo/language-tools
that referenced
this pull request
Aug 7, 2026
emitDts resolved every import with a bare ts.resolveModuleName call, so
nothing was cached across the program's files: each of the (typically
hundreds of) node_modules declaration files re-ran the full resolution
walk of open/stat/realpath syscalls for every import. Passing a
ts.createModuleResolutionCache makes resolution the cheap path. Each of
the two resolution hosts gets its own cache because they disagree about
whether virtual .svelte.ts paths exist.
Version Packages (#3086)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chore: tweak changeset (#3087)
fix: support TypeScript 7 under npm alias (#3073)
* fix: support TypeScript 7 rc under npm alias
* also check name for native-preview
* tweak message
* fix merge problem
it's intentionally different so master still does allow npm alias
* update instruction to install stable version
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* replace typescript-7 alias with @typescript/native
* exclude v7 in peer
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Merge pull request #3085 from sveltejs/changeset-release/master
Version Packages
Version Packages
Merge pull request #3084 from sveltejs/fix-lock
fix: ensure config loading happens sequentially
docs: update internal deployment docs
Version Packages (#3077)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: zero-config `+error.svelte` props (#3076)
* feat: zero-config `+error.svelte` props
* Update .changeset/grumpy-rabbits-chew.md
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Version Packages (#3075)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: report tsconfig errors in --tsgo-experimental-api (#3070)
* fix: report tsconfig errors in --tsgo-experimental-api
* maybe just support both for now
might wanted to support typescript7.0rc later
* it's still wrong
fix: resolve tsgo bin path with package.json (#3074)
Version Packages (#3069)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix (svelte-check): `--tsgo-experimental-api` option is not honored (#3067)
* Fix tsgo-experimental-api option
* tweak changeset message format
Version Packages (#3059)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: svelte-check tsgo support with experimental api (#3036)
* wip
* flatten message, utf8 position
* cache api service, parser error
* migrate NoopsInReactiveStatements
* enable stableTypeOrdering so more error message is the same
* wire up to svelte-check
* bump @typescript/native-preview
* fix $$Props check
* wrong api, support svelteKit files
* various svelte-check integration fixes
* import priority fixes
* watch mode, fix non-project file resolution, node18
* fix more test, skip some
* remove unused import
* bumps @typescript/native-preview to fix ts-check issue
* add svelte-check test
* port $store diagnostics
* remove skip
accidentally revert a change
* no longer need the utf8 workaround
* Tweak message, rename flag
* changeset
fix(svelte-check): stop excluding workspaces under dot-prefixed ancestors (#3037)
findFiles() ran each directory through `filePath.includes('/.')` to
skip hidden directories. That predicate also fires on any ancestor of
the workspace whose name starts with a dot, so every descendant under
the workspace got pruned and no virtual `.svelte` files were emitted
into the `.svelte-check` cache. The behaviour is invisible in the
default check path but in `--incremental` / `--tsgo` mode it surfaces
as missing endpoint-handler annotations and spurious implicit-any
errors on `+server.ts` handlers.
The fix narrows the exclude predicate to the directory name fdir
passes as the first argument, so only the descendants whose own name
starts with `.` (or that equal `node_modules`) are dropped. Workspaces
under `.local/`, `.config/`, custom worktree directories, etc. now
crawl normally.
Fixes #3034
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
perf: remove lodash (#3038)
* perf: remove lodash
* fix: missing params
* fix: correct defu usage
* tests: add extra
* fix: 🤦♀️
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: enable passing Svelte config file paths (#3066)
vite.config or svelte.config
Closes #3055
Fixes #3054 (by providing you the possiblity to set this file and turn off file crawling that way)
Also added a TODO for the next major: We should not recursively crawl for config files anymore if we find one in the root directory or next to the tsconfig.
fix: load esm version of Vite (#3065)
cjs version will be gone at some point, and it prints a warning already
fix(svelte2tsx): don't crash on array binding holes in destructured exports (#3058)
An array binding hole (`export let { d: [a, , c] } = obj`) is an
`OmittedExpression` with no `name`, so `addExportForBindingPattern` called
`ts.isIdentifier(undefined)` and threw
`TypeError: Cannot read properties of undefined (reading 'kind')`. Skip holes.
build: bump mocha to v11.7.6 (#3042)
mocha 9.2.0 does not work with nodejs v26.2.0
Merge pull request #3051 from ghostdevv/lint
chore: fix lint
chore: fix lint
fix: build load-config before language-server
* fix: build load-config before language-server
* refactor: make language-server dependency build robust
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
fix: add repository url to package.json (#3048)
Version Packages (#3040)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: adjust rollup config (#3047)
fix: adjust paths in PKG.json (#3046)
* fix: adjust paths in PKG.json
* Create ten-dolls-jam.md
chore: fix changeset (#3045)
feat: support reading Svelte config from vite.config.js/ts (#3031)
We're thinking about getting rid of `svelte.config.js` (or rather, soft-deprecating it): `vite.config.js/ts` is now pretty much the standard for new Svelte apps and generally a better place to put your config.
This is an important stepping stone towards that future. `svelte.config.js` was originally introduced for language-tools to read config options, now we can do the same by reading the Vite config.
With this PR, `vite.config.js` is read first / preferred if both exist, but if it does not exist or no options are retrieved through it then `svelte.config.js/ts` is used.
fix: mark optional members with a trailing ? in completion labels (#3043) (#3044)
Optional object/class members were shown in completions without the `?`
that the TypeScript language service (and vtsls) appends to their labels,
so `baz?: number` completed as `baz` instead of `baz?`.
TypeScript reports optional members via the `optional` kind modifier on
the completion entry. `getCompletionLabelAndInsert` ignored this modifier
and always used the bare name as the label. Detect the modifier and append
`?` to the label while keeping the inserted text as the bare name, so the
`?` is display-only and completion resolution (which keys off `data.name`)
is unaffected.
---------
Co-authored-by: MohammadYusif <MohammadYusif@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: don't show type inlay hint for component inside snippets (#3041)
fix: correct 'occured' typo in svelte:boundary onerror description (#3039)
* fix: correct 'occured' typo in svelte:boundary onerror description
* chore: add changeset for svelte:boundary onerror typo fix
Version Packages (#3018)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix(emitDts): drop declarations emitted outside declarationDir (#2965)
Adds a sample where a Svelte component imports a TypeScript module from
outside libRoot, triggering TypeScript to emit declarations outside the
configured declarationDir.
Also extends the test runner to detect and clean up any .d.ts files
written outside declarationDir, asserting that none are produced.
feat: support Svelte 5 declaration tags (#3033)
fix: take into account component references when calculating snippet hoistability (#3032)
Fixes #3020
fix: handle prop named "slot" inside Svelte 5 snippets (#3030)
Fixes #2992.
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: add support for svelte config ts/mts files (#3009)
* feat: add support for svelte config ts/mts files
* don't add flag when runtime setting exists
* missed some spots
* skip if strip-types isn't enabled
* more
---------
Co-authored-by: Lyu, Wei-Da <36730922+jasonlyu123@users.noreply.github.com>
Co-authored-by: Lyu, Wei Da <jason.lyu@supergeo.com.tw>
fix: tweak "show compiled" icon (#3019)
Fixes #3001. Closes #3002
fix: prevent > in expression affects HTML folding (#3029)
fixes #2537
fix: support prettier.useEditorConfig setting (#3026)
feat: support CSS completions in nested style tags (#3022)
* fix: support CSS completions in nested style tags
* refactor: use findNodeAt for nested style lookup
* document highlight, disable js completion in style
fix: use local name for marking bindable props used (#3017)
Version Packages (#3015)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: typescript 6.0 support (#2985)
* wip
* bumps
* another default change
* changeset
* format
* fix svelte2tsx build for now
* more svelte2tsx migrate
* add node to be explicit
* avoid svelteHTML.mapElementTag in perf test for now
* update svelte5 snapshot
* update svelte-check smoke test to bundler
* try fix flaky test
it might have run too fast
* move typescript to peer in language server
* another drive-by fix
shouldn't matter in most cases but still restore the original logic
* use 6.0.3
Version Packages (#2999)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: flush stdout/stderr before exit in svelte-check (#3014)
* fix(svelte-check): flush stdout/stderr before exit
`process.stdout.write` is asynchronous on non-TTY pipes, and per Node's docs `process.exit` does not wait for queued I/O. Under heavy diagnostic load (1000+ ERROR/WARNING lines, enough to saturate the kernel pipe buffer) the trailing `COMPLETED` summary of `--output machine-verbose` was dropped when the CLI exited, even though the run was clean.
Replace the bare `process.exit(N)` calls in both CLI completion paths (default and `useVirtualFiles`) with the canonical flush-then-exit pattern.
Add a regression test `test-flush.js` (`pnpm run test:flush`) that runs the CLI against a fixture emitting 1500 diagnostics, throttles the consumer to keep the pipe full, and asserts the last non-empty line matches `^\d+ COMPLETED` across 10 runs.
This is useful for testing this fix but I don't know if it's worth actually commiting it to the repo or not.
`test-flush.js` is AI generated and manually reviewed.
* tweak changeset
* Running the flush test manually should be enough
fix: report diagnostics in tsconfig.json (#3005)
* fix: report diagnostics in tsconfig.json
* split changeset
* normalize path to deduplicate
* report global and config diagnostics as warnings in normal svelte-check
warning for now to avoid breaking change
---------
fix: prevent incorrect $types imports being injected in update import (#3010)
* fix ./$types imports
* formatting
* changeset
* remove log
* add test
* other regex
* separate tests
fix: properly place svelte-ignore comment in quickfix when `<script module>` presents (#3011)
* fix: svelte-ignore quickfix action could be improperly placed if a component contained a `<script module>` block
* rm
* changeset 2
* tweak changeset
---------
fix: prevent duplicate diagnostics (#3000)
fix: hoist self-referenced props interface (#2998)
fix #2935
Version Packages (#2977)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: support js/ts config section in VSCode (#2996)
feat: add command to show compiled CSS in preview window (#2993)
* feat: add command to show compiled CSS in preview window
add caching to switch between compiled code and CSS previews, and handle null response for compiled CSS output in both previews
* feat: add SVG icons for compiled CSS preview in light and dark modes
fix: prevent config loading message in svelte-check --incremental (#2974)
* fix: prevent config loading message in svelte-check --incremental
* one more
* load by default
* skip some config loading in test
fix: resolve svelte files under NodeNext (#2990)
* fix: resolve svelte files under --tsgo + NodeNext
* old ts too
* actually incremental in old ts doesn't work either
* unused jsdoc
* bump manifest version
use e18e recommendation (#2986)
fix: typescript 6.0 compatibility (#2988)
* fix: typescript 6.0 compatibility
* tweak
fix: ts-ignore for Svelte 4/5 type differences
feat: pull diagnostics support (#2978)
This switches the diagnostics from push model (server to client) to the pull model when the client supports it. The advantage is that the client can prioritise sending the diagnostic request for the visible tab. With this, we can check the document split to the side immediately and don't need to check all open files after a file save. The pull mode has a way to tell the client that the diagnostics haven't changed. I implement this mostly because VSCode sends another diagnostic request for the same files when switching files in the editor, even if the file isn't changed.
I also lowered the debounce delay in the push-mode diagnostics. I've been wondering if some of the performance complaints are actually just because the artificial delay is too long for some people. The pull mode also has a much lower artificial delay. I think we can give it a try. If people are complaining about it, we can switch to an approach similar to the "smart" mode.
chore(deps): replace vscode-tmgrammar-test with textmate-grammar-test (#2976)
* add textmate-grammar-test
* update snap files
new:
- file headers
- line break tokenization
* update readme
* update to 0.6.0
a minor format change
fix: prevent error with escape sequence in attribute (#2968)
Fixes #2964
fix: accomodate for dynamic compile options
https://github.com/sveltejs/svelte/pull/17801 introduced dynamic compile options; had to adjust one occurence as a result
fix: pluginHost low/smart null check (#2979)
perf: micro-optimizations in hot paths (#2960)
* perf: micro-optimizations in hot paths for faster completions and diagnostics
Replace O(n²) flatten() with Array.prototype.flat(), remove lodash flatten
dependency from PluginHost, use Object.create instead of object spread in
svelteNodeAt AST walking, cache getExistingImports per document, use
RegExp.test() over .match(), replace regex with charCode check in
possiblyComponent, use cached line offsets for lineCount, and optimize
iteration in SnapshotManager.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in PluginHost.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Create big-clocks-care.md
* fix: prettier formatting in changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* address pr feedback: remove flatten util, use charCodeAt, fix code style
- Replace all flatten() call sites with .flat()/.flatMap() and remove
the flatten utility function entirely
- Use charCodeAt(0) directly in possiblyComponent instead of char comparison
- Use block syntax for single-line for loops in SnapshotManager
- Remove ineffective existingImportsCache from CompletionProvider
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
perf: enable incremental TypeScript reparsing via getChangeRange (#2961)
* perf: enable incremental TypeScript reparsing via getChangeRange
Previously, both SvelteDocumentSnapshot and JSOrTSDocumentSnapshot
returned undefined from getChangeRange(), forcing TypeScript to do a
full reparse on every snapshot update. This adds a computeChangeRange()
function that scans for the minimal diff between old and new text,
enabling TS's incremental parser.
Benchmarks show 2-5x faster reparsing for structural edits and
near-instant reparsing for token-level edits (e.g. typing/renaming).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* add changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in benchmark file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* format changeset
* test: add realistic full-file tests for computeChangeRange
Adds tests using realistic svelte2tsx output (~150 lines with script,
store subscriptions, template, and component export) and a full
TypeScript service class (~200 lines with decorators, generics, and
multiple methods). Tests cover common edit patterns on these files
and verify that incremental TS reparsing produces correct ASTs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* trim tests and remove benchmark per review feedback
- Remove incremental-reparse-benchmark.ts (served its purpose)
- Trim DocumentSnapshot.test.ts from 152 to 31 tests, keeping only
essential coverage: basic operations, edge cases, reconstruction
invariant, snapshot integration, and in-place update tests
- Remove redundant/over-tested sections
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address PR review feedback for incremental reparsing
- JSOrTSDocumentSnapshot.update() returns new snapshot instead of mutating in-place
- SvelteDocumentSnapshot.getChangeRange returns undefined on scriptKind/parserError changes
- Trim tests to essential coverage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: prettier formatting in test file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
perf: various optimization with ast walk (#2969)
Version Packages (#2971)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: use Promise<Response> for async kit handler return types (#2966)
* fix: use Promise<Response> return type for async kit handlers
When svelte-check adds type annotations to SvelteKit route handlers
(GET, POST, etc.), it was using `Response | Promise<Response>` as the
return type for all functions regardless of whether they were async.
TypeScript requires async functions to return `Promise<T>`, not
`T | Promise<T>` (TS1064). This caused false positives in
`--incremental` mode where tsc runs on the generated files directly.
The fix checks if the function has an async modifier and, if so,
extracts just the `Promise<Response>` part of the return type union.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: format sveltekit.ts with prettier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix async kit handler return types
Updated async kit handler return types to use Promise<Response>.
* style: format changeset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: use asyncReturnType parameter instead of string splitting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Version Packages (#2958)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: pass filename to `warningFilter` (#2959)
Fixes #2953
fix: more robust detection of `lang="ts"` attribute (#2957)
Fixes #2956
fix: resolve svelte files under path alias in `--incremental/tsgo` mode (#2955)
Fixes #2952
Version Packages (#2951)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: respect `@ts-ignore` etc comments within tags (#2950)
We now actually output comments into the svelte2tsx output so that stuff like `@ts-ignore` or `eslint-disable` works
Version Packages (#2949)
* Version Packages
* Fix formatting in CHANGELOG for JSDoc @satisfies
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: detect existing JSDoc @satisfies to prevent duplicate injection (#2946)
fix: include `references` in generated `tsconfig.json` in `--incremental/tsgo` mode
They're not inherited by the extends mechanism
Fixes #2948
fix: resolve shims correctly in `--incremental/tsgo` mode
They are places in the svelte-check directory, not inside svelte2tsx which is likely not available
Fixes #2947
fix: support toggle-comment-key in start tags
Use `//` instead of html comments in start tags now.
Requires setting up a new embedded language which only matches within start tags and is basically the svelte config only with the comment functionality changed.
Version Packages (#2945)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: support for comments in tags (#2944)
see https://github.com/sveltejs/svelte/pull/17671
Version Packages (#2940)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
chore: remove outdated "experimental-modules" runtime flag (#2898)
* remove outdated runtime flag
* Create long-cups-lie.md
* format
* Delete .changeset/long-cups-lie.md
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: rewrite relative imports reaching outside root (#2942)
When using svelte-check's `--incremental/--tsgo` flags the files are written to a generated folder, making use of the rootDirs tsconfig feature. This has one limitation: when a relative import within a generated file reaches into a directory that is not covered by rootDirs, it cannot be resolved.
This therefore adds a new option to svelte2tsx to rewrite imports as part of the transformation. Note that this will not help with transforming files outside of the working directory, but when you e.g. import a regular TS/JS file that way it now works.
fix: extract style/script tag followed by destructuring in the template (#2921)
* fix: extract style/script tag followed by destructuring in the template
* tweak
* move back to utils
* tweak
* rewrite
* fix some case with attribute, revert getAttributeContext to using scanner
* tweak
* fix svelte-check build
* removed unused variable
* Update packages/language-server/test/lib/documents/parseHtml.test.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: support SvelteKit zero-types with svelte-check --incremental (#2939)
- add jsdoc-type variants for SvelteKit transform helpers
- use those helpers in svelte-check to transform files. Transformed files are written into the generated folder
- filter out diagnostics of original files which have a transformed sibling; sometimes those original files end up in the TS module graph
- remove unused map generation along the way and simplify/deduplicate a few things
Version Packages (#2929)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
feat: add links to diagnostic error codes via codeDescription (#2936)
closes #2933
fix(svelte-check): ignore Unix domain sockets in file watcher (#2931)
svelte-check crashes when encountering Unix domain sockets (e.g., .sock files)
in watch mode because chokidar cannot watch these special files. This adds a
check to ignore sockets using stats.isSocket(), preventing the crash and
allowing svelte-check to continue operating normally.
chore: add changeset for unix socket fix
feat: svelte-check `--incremental` / `--tsgo` (#2932)
Adds two new flags:
- `--incremental`: Opts into TypeScript's incremental build cache, which speeds up subsequent runs. Saved within `.svelte-kit` or if not available within `.svelte-check`. This might result in slightly different type check outcomes, and certain patterns are not supported. Specifically, anything that is not in the root dir of your tsconfig.json and is a Svelte file will not be properly loaded and type-checked.
- `--tsgo`: Use TypeScript's Go implementation. Needs to have `@typescript/native-preview` installed. Subject to the same limitations as `--incremental`
Part of #2733
closes #2131
Huge kudos to https://github.com/astralhpi/svelte-fast-check and https://svelte-check-rs.vercel.app/ , both of which heavily inspired this PR
fix: properly use machine output by default for Claude Code
#2897
Version Packages (#2928)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: apply text synchronize change in order (#2927)
Version Packages (#2919)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: compatibility with prettier-plugin-tailwindcss in monorepo (#2925)
fix: don't hoist type/snippet referencing $store (#2926)
* fix: don't hoist type/snippet referencing $store
* svelte-check changeset
perf: only parse html once in a batch update (#2923)
fix: remove outdated documentation with --ignore (#2920)
feat: support emmet.extensionsPath config (#2918)
feat: Use custom element's JSDoc as doc for completion/hover (#2879)
* ✨ Use custom element's JSDoc as doc for completion
With support for markdown
* ✨ Use custom element's JSDoc as doc for hover
With support for markdown
* ✏️ Typo in description of getNodeIfIsInTagName
* resolve one documentation at a time
* changeset
---------
Co-authored-by: Lyu, Wei Da <jason.lyu@supergeo.com.tw>
fix: add tokenTypes config for JSDoc completion (#2916)
Version Packages (#2896)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
perf: only create objects for completion items for svelte syntax once (#2900)
* only create objects for completion items for svelte syntax once
* Optimize completion items handling for Svelte syntax
* format
fix(syntax): sveltejs ts highlighting when trailing type alias misses semicolon (#2905)
* fix(syntax): svelte ts highlighting when trailing type alias misses semicolon
* test: add fixtures
* fix: allows empty single script tag
* fix style lang=ts
fix: add some limit to store auto-import (#2909)
perf: optimize path normalization (#2907)
perf: avoid global completion in component start tag (#2904)
chore: skip document symbols timeout in test (#2903)
perf: optimize module resolution cache invalidation check (#2902)
* perf: only check for module cache invalidation when there are new files
* another one
[perf]: early return in getCompletions if in style or script tag (#2899)
* early return in getCompletions if in style or script tag
* Create big-cheetahs-admire.md
* format
fix: ensure await-block type is preserved in the latest Svelte version (#2895)
fix: skipLibCheck in svelte-check smoke test (#2893)
Version Packages (#2869)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: support experimental feature in "Show compiled Code" (#2884)
#2857
feat: quick fix for adding lang="ts" (#2882)
#2876
feat: support hierarchical document symbols (#2817)
Closes #1519
Return hierarchical DocumentSymbol, useful for breadcrumb feature in various clients.
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
chore: turn changeset into patch
a minor would be like a major for language-server since we're in 0.x range
feat: use machine format when run by Claude Code (#2870)
* feat: use machine format when run by Claude Code
Fixes #2868
Co-Authored-By: Claude <noreply@anthropic.com>
* Change commit type from feat to chore
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: use moustache for svelte5 onhandler completion (#2883)
chore: slight optimize
forgot to reuse the variable
fix: treat a script tag as top-level if it's the first tag in file (#2886)
docs: update command for setting up TailwindCSS (#2880)
Remove deprecated svelte-add and change it to sv add
feat: implement 'source.removeUnusedImports' code action (#2875)
* feat: implement 'source.removeUnusedImports' code action
* add source action kind to server capability; revert code action removal
* add changeset
fix: restrict emmet completion with emmet specific triggerCharacter (#2873)
* wip
* test
* changeset
* format
fix: support for @nativescript-community/svelte-native (#2867)
* fix: support for @nativescript-community/svelte-native
We moved the svelte-native plugin to @nativescript-community.
This supports it while still supporting the old package
* Add changeset for svelte-language-server patch
Add a changeset for patching svelte-language-server.
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Version Packages (#2861)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fix: allow `undefined` and `null` values for `#each` in Svelte 5 (#2863)
* fix: allow `undefined` and `null` values for `#each` in Svelte 5
* switch
fix: prevent file watcher issue (#2859)
* fix: prevent file watcher issue
* perf: check if file content changed in tsconfig file watch
chore: fix svelte-check build
Version Packages (#2848)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
perf: rework snapshot hot paths (#2852)
* perf: rework snapshot hot paths
**`fromNonSveltePath`**
This function was originally using `replace` to unix-ify paths before
then testing against them with `endsWith`.
We can instead use static patterns on the unaltered path regardless of
separator.
**`getLastPartOfPath`**
This now uses `slice` on the last separator rather than splitting only
to retrieve the last part.
* perf: avoid garbage collection on diagnostics
Reverts the `getKey` change and updates diagnostics iteration to avoid
allocating an array we later discard.
* Tweak snapshot hot paths for performance
* chore: make linter happy
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
perf: use failed path to invalidate module cache (#2853)
* perf: use failed path to invalidate module cache
* Don't emit both document events in open
This makes the test do extra work after everything is done and creates weird race conditions, which I have already tried to fix many times
* changeset
* remove unnecessary Array.from
fix(svelte2tsx): support for runes={false} in svelte:options (#2847)
Description
The <svelte:options runes/> were not checking for the value, so it was always true. When using <svelte:options runes={false}/> the props exported were Record<string, never> which is incorrect.
Related issues
Fixes #2843
---------
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
(deps) Replace `pascal-case` with `scule` (Maintained & Lighter) (#2842)
* (deps) Replace pascal-case with change-case (Maintained & Lighter)
* add changeset
chore: set vscode package to private
because it's not a real npm pkg
chore: fix release script
Version Packages (#2846)
* Version Packages
* Update packages/svelte2tsx/CHANGELOG.md
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
chore: add missing changeset formatting package
chore: fix branch name trigger
fix: respect moduleResolution setting in emitDts (#2845)
see #2837 for more info
---------
Co-authored-by: Mattias Granlund <mtsgrd@gmail.com>
chore: bump package versions to latest
so changesets knows where to start from. also removes vscode from the list of packages to create changesets for
chore: setup changesets + oidc (#2844)
- setup changesets: all packages are now released through changesets, only the extension is released via tag as before
- remove pkg deploy flows in favor of one
- that flow will use oidc, so no npm token anymore
- also harden the workflows
fix: respect tsconfig/jsconfig exclude patterns in file watcher (#2807)
* fix: respect tsconfig exclude patterns in file watcher
- Add getProjectConfig() to language server to expose parsed tsconfig
- Process wildcard directories in svelte-check to determine watch paths
- Support both recursive and non-recursive directory watching based on TypeScript's configuration
- Handle relative paths correctly for directories outside workspace
This ensures svelte-check only watches directories included by the tsconfig, improving performance and avoiding unnecessary file watching.
* refactor: separate watcher updates from diagnostics scheduling
* prettier fix
* fix: discover missed watch directories with snapshots
* refactor(check): clarify snapshot callback and simplify directory watching; ignore .crush
* fix: order-of-operations for diagnostics and watch directories
* fix: update watch directories before initial diagnostics
---------
fix: builtin custom elements check when transforming attributes (#2824)
* Fix builtin custom elements check when transforming attributes
* Fix lint issue
chore: add CONTRIBUTING.md (#2816)
* chore: add CONTRIBUTING.md
* fix: lint-fix CONTRIBUTING.md
* slim down, deduplicate
* lint
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
fix: Update +error.svelte creation template in vscode extension (#2811)
* Update +error.svelte creation syntax (#2810)
* Add Svelte 5 variants to +error.svelte creation syntax template (#2810)
* Change withRunes to withProps in +error.svelte template
* Add withAppState option
* Change withRunes to withAppState in +error.svelte template
* Remove trailing comma
* Add type for withAppState
Revert "feat: support `<svelte:html>` (#2599)" (#2826)
This reverts commit cd1758b16f4cb6b176980b2c868efa3c98d30343.
chore: bump to typescript 5.9 (#2808)
* chore: bump to typescript 5.9
* typescript-plugin also needs support for the new parameters
fix: prevent organize imports from removing snippet (#2809)
* wip
* test, fix leftover indent
fix: handle object literal in MustacheTag (#2805)
fix: Better detection version (#2801)
* step 1 of version
* start managing things
* adding semver to test
* let's not redo semver!
* better fallback
* not only this ;)
* Update version.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: add `await` support (#2799)
For the new Svelte 5 "await at the top level / in template" feature
feat: add `xxxProps` support to VS Code snippets (#2796)
fixes: #2782
fix: strip doctype using AST instead of regex (#2798)
#2791
chore: make human output more concise and readable (#2748)
* style(svelte-check): make human output more concise and readable
* Update packages/svelte-check/src/writers.ts
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
feat: zero types for `params` (#2795)
Companion to #13999
docs: use svelte 5 syntax in readme (#2785)
Co-authored-by: tijn <tijnjh@proton.me>
fix: enable fallback watcher when dynamicRegistration is false (#2783)
fix: support "Build-Free Editing with Project References" in SvelteKit page.ts files (#2788)
feat: workspace symbols support (#2769)
#2375.
Adding support in the Svelte language server so that you don't need to open ts/js files to use this feature. You can trigger this feature with Ctrl + T and search for symbol names. Some of the handling is also synced to the typescript-plugin so that it's more consistent, which also means vscode can better deduplicate the results from both tsserver and Svelte language server.
fix: invalidate project file cache and handle watcher race condition (#2779)
#2773
This delays the file reading in svelte-check --watch until we're sure the new file is a project file. I still added a file existence check before reading, but it might be more of a fail-safe because the chance of it being deleted at this point is much smaller.
While checking this, I also found that the new file watch is broken because it now caches the tsconfig parsing result. So I changed the "read the config again" logic to the one language server used to invalidate the project files cache.
fix: key block can have its own block scope (#2768)
#2762
fix: don't treat derived imported from svelte/store as a potential store (#2780)
#2772
fix: prevent error with `bind:this={get, set}` (#2781)
This transform bind:this={get, set} with a similar method as bind:this={ele}, but by invoking the set function. The get function is ignored.
perf: bail on giant export maps when initializing auto import cache
implemented within typescript-auto-import-cache dependency
chore: remove "Run tests with debugger" task. (#2764)
feat: support generics on snippets (#2761)
* feat: support generics on snippets
* chore: remove log
* adjust grammar (holy shit that was fucked up)
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
fix: deduplicate definition for rune-mode components (#2759)
Wrap it in ignore comments so they're filtered out
#2697
fix: more robust solution project check for ts < 5.7 in ts plugin (#2758)
#2756
The problem is that in TypeScript before 5.7, the project files were added later than plugin initialisation. Thus, the IsSolution method will always return true in any project using project references during plugin initialisation.
feat: support attachments (#2760)
sveltejs/svelte#15000
fix: invalidate module resolution when higher priority file is added (#2754)
part of #2738
fix: prevent error with unclosed tag followed by LF or end of file (#2750)
#2742
The reason that it happens to LF but not CRLF is that CRLF has two characters, so it doesn't touch the range of the start tag name, and therefore won't trigger the magic string error. This should also improve auto-import performance a bit because TypeScript only needs to compute auto-imports for Button and not a global auto-import.
fix: Move hoisted snippet to right after import (#2753)
#2653
chore: bump vscode-html/css-language-service (#2752)
* chore: bump vscode-html/css-language-service
* update test
feat: support "add missing imports on save" (#2744)
Fixes #2616
Adds the source action to addMissingImports, reusing the same quick fix action as "import all missing"
fix: ensure typed exports are marked as used (#2746)
#2717
fix: various hoistability check (#2740)
#2671 #2727
Added color CLI options (#2678)
* Added color CLI options
* add comment
---------
fix: don't provides quickfix to add async to the script tag (#2737)
fix: highlight one-character component (#2736)
fix: don't create new output channel after restart (#2722)
fix: don't highlight component as a parameter in the template (#2732)
chore: standardize author field (#2723)
feat: directive keyword autocomplete (#2707)
#2696
fix: ensure exports in runes mode are marked as used (#2719)
Ensure they are read as part of exporting the types
#2717
fix: prevent unused variable error for bindable (#2710)
#2268
fix: prevent extra bracket with import statement completion (#2713)
chore: bump to typescript 5.8 (#2704)
fix: highlight type annotation in `@const` tags
#2690
fix: handle booleanish popover (#2702)
`<div popover></div>` actually means `<div popover=""></div>`
#2688
perf: cache files during emitDts (#2701)
closes #2691
fix: correctly handle unclosed tags with same type tag inside (#2682)
fix: use referenced project's compiler option to get resolution mode (#2676)
#2673 Fixing the actual problem that makes the OP want this option. The problem is that the referenced project is a common js project which allows extensionless import. But when we used the wrong compiler option to check for the resolution mode. TypeScript thus used the ESM strategy to resolve the import.
fix: prevent error when the script tag is removed in nodenext projects (#2635)
* fix error when script tag is removed in node16/nodenext
* need to have syntax error
* two more cases tracked it in git so we can reenable it later
* cleanup
* patch update as well
* Mark it as clean first so at least it doesn't stuck in an old version even if lang="ts" is added back
* try finally instead
chore: bump vscode-html/css-language-service (#2677)
#2675 #2388. For svelte-check. The extension should already be shipping with these versions.
fix: properly transform `$props.id` when `$props` is assigned to `props` (#2694)
* fix: properly transform `$props.id` when `$props` is assigned to `props`
* chore: add comments
fix: don't show html tag completion with namespace component (#2685)
#2684 The problem is that the HTML tag completion takes priority over the ts completion and the TextEdit from HTML tag completion includes the whole dot notation. VSCode doesn't like it spans over the word span and filters it out.
fix: disambiguate `render` in module script (#2667)
call it $$render to ensure it's not going to clash with a username, and make it a exported name for better consistency
fix: support workspace symbol excludeLibrarySymbols config in ts-plugin (#2674)
fix: take other snippets into account when checking for hoistability (#2668)
Closes #2664
fix: don't hoist types referencing stores or destructured variables (#2661)
#2659
#2660
fix: Update prettier-options-schema.json (#2658)
sync with `options.ts` in sveltejs/prettier-plugin-svelte
fixes #2657
fix: move snippets to correct place when only module script present
#2640
fix: safely access Svelte config during startup
#2656
fix: better hoistability analysis (#2655)
Instead of collecting the types/values that are allowed, we collect the types/values that are _disallowed_ - this makes it possible to reference global values/types and still have them properly be declared as hoistable
#2640
feat: Semantic document highlight (#1408)
* ts, html, css
* WIP
* fast forward
* general svelte blocks and tag
* only same file highlights
* else highlights for if block
* await block
* highlight in style attribute
* exclude unsupported
* don't filter out highlights if original is not in it
function and class highlght its name
* config
* ts, html and css test
* svelte test
* format
* merge two utils files
* revert unnecessary changes
* single config, mark as experimental
* move the svelte highlight to ts using ast returned by svelte2tsx
* config description
* word based highlight for unsupported languages
* format
* ignore for svelte 5
* fix svelte 5 issues. workaround the await block issue and fixing it separately
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* prevent word-base fallback
* fix nested if, if block without else if
* remove experimental
keep the config so people can still go back to the word base highlight
* fix svelte 4 again
* fix
* Update packages/language-server/src/plugins/PluginHost.ts
* fix the fix
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
feat: support `generics` attribute for JSDoc (#2624)
#2618
feat: TypeScript 5.7 support (#2585)
* feat: typescript 5.7 support
* bumps to stable
* update svelte 5 snapshot
chore: run Svelte 5 tests in loose parser mode (#2652)
can help catch regressions in that area
fix: reword plugin modal options (#2646) (#2647)
In accordance with VS Code style guidelines + shorter so you can see the source
Fixes #2646
fix: correct the selection range of the last import that doesn't have a semicolon (#2651)
fix: README typo (#2645)
"run a commands" → "run a command"
feat: make use of loose Svelte parser and provide better intellisense (#2631)
This adds support for the Svelte parser with its new loose mode (https://github.com/sveltejs/svelte/pull/14691) and adjusts code paths to make use of it properly. As a result, intellisense should be a lot more useful in situations where code is in the middle of being typed and the Svelte file is in a broken state.
fix: no autocompletion when in block name
chore: tweak completions (#2630)
- In Svelte 5, prefer `onclick` over `on:click` suggestions
- Ignore completions in more Text positions
- Only prefer runes/components in the script tag and in opening tags; should give more accurate completions in the template (as part of this I refactered the compiler usage a bit; it's reusable/shared between documents now)
chore: fix tests for Svelte 5 (#2626)
fix: don't patch solution project in ts plugin (#2617)
part of #2612
fix: support `each` without `as` (#2615)
fix: make sure snapshots are shared per ProjectService (#2614)
The ProjectService contains snapshots. Multiple TypeScript plugins may be instantiated for one projectservice. Ensure we share our internal Svelte snapshots between those instances.
#2602
fix: ensure imports without semicolon doesn't break intellisense (#2610)
...by adding a generated semicolon at the end. That prevents TypeScript from going up until the next semicolon it finds, which may be from another generated code, messing up the generated->original end position
#2608
#2607
chore: update tests
chore: pin TS to 5.6 for now
until we properly investigated supporting it
fix: ensure organize imports doesn't mess with generated $$Component type
#2594
fix: preserve `bind:...` mapping on elements for better source maps
else an error like "X is not assignable to bind:Y" is shown on the previous attribute, if there is one
feat: support `bind:value={get, set}`
Companion to https://github.com/sveltejs/svelte/pull/14307
chore: bump prettier-plugin-svelte
feat: hoist snippets to module context if possible (#2601)
https://github.com/sveltejs/svelte/issues/10350
chore: consolidate template walking logic (#2600)
right now some of the logic of walking the template is within the svelte2tsx part, some in the htmlxtojsx part. This makes it hard to decide where to put new stuff and represents an arbitrary barrier for features that may need to work across both.
This PR therefore moves all the logic from the svelte2tsx part into the htmlxtojsx part.
feat: support `<svelte:html>` (#2599)
feat: support `<svelte:bounday>` (#2598)
companion to https://github.com/sveltejs/svelte/pull/14211
test skipped while feature is not merged yet
fix: ensure hoisted interfaces are moved after hoisted imports (#2597)
#2594
As a drive-by, I also ensures that the dts generation knows about the hoisted interfaces so it does not transform them into types anymore
fix: don't move appended content from previous node while hoisting interface (#2596)
#2592
fix: use original file path casing for shim files (#2591)
#2584
Use original casing here: people could have their VS Code extensions in a case insensitive folder but their project in a case sensitive one; and if we copy the shims into the case sensitive part it would break when canonicalizing it.
fix: detect shadowed variables/types during type hoisting (#2590)
#2589
fix: hoist types related to `$props` rune if possible (#2571)
This allows TypeScript to resolve the type more easily, especialy when in dts mode. The advantage is that now the type would be preserved as written, whereas without it the type would be inlined/infered, i.e. the interface that declares the props would not be kept
fix: robustify and fix file writing
- throw an error if writing didn't work (ts doesn't throw itself)
- fix html path logic
#2584
perf: check for and return promise instead of awaiting (#2586)
There are some checks in `SvelteDocument` where we do the work once in case it hasn't started yet. But we're potentially doing the work more often than necessary, because we're awaiting the result before assigning it to the "chache" and returning it. That way, if another request would come in while the promise isn't resolve yet, we would kick off another needless compile. This fixes that by assigning the promise to the "cache" instead.
fix: fall back to `any` instead of `unknown` for untyped `$props` (#2582)
The idea was to be conservative about it, but this causes problems for people not wanting strict type checking but only a basic form of it. Falling back to `any` is the more pragmatic choice
#2556
fix: use user's Svelte parser when formatting if necessary (#2578)
This makes formatting "just work" if users use Svelte 5 but don't have prettier (and the plugin) installed in their workspace
Depends on https://github.com/sveltejs/prettier-plugin-svelte/pull/471
#2542
fix: adjust generated `+layout.svelte` file contents (#2580)
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
chore: update Svelte documentation links for template syntax (#2579)
fix: infer types for `$bindable`, infer function type from arrow function
#2577
fix: make it possible to disable runes/legacy mode code lens
fix: ensure code lenses from different sources are merged
chore: run CI with node 20 (#2574)
openvsx currently fails on deploy because it requires it
fix: move globrex to dependencies (#2576)
fix: keep `linkedEditing` working when tag name contains `.` (#2570)
#2569
Since Svelte 5, dots are allowed and indicate a component name
fix: ignore exported variable declarations that aren't simple identifiers
While this wouldn't surface invalid exports, it more importantly doesn't have false positives anymore
#2566
fix: copy global types into hidden folder in IDE contexts (#2561)
Since the global types now reference `svelte/...` imports, they need to be placed in the same context the users' Svelte package lives in. Else these imports would load the types of the Svelte version that comes bundled with the IDE.
#2493
(side note: we had this problem before in #2109 when loading `svelte/elements`, but that solution is not applicable here)
fix: prevent false-positive auto completions on Svelte components (#2564)
Because Svelte components take precedence, we leave out commit characters to not auto complete in weird places (e.g. when you have `foo.filter(a => a)`) and get autocomplete for component A, then a commit character of `.` would auto import the component which is not what we want
Found after merging #2545 and playing around with it a bit
fix: take complex/mapped typed into account during prop completions (#2563)
#2549
fix: infer object and array shapes from fallback types (#2562)
#2556
feat: support typescript 5.6 (#2545)
* feat: support typescript 5.6
* fix build
* autoImportSpecifierExcludeRegexes and organizeImports preference
* what
* bumps typescript-auto-import-cache
* missed one
* use commit characters from typescript when possible
* format
* bump language server dep
feat: add runes mode indicator (#2554)
adds a runes mode indicator atop of the file via a code lens. Will show "runes mode" if the components is in that mode, "legacy mode" if not, and nothing if it's not Svelte 5
#2418
fix: properly highlight svelte 5 <component.dot.notation /> (#2552)
#2525
feat: provide component instance type in Svelte 5 (#2553)
While it's a gotcha for people declaring their own types, the vast majority of people will use component types via importing other components, and as such it makes sense to provide the same convenience we know from class components
#2522
feat(svelte2tsx): autotype `const load = ...` declarations (#2540)
fix: migrate glob file watch for chokidar v4 (#2551)
#2539
chokidar v4 removes all glob support. This migrates fallback watcher and CSS global var to use the ignored config
fix: add Sveltekit snippets for Svelte 5 (#2548)
---------
Co-authored-by: Alexandre Oger <alexandre.oger@fabernovel.ey.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fix: correctly position quick fixes in instance and module (#2531)
closes #2529
feat: provide Svelte 5 component migration command
fix: include named exports in svelte 5 type (#2528)
fixes sveltejs/svelte#13508
fix: relax component constructor type (#2524)
Since , we're no longer adding the `[evt: string]: CustomEvent<any>` index signature to components in runes mode not using `createEventDispatcher`. This revealed a type bug in our `ATypedSvelteComponent` type. It was to restricting, because TypeScript will resolve the empty event object to a handler with callback type `never`, which then means the `__sveltets_2_ensureComponent` generic no longer picks the right type, resulting in generics not being resolved properly. Fix this by relaxing the constraints.
Fixes #2523
chore: upgrade to chokidar 4 (#2502)
Also remove long-obsolete sapper handling
fix: check project files update more aggressively before assigning service (#2518)
#2516
Most of the time, the didOpen request is earlier than the watcher event. So if the file doesn't exist in the GlobalSnapshotManager we manually invoke the project file update check. This won't cause 2 project files check because if the file already is a project file we won't check project files.
breaking(svelte5): only generate function component shape in runes mode (#2517)
When a component is in runes mode and not using slots or events, adjust the output to only create the function type that mimics the underlying real shape of components in Svelte 5. This is a breaking change because previously the type was enhanced such that it also had the legacy class shape. As a result, users now may need to switch to `typeof Component` when using the component inside types.
Sadly, due to a combination of requirements and TypeScript limitations, we need to always create both a legacy class component and function component type.
- Constraints: Need to support Svelte 4 class component types, therefore we need to use __sveltets_2_ensureComponent to transform function components to classes
- Limitations: TypeScript is not able to preserve generics during said transformation (i.e. there's no way to express keeping the generic etc)
TODO Svelte 6/7: Switch this around and not use new Component in svelte2tsx anymore, which means we can remove the legacy class component. We need something like _ensureFnComponent then.
perf: auto import cache for svelte-kit language service proxy (#2513)
#2464
getPackageJsonsVisibleToFile and getGlobalTypingsCacheLocation are singleton so this should definitely be fine. The proxy language service has the exact list of entry files and the auto-typing also doesn't add any export so it should be fine to just proxy these methods.
fix: revert additional two-way-binding checks (#2508)
This reverts commit 8c080cf36286984439b468e089e6e4eaacd4230e.
This reverts #2477. Sadly, the idea didn't work out, as shown by two opened bug reports:
- #2506: A type union can be narrowed on the input, but not on the way back out
- #2494: A generic nested within a bound value is not properly resolved and not falling back to `any` (in #2477 we thought of the generic case, but only for when the generic is the whole value type, not when it's nested)
For these reasons I don't see a way to properly implement #1392 at the moment.
chore: revert accidental commit
fix: make no Svelte files found a warning (#2507)
There were reports that this was too overzealous as some people use this potentially not knowing whether or not this is a Svelte-projects, too. Therefore only issue a warning instead of an error.
fix: include files indirectly belonging to a project into correct project (#2488)
Fixes #2486
Fixes #2485
fix: silence type error in old d.ts files
svelte-jsx and svelte-shims are used for Svelte 3 only, and are likely out of date, yet we don't want to invest time into adjusting them anymore, therefore silence any type errors in it.
Helps with #2498
fix: update SvelteKit trailingSlash types (#2496)
fix: add constraint to inference
Else the type is not properly resolved sometimes
Fixes a type issue with Threlte
fix: remove process declaration
Likely added during ancient times for Svelte Native. It now gets in the way, and SvelteNative folks can add a declaration themselves if they need to
Fixes #2483
chore: add homepage/repository fields
chore: show more error diagnostics for emitDts
closes #2371
fix: detect `<script module>` tag (#2482)
This was missing in #2473
Possibly related to sveltejs/svelte#13039
feat: allow autoImportFileExcludePatterns to ignore files outside the root (#2480)
part of #2479
fix: Svelte module resolution tweaks (#2481)
Svelte files are now resolved by intercepting checks for .d.svelte.ts instead of .svelte.ts. As a consequence, we can handle sibling foo.svelte / foo.svelte.ts files and importing both. When doing import Foo from './foo.svelte this now resolves to the Svelte file (prio to #2463 it would resovle to the .svelte.ts file), and doing import Foo from './foo.svelte.js will resolve to the TS file.
feat: better type checking for bindings in Svelte 5 (#2477)
#1392
This adds enhanced type checking for bindings in Svelte 5: We're not only passing the variable in, we're also assigning the value of the component property back to the variable. That way, we can catch type errors like the child binding having a wider type as the input we give it.
It's done for Svelte 5 only because it's a) easier there b) doesn't break as much code (people who upgrade can then also upgrade the types, or use type assertions in the template, which is only possible in Svelte 5).
There's one limitation: Because of how the transformation works, we cannot infer generics. In other words, we will not catch type errors for bindings that rely on a generic type. The combination of generics + bindings is probably rare enough that this is okay, and we can revisit this later to try to find a way to make it work, if it comes up.
Also note that this does not affect DOM element bindings like <input bind:value={...} />, this is only about component bindings.
chore: bump magic-string (#2476)
requires adjustments of mapping tests and a fix in the InlayHintProvider, because more things are mappable now
fix: add server bin to package exports
breaking: vs code / language-server major (#2475)
- use Svelte 4 as built-in version now
- add exports map
- bump vs code ls/client version to 9
- require Node 18 / VS Code 1.82 minimum
- drive-by fix of __sveltets_2_ensureComponent (the previous version didn't work after all)
fix: check error length
breaking: project reference support (#2463)
- closes #2148
- fixes #1234 - due to the change of how files are resolved (breaking change)
- fixes #1976 - less options are now forced (breaking change)
- fixes #2154 (breaking change)
breaking: svelte-check v4 (#2453)
- breaking: make TypeScript a peer dependency
- breaking: require node 18 or later
- breaking: require Svelte 4 or later (devDependencies pinned to Svelte 3 because other packages in this repo still use it. Theoretically we still support Svelte 3 with svelte-check v4 but this gives us the opportunity to adjust that later without a major)
- chore: switch from fast-glob to fdir (#2433)
closes #2397
fixes #2364
---------
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
fix: support module script attribute (#2473)
fixes #2472
chore: publish package provenance info (#2469)
According to https://docs.npmjs.com/generating-provenance-statements#example-github-actions-workflow
closes #2461
chore: fix test
feat: support specifying tsconfig for emitDts (#2454)
part of #2355
feat: replace svelte-preprocess with barebones TS preprocessor (#2452)
Removes the need for a dependency on svelte-preprocess in svelte-language-server, since that was all we used it for.
closes:
- #1683 and #1259, because the situation no longer arises (because we no longer have svelte-preprocess inside the VS Code extension)
- #2391
typo fix in DisagnosticsProvider (#2468)
Co-authored-by: Eric Muckley <22535087+ericmuckley@users.noreply.github.com>
fix: add legacy methods to own component shape (#2451)
see https://github.com/sveltejs/svelte/pull/12666 for why we need this
fix: normalize paths in emitDts map
bug introduced in #2443, affecting windows systems
feat: reference/implementation codelens (#2378)
#2130 Porting VSCode's implementation/reference code lens. This is not enabled by default. To enable this, you'll need to enable the typescript.implementationsCodeLens.enabled config or the typescript.referencesCodeLens.enabled config for lang="ts" and javascript.referencesCodeLens.enabled for js components. Note that we reuse config for ts/js files so it'll also enable the feature in ts/js files.
fix: correctly handle HTML between implicit snippet props (#2450)
The transformation util was wrong: It did not stop moving content between transformations that were after the end marker
#2441
docs: mention `vitePreprocess` (#2440)
fix: various snippet fixes (#2449)
#2444 #2417 #2425 #2385 (comment)
The snippet is now transformed into a function with the return type so that The default parameter type can be inferred:
`const foo = (a: string, b = 1): ReturnType<import('svelte').Snippet> => {}`
fix: map refactor/quick-fix of svelte files in typescript plugin (#2439)
#2435
fix: correctly detect real Svelte files for declarationMap (#2443)
#2442
chore: better "cannot use `bind:`" error message (#2429)
feat: warn on likely failed d.ts file generation (#2428)
emitDts now warns when it detects diagnostics that likely mean the `d.ts` file was not generated
fix: no implicit children prop when using slot (#2427)
Using a slot tag means we're in a legacy component, which means we shouldn't pass the children prop implicitly
fixes https://github.com/sveltejs/svelte/issues/12240
chore: bump html/css language service (#2424)
#2224 #2265 #2390
fix: always set bindings/exports in Svelte 5 (#2423)
Those two methods are needed in Svelte 5, but we don't always set them. That was fine until TS 5.5, which infers generics slightly differently and turns `Exports` and `Bindings` to `never` if they don't show up in the input (before they were not)
fix: detect root snippets correctly
previously snippets inside top level if blocks etc where wrongfully detected as being a root snippet
fix: handle issues with svelte file watching (#2421)
Fix the neovim file-watching issue mentioned in Discord by checking if a directory actually exists before watching it.
Also fixes #2419 through several measures:
- don't close a document when it was changed
- fix the retrieval of the document (pathToUrl) was missing
fix: prevent false positive store declarations (#2422)
variable declarations not at the top level can't be subscribed to using the `$` prefix
fix: more robust start tag detection
make sure we do the cheaper component/element autocompletion lookup in more cases
#2394
chore: upgrade to TS 5.5 (#2415)
fix: handle optional args in snippets (#2414)
#2406
fix: watch svelte files and project files outside workspace (#2299)
#2233 #2393
update project files(tsconfig.include) when a new client file is opened. So files included in both tsocnfig.json will be loaded into the respecting language service.
fix: snippets with TS incorrect transformation (#2412)
After sveltejs/svelte#12070 the AST for the SnippetBlock has changed (to be more correct).
The problem is that svelte2tsx was using that wrong information for the transformation. This means that currently last version of svelte produces wrong ts code from svelte2tsx.
chore: remove import-fresh dependency (#2413)
No dependency inside svelte-check uses it anymore. If it creeps back in check if the dependency uses a version that fixed https://github.com/sindresorhus/import-fresh/issues/18
chore: move fast-glob to devDependencies (#2400)
Was always bundled, no need to have in dependencies
fix: support more types of component type defintion in completion (#2407)
* fix: support more types of component type definition
* ts-ignore Component import
* format
fix: adjust ambient module snipping logic
Since https://github.com/sveltejs/svelte/pull/12061 the `declare module "*.svelte" {..}` declaration contains more closing braces and the logic to snip it out is now outdated. This updates the logic to instead look for the first bracket that comes directly after one line.
chore: adjust test snapshot for latest svelte 5 (#2402)
chore: upgrade to pnpm 9 (#2398)
chore: update github workflows (#2399)
chore: speed up regex
#2363
fix: typo in CSS service code (#2389)
fix: account for added code in the range of inlay hint (#2387)
feat: Svelte 5 component class/function interop (#2380)
Svelte 5 uses functions to define components under the hood. This should be represented in the types. We can't just switch to using functions though because d.ts files created from Svelte 4 libraries should still w…
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a typo
occured→occurredin the IntelliSense description for theonerrorattribute of<svelte:boundary>.This text is surfaced to users in editor autocomplete/hover (via the HTML data provider in the Svelte language server):
Spelling only — no behavior change.