Open sashafirsov opened 8 months ago
Current support for IDEs:
classic HTML5 validator, used by IntelliJ for html code: https://github.com/validator/validator (intelliJ only?)
custom-elements-language-server ( no IntelliJ support yet ) by @Matsuuu
webcomponents / custom-elements-manifest
break-stuff / cem-tools
Intellij:
VS Code:
Phil Fearon 6 hours ago For VS Code, a JSON schema or XML Schema as a base would suffice. Currently, the XSLT/XPath extension for VS Code uses TypeScript (transformed from the XML Schema using XSLT) for linting and auto-completion for XSLT.
VS Code Custom Data allows to enhance VS Code's understanding of new HTML tags, attributes and attribute values.
DCE tags example in VS Code plugin https://github.com/microsoft/vscode-custom-data/issues/89
DCE imports discussion https://github.com/w3c/webcomponents-cg/issues/82
TypeScript Language Service Plugin
Writing a Language Service Plugin
tsconfig.json compilerOptions plugins example todo plugin
Based on example todo plugin plan
proxy.getSemanticDiagnostics = (filename) => {}
Generation has to check the filename
data and target generated file. Only outdated should be re-rendered unless --force
flag set.
generate filename.dce.ts
with DCE load and JSDoc for manifest extraction
generate filename.dce.d.js
generate IntelliJ and VSCode CE JSON definitions
in parsed DOM, check whether DCE instances use declared props or HTMLElement common attributes. Generate error for unknown
DCE instance attributes values to be checked against permitted patterns. Generate error
Generated TS file name to be passed to original TS for compilation/validation.
TS and own errors mix returned
Added comment TSC pre-compilation plugin request: https://github.com/microsoft/TypeScript/issues/38736#issuecomment-1982216307
Phil Fearon
For VS Code, a JSON schema or XML Schema as a base would suffice. Currently, the XSLT/XPath extension for VS Code uses TypeScript (transformed from the XML Schema using XSLT) for linting and auto-completion for XSLT.
generated on fly XSD idea intelliJ
<root xmlns="http://www.example.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org">
the schema would be (re-)generated for the page on fly and serve tags on the top level. Plugin should watch for file changes, update schema, reload it lazily letting the XML check to validate and apply suggestions.
FS watch: chokidar - used by VS Code
In combination with chokidar
the lint is the primary HTML validation tool. From reddit thread
Traditionally you use SGML which is what the W3C validator service at https://validator.w3.org/ is using. For HTML5+, you can use my W3C HTML 5.1 DTD at http://sgmljs.net/docs/w3c-html51-dtd.html (site isn't updated yet for HTML 5.2) and use it with any SGML software such as OpenSP which is used by the W3C validator as well.
You may also have luck using the experimental nu validator (also linked from W3C's validator page), though I'm not sure it's still being maintained, or what coverage it represents relative to the web test suite at https://github.com/web-platform-tests.
Nu Html Checker is Java jar/war . Hence OK for IntelliJ but requires either executable or java runtime for other editors.
HtmlInputStreamReader.java is converted into C for FireFox. Which has a potential for compiling into WASM.
Alternative is to use GWT Java to JS compiler
The HTML5 Live DOM Viewer—in Browser has the converted JS. Perhaps outdated.
caja/src/com/google/caja/plugin /html-emitter.js has an outdated yet JS implementation.
j2cl gives WASM implementation for Nu Html Checker java code. As the last is not extendable, would need to clone the repo and use HTML2HTML utility CC: @jasvir
Created a repo, design on toolkit notes: https://github.com/EPA-WG/custom-element/issues/27
https://github.com/JetBrains/web-types