liveBook · Manning

Web Components Language Server

As explained in Web Component Development with Modern Libraries and Tooling

Web Components Language Server is a language-server extension that provides editor assistance for custom elements described by a Custom Elements Manifest.

Web Components Language Server is a VS Code extension that adds help pop-ups and IntelliSense for custom elements described by a Custom Elements Manifest (CEM). The manifest records component attributes, properties, styling, and events as API documentation. section 1.5 section 10.5

Use the extension with a project CEM file to:

  • Hover over a custom-element instance to see its documented API. section 10.5
  • Receive matching custom-element names as you type. section 10.5
  • Choose supported attributes and receive suggested attribute values. section 10.5
  • Refresh VS Code after generating or changing custom-elements.json so the extension rereads the manifest. section 10.5

Editing a documented component

In a project containing the vanilla hello-world component, type part of its custom-element name in VS Code and select the suggested match. After typing a space, choose one of its documented attributes and accept a suggested value. Hovering over the completed element opens its help pop-up. section 10.5

export default {
  libraries: {
    "ch10/cem-demo": {
      manifestSrc: "./ch10/cem-demo/custom-elements.json",
    },
  },
};

When the VS Code window is opened on an ancestor directory, wc.config.js can identify the CEM file for each project subdirectory. section 10.5

How Web Component Development with Modern Libraries and Tooling covers it

How deep it goes
Covers manifest placement, workspace configuration, reloads, hover help, and completion for element names, attributes, and values.
Examples
Demonstrates vanilla hello-world and hello-lit pop-ups plus completion lists for element names, attributes, and values.
What it assumes
Assumes a project with a generated Custom Elements Manifest and a VS Code workspace opened at the appropriate project directory.
What you can do after
Operate/configure it by placing custom-elements.json correctly, reloading VS Code, and using hover and completion assistance.
How it connects
Connects Custom Elements Manifest files with custom elements, attributes, properties, styling, events, and IntelliSense.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Component Development with Modern Libraries and Tooling. The section links point to the parts of the book it draws on.