Skip to content

Commit

Permalink
Integrate highlight provider
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed May 7, 2019
1 parent 742704e commit 0f5d5b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/highlight/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
mod latex_label;

use self::latex_label::LatexLabelHighlightProvider;
use crate::concat_feature;
use crate::feature::FeatureRequest;
use lsp_types::{DocumentHighlight, TextDocumentPositionParams};

pub struct HighlightProvider;

impl HighlightProvider {
pub async fn execute(
request: &FeatureRequest<TextDocumentPositionParams>,
) -> Vec<DocumentHighlight> {
concat_feature!(&request, LatexLabelHighlightProvider)
}
}
7 changes: 5 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::completion::CompletionProvider;
use crate::definition::DefinitionProvider;
use crate::feature::FeatureRequest;
use crate::folding::FoldingProvider;
use crate::highlight::HighlightProvider;
use crate::hover::HoverProvider;
use crate::link::LinkProvider;
use crate::reference::ReferenceProvider;
Expand Down Expand Up @@ -73,7 +74,7 @@ impl LatexLspServer {
type_definition_provider: None,
implementation_provider: None,
references_provider: Some(true),
document_highlight_provider: None,
document_highlight_provider: Some(true),
document_symbol_provider: None,
workspace_symbol_provider: None,
code_action_provider: None,
Expand Down Expand Up @@ -172,7 +173,9 @@ impl LatexLspServer {
&self,
params: TextDocumentPositionParams,
) -> Result<Vec<DocumentHighlight>> {
Ok(Vec::new())
let request = request!(self, params)?;
let results = await!(HighlightProvider::execute(&request));
Ok(results)
}

#[jsonrpc_method("textDocument/documentSymbol")]
Expand Down

0 comments on commit 0f5d5b6

Please sign in to comment.