Skip to content

Introduce element validation and LSP goodies #79

Merged
kristoff-it merged 4 commits intomainfrom
nested-errors
Sep 13, 2025
Merged

Introduce element validation and LSP goodies #79
kristoff-it merged 4 commits intomainfrom
nested-errors

Conversation

@kristoff-it
Copy link
Copy Markdown
Owner

This commit introduces an entirely new system that validates attributes
and element nesting, alongside all the major features expected by a
language server.

Note that all new validation is not compatible with templating languages,
support for that will be explored in the near future, but for now this is
strictly for vanilla html (validation is disabled entirely for SuperHTML
templates at the moment as well).

All of this code is considered experimental so if you build superhtml
from this commit, be warned that you will probably encounter bugs, but
beta testing is appreciated at this stage.

If you want to report a bug, please take a good read at the Issue
templates, as I'm asking submitters to provide a reference to the HTML
spec section that the bug pertains to, in order to minimize the amount
of bad issues that complain about correct -- but maybe lesser known
-- errors.

On the front of the language server, we now provide:

  • diagnostics for all kinds of errors
  • autocomplete for element names, attribute names, and attribute values
  • symbol rename on element names to change both tags at once
  • linked edits to achieve the same as above (when supported by the
    editor, see add documentHighlight and linkedEditingRange support for tags #74)
  • duplicate class name warnings
  • find all references for class names
  • descriptions for all elements, attributes and attribute values of
    enumerated attributes (i.e. attributes whose values are options in a
    list).

The autoformatter uses now a new formatting layout where the first
attribute is kept on the same line as the element name.

Additionally, the autoformatter now uses tabs for indentation and spaces
for alignment. This is also experimental and might be reverted in the
future.

This commit introduces an entirely new system that validates attributes
and element nesting, alongside all the major features expected by a
language server.

Note that all new validation is not compatible with templating languages,
support for that will be explored in the near future, but for now this is
strictly for vanilla html (validation is disabled entirely for SuperHTML
templates at the moment as well).

All of this code is considered experimental so if you build superhtml
from this commit, be warned that you will probably encounter bugs, but
beta testing is appreciated at this stage.

If you want to report a bug, please take a good read at the Issue
templates, as I'm asking submitters to provide a reference to the HTML
spec section that the bug pertains to, in order to minimize the amount
of bad issues that complain about correct -- but maybe lesser known
-- errors.

On the front of the language server, we now provide:
- diagnostics for all kinds of errors
- autocomplete for element names, attribute names, and attribute values
- symbol rename on element names to change both tags at once
- linked edits to achieve the same as above (when supported by the
  editor, see #74)
- duplicate class name warnings
- find all references for class names
- descriptions for all elements, attributes and attribute values of
  enumerated attributes (i.e. attributes whose values are options in a
  list).

The autoformatter uses now a new formatting layout where the first
attribute is kept on the same line as the element name.

Additionally, the autoformatter now uses tabs for indentation and spaces
for alignment. This is also experimental and might be reverted in the
future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant