summaryrefslogtreecommitdiff
path: root/support/texlab/src/action.rs
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
committerNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
commitb8d4bb76703bcb15578e2b23c5d256532180b894 (patch)
treebedd1df7a00521a2bd986b3c0289d6556a59e39b /support/texlab/src/action.rs
parent02e4625a78a5029e8b5dc2a4ec70193b232f497e (diff)
CTAN sync 201912030301
Diffstat (limited to 'support/texlab/src/action.rs')
-rw-r--r--support/texlab/src/action.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/support/texlab/src/action.rs b/support/texlab/src/action.rs
new file mode 100644
index 0000000000..da52333ff0
--- /dev/null
+++ b/support/texlab/src/action.rs
@@ -0,0 +1,37 @@
+use crate::workspace::Uri;
+use lsp_types::ProgressToken;
+use std::mem;
+use std::sync::Mutex;
+
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum LintReason {
+ Change,
+ Save,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone)]
+pub enum Action {
+ CheckInstalledDistribution,
+ DetectRoot(Uri),
+ PublishDiagnostics,
+ RunLinter(Uri, LintReason),
+ Build(Uri),
+ CancelBuild(ProgressToken),
+}
+
+#[derive(Debug, Default)]
+pub struct ActionManager {
+ actions: Mutex<Vec<Action>>,
+}
+
+impl ActionManager {
+ pub fn push(&self, action: Action) {
+ let mut actions = self.actions.lock().unwrap();
+ actions.push(action);
+ }
+
+ pub fn take(&self) -> Vec<Action> {
+ let mut actions = self.actions.lock().unwrap();
+ mem::replace(&mut *actions, Vec::new())
+ }
+}