Skip to content

Commit 936d91c

Browse files
author
Grant Gilson
committed
got a build
1 parent 6f1f217 commit 936d91c

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ phf = { version = "0.11.1", features = ["macros"] }
2424
jwalk = "0.8.1"
2525
# home = "0.5.3"
2626
quit = "2.0.0"
27-
psutil = "3.2.2"
2827
regex = "1.7.1"
2928
serde_json = "1.0.108"
3029
tantivy = "0.21.1"
@@ -35,4 +34,8 @@ tantivy = "0.21.1"
3534
target = "x86_64-unknown-linux-gnu"
3635

3736
[target.x86_64-unknown-linux-gnu]
37+
psutil = "3.2.2"
3838
linker = "/usr/local/bin/x86_64-unknown-linux-gnu-gcc"
39+
40+
[target.'cfg(windows)'.dependencies]
41+
tasklist = "0.2.13"

client/src/extension.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export async function activate(_context: ExtensionContext) {
2424
// Apple/Intel
2525
command = `${base_dir}/bin/fuzzy`;
2626
}
27+
} else if ("windows") {
28+
command = `${base_dir}/bin/fuzzy.exe`;
2729
} else {
2830
command = `${base_dir}/bin/fuzzy_x86_64-unknown-linux-gnu`;
2931
}

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"@types/glob": "^7.1.3",
8686
"@types/mocha": "^8.0.0",
8787
"@types/node": "^12.12.0",
88-
"@types/vscode": "^1.44.0",
88+
"@types/vscode": "^1.84.2",
8989
"@typescript-eslint/eslint-plugin": "^3.8.0",
9090
"@typescript-eslint/parser": "^3.8.0",
9191
"cross-env": "^7.0.2",
@@ -97,6 +97,8 @@
9797
"ts-loader": "^8.0.12",
9898
"typescript": "^4.4.3",
9999
"vscode-test": "^1.4.0",
100-
"vscode-uri": "^3.0.2"
100+
"vscode-uri": "^3.0.2",
101+
"vscode": "^1.1.37",
102+
"vscode-languageclient": "^9.0.1"
101103
}
102104
}

src/main.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
mod persistence;
22

33
use persistence::Persistence;
4+
use tasklist::tasklist;
45

56
use std::sync::Arc;
67
use tokio::sync::Mutex;
@@ -40,6 +41,7 @@ impl LanguageServer for Backend {
4041
drop(persistence);
4142

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

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

5658
tokio::time::sleep(Duration::from_secs(60)).await;
5759
}
60+
#[cfg(target_family = "Windows")]
61+
loop {
62+
use tasklist;
63+
64+
let editor_process_id = params.process_id.unwrap_or_else(|| quit::with_code(1));
65+
66+
let editor_process_running = unsafe {
67+
let mut tl = tasklist::Tasklist::new();
68+
tl.any(|process| process.get_pid() == editor_process_id)
69+
};
70+
71+
if !editor_process_running {
72+
quit::with_code(1);
73+
}
74+
75+
tokio::time::sleep(Duration::from_secs(60)).await;
76+
}
77+
5878
});
5979

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

0 commit comments

Comments
 (0)