Skip to content

Latest commit

 

History

History
68 lines (40 loc) · 2.27 KB

README.md

File metadata and controls

68 lines (40 loc) · 2.27 KB

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";