How to make VS Code extensions: guide & best practices
Aiming to start writing extensions for Visual Studio Code? You’re in the right place to kick things off! This series of blog posts will provide you with fundamental information on getting started with extension development for VS Code. We’ve gleaned all the information in this series from our experiences developing our own extension, Symflower for Visual Studio Code. Read on for key insights and best practices that will help you efficiently develop extensions for VS Code that are also well tested!
Getting started
We have an excellent step-by-step guide to get you started on your first VS Code extension which teaches you some basic concepts of the API:
Language Server Protocol
Extensions that implement developer tooling such as autocompletion or go-to-definition for a programming language should use the Language Server Protocol, where all of the functionality is implemented in an external program that communicates with VS Code (and other editors that support the standard) over RPC. We’ve written up a guide with tips and tricks for using a language server in an extension:
Testing
In these posts we share some of our experience in testing extensions.
- Timeout-based checks in extension tests
- Modifying the VS Code installation used in tests
- Shows you how to install other extensions in tests.
- Can also be used to test the compiled VSIX file or an already-released extension instead.
- A more robust way to install VS Code for extension testing
- Showcases an alternative implementation of the function used to install VS Code in extension tests.
- Avoids file corruption in installations by not re-using an installation over multiple test runs.
- Caches archives instead of uncompressed installation folders and verifies checksums.
Official Resources
- The VS Code website has some helpful pages about extension development
- There is also an API reference
Community
Sometimes you might also want to search the issue tracker for VS Code on GitHub for feature requests and open problems, or create an issue yourself. There is a label called “extensions-development” specifically for issues related to developing extensions.
Feedback
If you have any questions or feedback for our articles or our plugin, we’d love to hear from you! You can send us an hello@symflower.com or find us on social media.