Repository: sxyazi/yazi
File: yazi-plugin/src/utils/layer.rs (Rust)

Code before:
				cands.push(Chord {
					on:    Self::parse_keys(cand.raw_get("on")?)?,
					run:   vec![Cmd::args("which:callback", [i]).with_any("tx", tx.clone())],
					desc:  cand.raw_get("desc").ok(),
					r#for: None,
				});
			}

			drop(tx);
			emit!(Call(
				Cmd::new("which:show")
					.with_any("candidates", cands)
					.with("silent", t.raw_get::<bool>("silent").unwrap_or_default())
			));

			Ok(rx.recv().await.map(|idx| idx + 1))
		})
	}

	pub(super) fn input(lua: &Lua) -> mlua::Result<Function> {
		lua.create_async_function(|lua, t: Table| async move {
			let mut pos = t.raw_get::<Value>("pos")?;
			if pos.is_nil() {
				pos = t.raw_get("position")?;
				if !pos.is_nil() {
					deprecate!(
						lua,
						"The `position` property of `ya.input()` is deprecated, use `pos` instead in your {}\nSee #2921 for more details: https://github.com/sxyazi/yazi/pull/2921"
					);
				}
			}

			let realtime = t.raw_get("realtime").unwrap_or_default();
			let rx = UnboundedReceiverStream::new(InputProxy::show(InputCfg {
				title: t.raw_get("title")?,
				value: t.raw_get("value").unwrap_or_default(),
				cursor: None, // TODO
				obscure: t.raw_get("obscure").unwrap_or_default(),
				position: Pos::new_input(pos)?.into(),
				realtime,
				completion: false,
			}));

			if !realtime {
				return InputRx::consume(rx).await.into_lua_multi(&lua);
			}

			let debounce = t.raw_get::<f64>("debounce").unwrap_or_default();
			if debounce < 0.0 {
				Err("negative debounce duration".into_lua_err())
			} else if debounce == 0.0 {

Review comment (suggestion):
This deprecation warning also has an unfilled '{}' placeholder; provide the intended context argument or remove the placeholder to avoid runtime formatting errors.
```suggestion
					deprecate!(lua, "The `position` property of `ya.input()` is deprecated, use `pos` instead.\nSee #2921 for more details: https://github.com/sxyazi/yazi/pull/2921");
```

Code after:
				cands.push(Chord {
					on:    Self::parse_keys(cand.raw_get("on")?)?,
					run:   vec![Cmd::args("which:callback", [i]).with_any("tx", tx.clone())],
					desc:  cand.raw_get("desc").ok(),
					r#for: None,
				});
			}

			drop(tx);
			emit!(Call(
				Cmd::new("which:show")
					.with_any("candidates", cands)
					.with("silent", t.raw_get::<bool>("silent").unwrap_or_default())
			));

			Ok(rx.recv().await.map(|idx| idx + 1))
		})
	}

	pub(super) fn input(lua: &Lua) -> mlua::Result<Function> {
		lua.create_async_function(|lua, t: Table| async move {
			let mut pos = t.raw_get::<Value>("pos")?;
			if pos.is_nil() {
				pos = t.raw_get("position")?;
				if !pos.is_nil() {
					deprecate!(lua, "The `position` property of `ya.input()` is deprecated, use `pos` instead in your {}\nSee #2921 for more details: https://github.com/sxyazi/yazi/pull/2921");
				}
			}

			let realtime = t.raw_get("realtime").unwrap_or_default();
			let rx = UnboundedReceiverStream::new(InputProxy::show(InputCfg {
				title: t.raw_get("title")?,
				value: t.raw_get("value").unwrap_or_default(),
				cursor: None, // TODO
				obscure: t.raw_get("obscure").unwrap_or_default(),
				position: Pos::new_input(pos)?.into(),
				realtime,
				completion: false,
			}));

			if !realtime {
				return InputRx::consume(rx).await.into_lua_multi(&lua);
			}

			let debounce = t.raw_get::<f64>("debounce").unwrap_or_default();
			if debounce < 0.0 {
				Err("negative debounce duration".into_lua_err())
			} else if debounce == 0.0 {
				InputRx::new(rx).into_lua_multi(&lua)
			} else {
				InputRx::new(Debounce::new(rx, Duration::from_secs_f64(debounce))).into_lua_multi(&lua)