pub struct HTMLLanguageService { /* private fields */ }Expand description
This is a collection of features necessary to implement an HTML language server
Make sure you activated the features you need of the html-languageservice crate on Cargo.toml
§Features
- completion
- hover
- formatter
- highlight
- links
- symbols
- folding
- selection_range
- rename
- matching_tag_position
- linked_editing
Implementations§
Source§impl HTMLLanguageService
impl HTMLLanguageService
Sourcepub fn new(options: &HTMLLanguageServiceOptions) -> HTMLLanguageService
pub fn new(options: &HTMLLanguageServiceOptions) -> HTMLLanguageService
Examples found in repository?
examples/parse-speed/main.rs (line 12)
6fn main() {
7 let content = fs::read_to_string("examples/parse-speed/index.html").unwrap();
8
9 let document = FullTextDocument::new("html".to_string(), 0, content);
10
11 let start_time = time::SystemTime::now();
12 let ls = HTMLLanguageService::new(&HTMLLanguageServiceOptions::default());
13 ls.parse_html_document(&document, &HTMLDataManager::default());
14 let end_time = time::SystemTime::now();
15 let duration = end_time.duration_since(start_time).unwrap();
16 // vscode-languageservice time: 55ms
17 println!("{:?}", duration);
18}pub fn create_scanner<'a>( &self, input: &'a str, initial_offset: usize, ) -> Scanner<'a>
pub fn create_data_manager( &self, use_default_data_provider: bool, custom_data_providers: Option<Vec<Box<dyn IHTMLDataProvider>>>, ) -> HTMLDataManager
Sourcepub fn parse_html_document(
&self,
document: &FullTextDocument,
data_manager: &HTMLDataManager,
) -> HTMLDocument
pub fn parse_html_document( &self, document: &FullTextDocument, data_manager: &HTMLDataManager, ) -> HTMLDocument
Examples found in repository?
examples/parse-speed/main.rs (line 13)
6fn main() {
7 let content = fs::read_to_string("examples/parse-speed/index.html").unwrap();
8
9 let document = FullTextDocument::new("html".to_string(), 0, content);
10
11 let start_time = time::SystemTime::now();
12 let ls = HTMLLanguageService::new(&HTMLLanguageServiceOptions::default());
13 ls.parse_html_document(&document, &HTMLDataManager::default());
14 let end_time = time::SystemTime::now();
15 let duration = end_time.duration_since(start_time).unwrap();
16 // vscode-languageservice time: 55ms
17 println!("{:?}", duration);
18}Trait Implementations§
Auto Trait Implementations§
impl Freeze for HTMLLanguageService
impl RefUnwindSafe for HTMLLanguageService
impl Send for HTMLLanguageService
impl Sync for HTMLLanguageService
impl Unpin for HTMLLanguageService
impl UnsafeUnpin for HTMLLanguageService
impl UnwindSafe for HTMLLanguageService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more