SvelteThemes
SvelteThemes
Themes
Resources
Favorites
Paid
Updates
Submit
Vscode Svelte Extension
raresraulea
Need a Svelte website built?
Hire a professional Svelte developer today.
Download
VSCode Extension APIs
Register, Activate, Invoke commands
Await commands response => Act based on that
Debug console shows the extension’s node process output and logs
Compile extension with webpack + watch mode
Create New WebviewTab (Tab)
Rendering custom HTML
Loading custom CSS
Running custom JS scripts
Inject Svelte into the body => use svelte to create VSCode extension UIs
Compile extension with webpack => generates prod bundle inside dist/
Concurrently compile svelte with rollup => generates prod bundle inside out/compiled/
[IDEA]: Why not create portable Svelte components that can be used in the VSCode extension and in the Web App hydrated by the C# backend?
Create refresh command
Automatically/programatically restarting a WebView
Automatically/programatically open WebView Developer Tools
Keybind Alt + R to run this “refresh” command
Result: change svelte components => press alt + R => refresh webview, open dev console
Add sidebar view
Custom icon, title, category etc
Hotkey for automatically reloading sidebar with new compiled svelte components and new CSS
Add Svelte Todo list inside the sidebar
Use VSCode APIs in Svelte: inject tsvscode APIs globally
Inject it through the sidebar providers script
declare it as a globally available variable through a TS declaration file which also needs to import * from vscode (?)
Send data from Svelte components to the Sidebar provider
post Info messages that the sidebar provider listens for
post Error messages that the sidebar provider listens for
Send data from text editor (webview) inside the sidebar
Register new command
The command accesses the active text editor and it’s selection (selected text)
The extension (through the command) posts a message to the sidebarProvider._view?.webview
The sidebar svelte component adds an event listener on mount for receiving info;
The component handles incoming todos from the extension
Execute command on click of a status bar item (bottom VScode menu)
Create an Express API for GitHub authentication
Create GitHub auth endpoint
Create successful auth return endpoint
Use passport and passport GitHub for the GitHub authentication process
Use JsonWenToken for auth token generation
Connect to a PostgreSQL database and create the user entity
Return data about the current user based on the auth header
Use TypeORM as an ORM
Llibraries used: dotenv-safe, express, jsonwebtoken, nodemon, pg, reflect-metadata. typeorm
Create a polka API
Runs during the authentication process
Exposes a callback endpoint where the token is received from the express API after successful authentication
The callback endpoint stores the authentication token using a TokenManager
Svelte sidebar fetch authenticated user details
Bidirectional Extension <-> Svelte Sidebar communication through PUB-SUB messages
Top categories
tailwind
daisyui
admin template
popup
mdsvex
portfolio
blog
form
ecommerce
ui
carousel
auth
dark
seo
image
routing
Need a Svelte website built?
Hire a professional Svelte developer today.