1
0
Fork 0
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:
Roy Li 2023-03-16 15:46:50 -04:00 committed by GitHub
parent 56731f2f8d
commit 2c7174a5a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -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");
});
}

View file

@ -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()?;