vscode-extension-samples README

The project's README from github.com/microsoft/vscode-extension-samples. As one markdown file: README.md.

VS Code Extension Samples

This repository contains sample code illustrating the VS Code extension API. Each sample is a self-contained extension that explains one topic in VS Code API or VS Code's Contribution Points. You can read, play with or adapt from these samples to create your own extensions.

You can expect from each sample:

Prerequisites

You need to have node and npm installed on your system to run the examples. It is recommended to use the node version used for VS Code development itself which is documented here

Usage

Getting Started

Samples

Sample Guide on VS Code Website API & Contribution
Webview Sample /api/extension-guides/webview window.createWebviewPanel
window.registerWebviewPanelSerializer
Webview View Sample N/A window.registerWebviewViewProvider
Webview Codicons Sample N/A
Status Bar Sample N/A window.createStatusBarItem
StatusBarItem
Tree View Sample /api/extension-guides/tree-view window.createTreeView
window.registerTreeDataProvider
TreeView
TreeDataProvider
contributes.views
contributes.viewsContainers
Task Provider Sample /api/extension-guides/task-provider tasks.registerTaskProvider
Task
ShellExecution
contributes.taskDefinitions
Multi Root Sample N/A workspace.getWorkspaceFolder
workspace.onDidChangeWorkspaceFolders
Completion Provider Sample N/A languages.registerCompletionItemProvider
CompletionItem
SnippetString
Code Actions Sample N/A languages.registerCodeActionsProvider
CodeActionProvider
File System Provider Sample N/A workspace.registerFileSystemProvider
Editor Decorator Sample N/A TextEditor.setDecorations
DecorationOptions
DecorationInstanceRenderOptions
ThemableDecorationInstanceRenderOptions
window.createTextEditorDecorationType
TextEditorDecorationType
contributes.colors
L10n Sample N/A
Terminal Sample N/A window.createTerminal
window.onDidChangeActiveTerminal
window.onDidCloseTerminal
window.onDidOpenTerminal
window.Terminal
window.terminals
Extension Terminal Sample N/A window.createTerminal
window.Pseudoterminal
window.ExtensionTerminalOptions
Color Theme Sample /api/extension-guides/color-theme contributes.themes
Product Icon Theme Sample /api/extension-guides/product-icon-theme contributes.productIconThemes
Vim Sample N/A commands
StatusBarItem
window.createStatusBarItem
TextEditorCursorStyle
window.activeTextEditor
Position
Range
Selection
TextEditor
TextEditorRevealType
TextDocument
webpack-sample /api/working-with-extensions/bundling-extension
esbuild-sample /api/working-with-extensions/bundling-extension
Source Control Sample /api/extension-guides/scm-provider workspace.workspaceFolders
SourceControl
SourceControlResourceGroup
scm.createSourceControl
TextDocumentContentProvider
contributes.menus
Commenting API Sample N/A
Document Editing Sample N/A commands
Custom Data Sample /api/extension-guides/custom-data-extension
CodeLens Provider Sample N/A languages.registerCodeLensProvider
CodeLensProvider
CodeLens
Call Hierarchy Sample N/A languages.registerCallHierarchyProvider
CallHierarchyProvider
CallHierarchyItem
CallHierarchyOutgoingCall
CallHierarchyIncomingCall
Custom Editors Sample /api/extension-guides/custom-editors window.registerCustomEditorProvider
CustomTextEditorProvider
contributes.customEditors
Semantic tokens /api/language-extensions/semantic-highlight-guide languages.registerDocumentSemanticTokensProvider
vscode.DocumentSemanticTokensProvider
Test Provider Sample N/A
Getting Started Sample N/A
notebook-renderer-sample /api/extension-guides/notebook#notebook-renderer contributes.notebookRenderer
notebook-extend-markdown-renderer-sample /api/extension-guides/notebook#notebook-renderer contributes.notebookRenderer
jupyter-server-provider-sample N/A
Chat Sample N/A
Chat Tutorial N/A
Notifications Sample N/A

Language Server Protocol Samples

Sample Guide on VS Code Website API & Contribution
Snippet Sample /api/language-extensions/snippet-guide contributes.snippets
Language Configuration Sample /api/language-extensions/language-configuration-guide contributes.languages
LSP Sample /api/language-extensions/language-server-extension-guide
LSP Log Streaming Sample N/A
LSP Multi Root Server Sample https://github.com/Microsoft/vscode/wiki/Extension-Authoring:-Adopting-Multi-Root-Workspace-APIs#language-client--language-server
LSP Web Extension Sample /api/language-extensions/language-server-extension-guide
LSP User Input Sample N/A
LSP Embedded Language Service N/A
LSP Embedded Request Forwarding N/A
Wasm language server N/A

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

vscode-extension-samples (microsoft/vscode-extension-samples)

Searching Database…

What is this?A collection of sample VS Code extensions from Microsoft, each a self-contained extension demonstrating one topic of the VS Code extension API or a specific Contribution Point.
Is this a single extension or a collection of many?It's a collection of many separate example extensions (webview, tree view, status bar, task provider, source control, language server, etc.), each in its own folder with its own README.
How do I run one of these samples?Clone the repo, open a sample folder in VS Code (code .), run npm install in the terminal, then press F5 to launch the extension in a new Extension Development Host window. Some samples have their own extra setup steps in their individual README.
What do I need installed first?You need Node.js and npm; it's recommended to use the same Node version documented for VS Code core development.
Where should I start if I'm new to extension development?Start with the Hello World Sample (or its minimal JavaScript version) to learn extension anatomy, then move to topic-specific samples like Webview, Tree View, or Task Provider as needed.
Does it cover Language Server Protocol extensions too?Yes, there is a dedicated set of LSP samples covering snippets, language configuration, a full LSP server, web extension variants, and even a Wasm-based language server.
Can I build extensions that run in the browser (VS Code Web)?Yes, there's a Hello World Web Sample and an LSP Web Extension Sample specifically for building extensions compatible with VS Code for the Web.
Is there a sample for building a chat participant or AI feature?Yes, there are Chat Sample and Chat Tutorial samples demonstrating the chat extension API.
How is each sample's code kept consistent?All samples follow the same code style, enforced using ESLint.
Creator
microsoft
Size
105.1 MB
Stars
10.2K
Updated
CommitSep 05
Age
10y
Commits · 90 Days