Skip to content

Commit a81bdc2

Browse files
committed
add ability to use a different neovim configuration (fix #49), update dependencies
1 parent 7882047 commit a81bdc2

11 files changed

Lines changed: 133 additions & 42 deletions

File tree

Cargo.lock

Lines changed: 86 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bridge/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "defold-nvim-bridge"
3-
version = "0.3.3"
3+
version = "0.4.0"
44
edition = "2024"
55

66
[dependencies]
@@ -9,7 +9,7 @@ clap = { version = "4.6.0", features = ["derive"] }
99
defold-nvim-core = { path = "../core" }
1010
dirs = "6.0.0"
1111
netstat2 = "0.11.2"
12-
termlauncher = "0.2.1"
12+
termlauncher = "0.3.0"
1313
tracing = "0.1.44"
1414
tracing-appender = "0.2.4"
1515
tracing-subscriber = "0.3.23"

crates/bridge/src/launcher.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,24 @@ const VAR_ADDRESS: &str = "{ADDR}";
2323
const VAR_LINE: &str = "{LINE}";
2424
const VAR_FILE: &str = "{FILE}";
2525

26-
fn report_process_errors(child: Child) -> Result<()> {
27-
let output = child.wait_with_output()?;
26+
fn report_process_errors(mut child: Child) -> Result<()> {
27+
match child.try_wait()? {
28+
Some(status) => {
29+
let output = child.wait_with_output()?;
2830

29-
if !output.stdout.is_empty() {
30-
tracing::debug!("Proccess Out: {}", String::from_utf8(output.stdout)?);
31-
}
31+
if !output.stdout.is_empty() {
32+
tracing::debug!("Proccess Out: {}", String::from_utf8(output.stdout)?);
33+
}
3234

33-
if !output.stderr.is_empty() {
34-
tracing::error!("Proccess Err: {}", String::from_utf8(output.stderr)?);
35+
if !output.stderr.is_empty() {
36+
tracing::error!("Proccess Err: {}", String::from_utf8(output.stderr)?);
37+
}
38+
39+
tracing::debug!("Process exited with: {status}");
40+
}
41+
None => {
42+
tracing::debug!("Process still running, detaching...");
43+
}
3544
}
3645

3746
Ok(())
@@ -330,6 +339,11 @@ pub fn run(
330339
app.args.insert(0, "--".to_string());
331340
}
332341

342+
if let Some(appname) = &plugin_config.appname {
343+
app.env_vars
344+
.insert("NVIM_APPNAME".to_string(), appname.clone());
345+
}
346+
333347
match plugin_config.socket_type {
334348
Some(SocketType::Fsock) => run_fsock(&launcher, app, &nvim, &root_dir, file_str, line)?,
335349
Some(SocketType::Netsock) => run_netsock(&launcher, app, &nvim, &root_dir, file_str, line)?,

crates/bridge/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ enum Commands {
4141
#[arg(long = "executable")]
4242
executable: Option<String>,
4343

44+
#[arg(long = "appname")]
45+
appname: Option<String>,
46+
4447
#[clap(value_name = "GAME_ROOT_DIR")]
4548
game_root_dir: String,
4649

@@ -148,6 +151,7 @@ fn main() -> Result<()> {
148151
launcher_type,
149152
socket_type,
150153
executable,
154+
appname,
151155
arguments,
152156
game_root_dir,
153157
file,
@@ -157,6 +161,7 @@ fn main() -> Result<()> {
157161
launcher_type,
158162
socket_type,
159163
executable,
164+
appname,
160165
arguments,
161166
},
162167
absolute(game_root_dir)?,

crates/bridge/src/plugin_config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ pub struct PluginConfig {
2121
pub launcher_type: Option<LauncherType>,
2222
pub socket_type: Option<SocketType>,
2323
pub executable: Option<String>,
24+
pub appname: Option<String>,
2425
pub arguments: Option<Vec<String>>,
2526
}

crates/core/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[package]
22
name = "defold-nvim-core"
3-
version = "0.3.3"
3+
version = "0.4.0"
44
edition = "2024"
55

66
[dependencies]
77
anyhow = { version = "1.0.102", features = ["backtrace"] }
88
tar = "0.4.45"
99
version-compare = "0.2.1"
1010
flate2 = "1.1.9"
11-
zip = "8.4.0"
11+
zip = "8.5.1"
1212
dirs = "6.0.0"
1313
reqwest = { version = "0.13.2", default-features = false, features = [
1414
"rustls",
@@ -18,7 +18,7 @@ reqwest = { version = "0.13.2", default-features = false, features = [
1818
rust-ini = "0.21.3"
1919
serde = { version = "1.0.228", features = ["derive"] }
2020
serde_json = "1.0.149"
21-
sha3 = "0.10.8"
21+
sha3 = "0.11.0"
2222
strum = { version = "0.28.0", features = ["derive"] }
2323
tracing = "0.1.44"
2424
which = "8.0.2"
@@ -27,6 +27,7 @@ walkdir = "2.5.0"
2727
serde_yaml = "0.9.34"
2828
textwrap = "0.16.2"
2929
fs_extra = "1.3.0"
30+
hex = "0.4.3"
3031

3132
[target.'cfg(target_os = "macos")'.dependencies]
3233
dmg = "0.1.2"

0 commit comments

Comments
 (0)