Tailwind CSS IntelliSense enhances the Tailwind development experience by providing Visual Studio Code users with advanced features such as autocomplete, syntax highlighting, and linting.
- Visual Studio Code Intellisense Slow
- Visual Studio Code Intellisense Not Working C++
- Visual Studio Code Intellisense Not Working
Installation
In order for the extension to activate you must have tailwindcss
installed and a Tailwind config file named tailwind.config.js
or tailwind.js
in your workspace.
Features
IntelliSense is a name given to a set of features that make coding more convenient. Since different people have different ideas about what is convenient, virtually all of the IntelliSense features can be enabled or disabled in the Options dialog box, under Text Editor C/C Advanced. IntelliSense Intelligent Tailwind CSS tooling for Visual Studio Code. Tailwind CSS IntelliSense enhances the Tailwind development experience by providing Visual Studio Code users with advanced features such as autocomplete, syntax highlighting, and linting.
Autocomplete
Intelligent suggestions for class names, as well as CSS functions and directives.
Linting
Highlights errors and potential bugs in both your CSS and your markup.
Hover Preview
See the complete CSS for a Tailwind class name by hovering over it.
CSS Syntax Highlighting
Provides syntax definitions so that Tailwind features are highlighted correctly.
Recommended VS Code Settings
VS Code has built-in CSS validation which may display errors when using Tailwind-specific syntax, such as @apply
. You can disable this with the css.validate
setting:
By default VS Code will not trigger completions when editing 'string' content, for example within JSX attribute values. Updating the editor.quickSuggestions
setting may improve your experience, particularly when editing Tailwind classes within JSX:
Extension Settings
tailwindCSS.includeLanguages
This setting allows you to add additional language support. The key of each entry is the new language ID and the value is any one of the extensions built-in languages, depending on how you want the new language to be treated (e.g. html
, css
, or javascript
):
tailwindCSS.emmetCompletions
Enable completions when using Emmet-style syntax, for example div.bg-red-500.uppercase
. Default: false
tailwindCSS.colorDecorators
Controls whether the editor should render inline color decorators for Tailwind CSS classes and helper functions.
inherit
: Color decorators are rendered ifeditor.colorDecorators
is enabled.on
: Color decorators are rendered.off
: Color decorators are not rendered.
tailwindCSS.showPixelEquivalents
Show px
equivalents for rem
CSS values in completions and hovers. Default: true
tailwindCSS.rootFontSize
Root font size in pixels. Used to convert rem
CSS values to their px
equivalents. See tailwindCSS.showPixelEquivalents
. Default: 16
tailwindCSS.validate
Enable linting. Rules can be configured individually using the tailwindcss.lint
settings:
ignore
: disable lint rule entirelywarning
: rule violations will be considered 'warnings,' typically represented by a yellow underlineerror
: rule violations will be considered 'errors,' typically represented by a red underline
Visual Studio Code Intellisense Slow
tailwindCSS.lint.invalidScreen
Unknown screen name used with the @screen
directive. Default: error
tailwindCSS.lint.invalidVariant
Unknown variant name used with the @variants
directive. Default: error
tailwindCSS.lint.invalidTailwindDirective
Visual Studio Code Intellisense Not Working C++
Unknown value used with the @tailwind
directive. Default: error
tailwindCSS.lint.invalidApply
Unsupported use of the @apply
directive. Default: error
tailwindCSS.lint.invalidConfigPath
Unknown or invalid path used with the theme
helper. Default: error
tailwindCSS.lint.cssConflict
Class names on the same HTML element which apply the same CSS property or properties. Default: warning
Troubleshooting
If you’re having issues getting the IntelliSense features to activate, there are a few things you can check:
- Ensure that you have a Tailwind config file in your workspace and that this is named
tailwind.config.js
ortailwind.js
. Check out the Tailwind documentation for details on creating a config file. - Ensure that the
tailwindcss
module is installed in your workspace, vianpm
,yarn
, orpnpm
. Tailwind CSS IntelliSense does not currently support Yarn Plug'n'Play. - If you installed
tailwindcss
or created your config file while your project was already open in Visual Studio Code you may need to reload the editor. You can either restart VS Code entirely, or use theDeveloper: Reload Window
command which can be found in the command palette. - Make sure your VS Code settings aren’t causing your Tailwind config file to be excluded from search, for example via the
search.exclude
setting.
Using the Go extension for Visual Studio Code, you get features like IntelliSense, code navigation, symbol search, testing, debugging, and many more that will help you in Go development.
You can install the Go extension from the VS Code Marketplace.
Watch 'Getting started with VS Code Go' for an explanation of how to build your first Go application using VS Code Go.
This article describes only a subset of the features the Go extension provides. See the extension's documentation for the full, up-to-date list of supported features.
IntelliSense
IntelliSense features are provided by the Go language server, gopls, maintained by the Go team. You can configure the behavior of gopls
using the gopls
settings.
Auto completions
As you type in a Go file, you can see IntelliSense providing you with suggested completions. This even works for members in current, imported, and not yet imported packages. Just type any package name followed by .
, and you will get suggestions for the corresponding package members.
Tip: Use ⌃Space (Windows, Linux Ctrl+Space) to trigger the suggestions manually.
Hover Information
Hovering on any variable, function, or struct will give you information on that item such as documentation, signature, etc.
Signature help
When you open the (
while calling a function, a pop-up provides signature help for the function. As you keep typing the parameters, the hint (underline) moves to the next parameter.
Tip: Use ⇧⌘Space (Windows, Linux Ctrl+Shift+Space) to manually trigger the signature help when the cursor is inside the ()
in the function call.
Code navigation
Code navigation features are available in the context menu in the editor.
Visual Studio Code Intellisense Not Working
- Go To DefinitionF12 - Go to the source code of the type definition.
- Peek Definition⌥F12 (Windows Alt+F12, Linux Ctrl+Shift+F10) - Bring up a Peek window with the type definition.
- Go to References⇧F12 (Windows, Linux Shift+F12) - Show all references for the type.
- Show Call Hierarchy⇧⌥H (Windows, Linux Shift+Alt+H) - Show all calls from or to a function.
You can navigate via symbol search using the Go to Symbol commands from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)).
- Go to Symbol in File - ⇧⌘O (Windows, Linux Ctrl+Shift+O)
- Go to Symbol in Workspace - ⌘T (Windows, Linux Ctrl+T)
You can also navigate back and forth between a Go file and its test implementation using the Go: Toggle Test File command.
Build, test, and diagnose
The Go language server (gopls
) detects build and vet errors found on the workspace. The errors and warnings from running any/all of the above will be shown red/green squiggly lines in the editor. These diagnostics also show up in the Problems panel (View > Problems).
You can add additional lint checks using the go.lintOnSave
setting and configuring your choice of linting tool (staticcheck
, golangci-lint
, or revive
) using the go.listTool
setting.
You can configure the extension to run tests and compute test coverage using:
go.testOnSave
go.coverOnSave
go.testFlags
Formatting
You can format your Go file using ⇧⌥F (Windows Shift+Alt+F, Linux Ctrl+Shift+I) or by running the Format Document command from the Command Palette or the context menu in the editor.
By default, formatting is run when you save your Go file. You can disable this behavior by setting editor.formatOnSave
to false
for the [go]
language identifier. You can change this using your JSON setting files.
When you have multiple formatters activated for Go files, you can select the Go extension as the default formatter.
Formatting is provided by gopls
. If you want gofumpt
-style formatting, you can configure gopls
to use gofumpt
.
Test
There are many test-related commands that you can explore by typing Go: test in the Command Palette.
The first three above can be used to generate test skeletons for the functions in the current package, file, or at the cursor using gotests
. The last few can be used to run tests in the current package, file, or at the cursor using go test
. There is also a command for getting test coverage.
Import packages
Run the command Go: Add Import to get a list of packages that can be imported to your Go file. Choose one and it will get added in the import block of your Go file.
Rename symbols
You can rename symbols using F2 or by running the Rename Symbol command in the context menu in the editor.
Debugging
The Go extension lets you debug Go code as well. You will need to install the Delve debugger manually as a prerequisite. Read Debug Go programs in VS Code for setup steps, information on remote debugging and a troubleshooting guide.
Next steps
This has been a brief overview showing the Go extension features within VS Code. For more information, see the details provided in the Go extension README.
To stay up to date on the latest features/bug fixes for the Go extension, see the CHANGELOG.
If you have any issues or feature requests, feel free to log them in the Go extension vscode-go repo.
If you'd like to learn more about VS Code, try these topics:
- Basic Editing - A quick introduction to the basics of the VS Code editor.
- Install an Extension - Learn about other extensions are available in the Marketplace.
- Code Navigation - Move quickly through your source code.