microsoft / microsoft/vscode-custom-data

Suggestion: Control when element suggestions can appear based on context.

Open
#16 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
240
Forks
95
PR merge metrics
No merged PRs in 30d

Description

Some HTML tags are only relevant inside of other HTML elements (i.e., <tr> should be inside of a <table>, <thead>, <tfoot>, or <tbody>). Currently there is no way to control when a tag should appear in the auto-suggest list.

I would suggest adding a mechanism to either limit or prioritize specific auto-complete elements using attributes such as:

  • "show": ["tag"] - Indicates the tags to show or prioritize as children of the current tag definition. Allows custom tags
    to indicate existing tags that can be shown beneath the current tag.
  • "showIn": ["tag"] - Indicates this element should be shown or prioritized as a child of a specified tag definition. Allows
    custom tags to indicate they should be included beneath the specified tag.

As an example:

{
  "tags": [
    { "name": "table", "show": ["colgroup", "col", "thead", "tbody", "tfoot", "tr"], ... },
    { "name": "tr", "showIn": ["table", "thead", "tbody", "tfoot"], ... }
  ]
}

This would be helpful for the VSCode extension for Ecmarkup extension I've been working on periodically over the last few years, as certain elements only have meaning as children of other elements (i.e., an <emu-nt> should be the child of an <emu-rhs> and doesn't make sense elsewhere.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the repository's custom data format documentation and sample definitions, then inspect how context affects HTML tag auto-suggestions in the VS Code extension use case. Compare the proposed show and showIn relationships with the existing format and determine how completion filtering or prioritization should be specified. Done means the behavior and schema are clearly defined with a representative example or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.