Introduce element validation and LSP goodies #79
Merged
kristoff-it merged 4 commits intomainfrom Sep 13, 2025
Merged
Conversation
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.
This was referenced Sep 13, 2025
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
editor, see add documentHighlight and linkedEditingRange support for tags #74)
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.