Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ phf = { version = "0.11.1", features = ["macros"] }
jwalk = "0.8.1"
# home = "0.5.3"
quit = "2.0.0"
psutil = "3.2.2"
regex = "1.7.1"
serde_json = "1.0.108"
tantivy = "0.21.1"
Expand All @@ -35,4 +34,8 @@ tantivy = "0.21.1"
target = "x86_64-unknown-linux-gnu"

[target.x86_64-unknown-linux-gnu]
psutil = "3.2.2"
linker = "/usr/local/bin/x86_64-unknown-linux-gnu-gcc"

[target.'cfg(windows)'.dependencies]
tasklist = "0.2.13"
2 changes: 2 additions & 0 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export async function activate(_context: ExtensionContext) {
// Apple/Intel
command = `${base_dir}/bin/fuzzy`;
}
} else if ("windows") {
command = `${base_dir}/bin/fuzzy.exe`;
} else {
command = `${base_dir}/bin/fuzzy_x86_64-unknown-linux-gnu`;
}
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@types/glob": "^7.1.3",
"@types/mocha": "^8.0.0",
"@types/node": "^12.12.0",
"@types/vscode": "^1.44.0",
"@types/vscode": "^1.84.2",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"cross-env": "^7.0.2",
Expand All @@ -97,6 +97,8 @@
"ts-loader": "^8.0.12",
"typescript": "^4.4.3",
"vscode-test": "^1.4.0",
"vscode-uri": "^3.0.2"
"vscode-uri": "^3.0.2",
"vscode": "^1.1.37",
"vscode-languageclient": "^9.0.1"
}
}
20 changes: 20 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod persistence;

use persistence::Persistence;
use tasklist::tasklist;

use std::sync::Arc;
use tokio::sync::Mutex;
Expand Down Expand Up @@ -40,6 +41,7 @@ impl LanguageServer for Backend {
drop(persistence);

tokio::spawn(async move {
#[cfg(not(target_family = "windows"))]
loop {
let editor_process_id = params.process_id.unwrap_or_else(|| quit::with_code(1));

Expand All @@ -55,6 +57,24 @@ impl LanguageServer for Backend {

tokio::time::sleep(Duration::from_secs(60)).await;
}
#[cfg(target_family = "Windows")]
loop {
use tasklist;

let editor_process_id = params.process_id.unwrap_or_else(|| quit::with_code(1));

let editor_process_running = unsafe {
let mut tl = tasklist::Tasklist::new();
tl.any(|process| process.get_pid() == editor_process_id)
};

if !editor_process_running {
quit::with_code(1);
}

tokio::time::sleep(Duration::from_secs(60)).await;
}

});

let background_persistence = Arc::clone(&self.persistence);
Expand Down