Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>queryselector completionNew to Visual Studio Code? Get it now.
queryselector completion

queryselector completion

tuwrraphael

|
1,905 installs
| (0) | Free
Completes css-selectors in js/ts when typing .querySelector using html files imported (using es6-imports)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

queryselector completion vscode extension

When developing web applications with vanilla js and web components, it is often required to select elements from an imported template with querySelector. This extension provides autocompletion for selectors and a code action to define corresponding class properties.

Features

querySelector completions in javascript/typescript

If a html document is imported via ES6 imports, typing querySelector in js/ts documents triggers autocompletion of possible css selectors.

querySelector completion items

Import the document for example as:

import * as template from "./template.html";

Currently supported completion suggestions:

  • id attributes
  • data-* attributes

Infer type from html when generating class properties for html elements (typescript)

When generating a missing class property, for a querySelector, the type of the property is generated as any. This extension infers the type correctly using the css selector and the imported html template.

class property type inference

As above the document needs to be imported:

import template from "./template.html";
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft