html_languageservice/
participant.rs1use async_trait::async_trait;
2use lsp_textdocument::FullTextDocument;
3use lsp_types::{CompletionItem, Hover, Position, Range};
4
5use crate::parser::html_document::HTMLDocument;
6
7#[async_trait]
8pub trait ICompletionParticipant: Send + Sync {
9 async fn on_html_attribute_value(
10 &self,
11 context: HtmlAttributeValueContext,
12 ) -> Vec<CompletionItem>;
13 async fn on_html_content(&self, context: HtmlContentContext) -> Vec<CompletionItem>;
14}
15
16#[async_trait]
17pub trait IHoverParticipant: Send + Sync {
18 async fn on_html_attribute_value(&self, context: HtmlAttributeValueContext) -> Option<Hover>;
19 async fn on_html_content(&self, context: HtmlContentContext) -> Option<Hover>;
20}
21
22pub struct HtmlAttributeValueContext {
23 pub document: FullTextDocument,
24 pub html_document: HTMLDocument,
25 pub position: Position,
26 pub tag: String,
27 pub attribute: String,
28 pub value: String,
29 pub range: Range,
30}
31
32pub struct HtmlContentContext {
33 pub document: FullTextDocument,
34 pub html_document: HTMLDocument,
35 pub position: Position,
36}