mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -05:00
fix(repl): Hide indexable properties in tab completion (#18141)
Closes #17831. This change hides the indices of any indexed collection when triggering tab completion for object properties in the REPL. An example is shown in the issue, but for verbosity here is another. Before the change: ``` > const arr = new Uint8ClampedArray([1, 2, 3]) undefined > arr. 0 map 1 reverse 2 reduce ... ``` After the change: ``` > const arr = new Uint8ClampedArray([1, 2, 3]) undefined > arr. constructor reduce BYTES_PER_ELEMENT reduceRight buffer set ... ``` Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
This commit is contained in:
parent
56731f2f8d
commit
2c7174a5a2
2 changed files with 17 additions and 1 deletions
|
@ -1057,3 +1057,19 @@ fn npm_packages() {
|
|||
assert!(err.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pty_tab_indexable_props() {
|
||||
util::with_pty(&["repl"], |mut console| {
|
||||
console.write_line("const arr = [1, 2, 3]");
|
||||
console.write_line("arr.\t\t");
|
||||
console.write_line("close();");
|
||||
|
||||
let output = console.read_all_output();
|
||||
println!("output");
|
||||
assert_contains!(output, "constructor");
|
||||
assert_contains!(output, "sort");
|
||||
assert_contains!(output, "at");
|
||||
assert_not_contains!(output, "0", "1", "2");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ impl EditorHelper {
|
|||
own_properties: None,
|
||||
accessor_properties_only: None,
|
||||
generate_preview: None,
|
||||
non_indexed_properties_only: None,
|
||||
non_indexed_properties_only: Some(true),
|
||||
}),
|
||||
)
|
||||
.ok()?;
|
||||
|
|
Loading…
Reference in a new issue