summaryrefslogtreecommitdiff
path: root/support/texlab/src/completion/latex/begin_command.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/src/completion/latex/begin_command.rs')
-rw-r--r--support/texlab/src/completion/latex/begin_command.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/support/texlab/src/completion/latex/begin_command.rs b/support/texlab/src/completion/latex/begin_command.rs
new file mode 100644
index 0000000000..ce6ba17afa
--- /dev/null
+++ b/support/texlab/src/completion/latex/begin_command.rs
@@ -0,0 +1,30 @@
+use super::combinators;
+use crate::completion::factory::{self, LatexComponentId};
+use crate::workspace::*;
+use futures_boxed::boxed;
+use lsp_types::{CompletionItem, CompletionParams};
+
+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+pub struct LatexBeginCommandCompletionProvider;
+
+impl FeatureProvider for LatexBeginCommandCompletionProvider {
+ type Params = CompletionParams;
+ type Output = Vec<CompletionItem>;
+
+ #[boxed]
+ async fn execute<'a>(&'a self, request: &'a FeatureRequest<Self::Params>) -> Self::Output {
+ combinators::command(request, |_| {
+ async move {
+ let snippet = factory::command_snippet(
+ request,
+ "begin",
+ None,
+ "begin{$1}\n\t$0\n\\end{$1}",
+ &LatexComponentId::kernel(),
+ );
+ vec![snippet]
+ }
+ })
+ .await
+ }
+}