SvelteStyleLink is a VS Code extension that lets you jump from any class name used inside your Svelte components straight to the CSS/SCSS selector that styles it. No more hunting through <style> blocks or external stylesheets. Takes you exactly where you need to be.
class="..." and trigger VS Code’s “Go to Definition”. You’ll land on the matching .your-class selector.<style> awareness – works with CSS/SCSS declared in the same .svelte file, including <style lang="scss">.*.css and *.scss files and opens the first match. Ideal for shared utility sheets.F12, Cmd/Ctrl+Click, and “Peek Definition” all use the provider.If installed via the extension manager, it just works. No configuration.
To install the project
git clone https://github.com/tumininucodes/sveltestylelink.git
cd sveltestylelink
npm install
To run it locally during development, press F5 inside VS Code to launch an Extension Development Host. For distribution:
npm run package
This produces a .vsix you can install via code --install-extension.
.svelte file containing a class="" attribute.hero-card).F12, Cmd/Ctrl+Click, or select “Peek Definition”.<style> section or in the first external stylesheet match.If no selector exists, VS Code stays put—no disruptive errors.
The extension registers a DefinitionProvider (see src/SvelteCSSDefinitionProvider.ts) for the Svelte language:
class="" attribute.<style> block for .className.vscode.workspace.findFiles("**/*.{css,scss}"), opens each, and checks for the selector.vscode.Location corresponding to the first match, which VS Code opens for you.This keeps lookups lightweight while covering the most common Svelte styling patterns.
No user settings are required.
class: directives and utility-first conventions.MIT © SvelteStyleLink contributors.