html-languageservice
The project is a rewrite of vscode-html-languageservice use
rust. It has all the features of the original project while still having higher performance.
This project is a collection of features necessary to implement an HTML language server.
Features
- customize data providers
- parse html document
- scanner
- completion -
completionfeature activate - hover -
hoverfeature activate - formatter -
formatterfeature activate - find document highlights -
highlightfeature activate - find document links -
linksfeature activate - find document symbols -
symbolsfeature activate - get folding ranges -
foldingfeature activate - get selection ranges -
selection_rangefeature activate - quote complete -
completionfeature activate - tag complete -
completionfeature activate - rename -
renamefeature activate - find matching tag position -
matching_tag_positionfeature activate - find linked editing ranges -
linked_editingfeature activate
Usage
Make sure you activated the full features of the html-languageservice crate on Cargo.toml:
= { = "0.6.1", = ["full"] }
You can also activate only some of the features you need on Cargo.toml:
= { = "0.6.1", = ["completion", "hover"] }
Create the HTMLLanguageService struct in first.
Second, You need to prepare: document and position.
Then, parse document as html_document you need to HTMLDataManager, tags, attributes, and attribute value data are stored in the HTMLDataManager.
Finally, call a function or method to get the result.
For more see docs.rs