Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: finalize testInvalidateResults #188180

Merged
merged 1 commit into from
Jul 18, 2023
Merged

Conversation

connor4312
Copy link
Member

Also sends the tests as a bulk to the renderer, and implements a
prefix tree for doing invalidation checks (which I plan to adopt
elsewhere later on, perhaps in debt week.)

Also sends the tests as a bulk to the renderer, and implements a
prefix tree for doing invalidation checks (which I plan to adopt
elsewhere later on, perhaps in debt week.)
@connor4312 connor4312 self-assigned this Jul 18, 2023
@connor4312 connor4312 enabled auto-merge (squash) July 18, 2023 17:27
@VSCodeTriageBot VSCodeTriageBot added this to the July 2023 milestone Jul 18, 2023
Comment on lines +16 to +18
insert(key: Iterable<string>, value: V): void {
let node = this.root;
for (const part of key) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path might be a better name.

Suggested change
insert(key: Iterable<string>, value: V): void {
let node = this.root;
for (const part of key) {
insert(path: Iterable<string>, value: V): void {
let node = this.root;
for (const part of path) {

Comment on lines +37 to +39
find(key: Iterable<string>): V | undefined {
let node = this.root;
for (const segment of key) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find(key: Iterable<string>): V | undefined {
let node = this.root;
for (const segment of key) {
find(path: Iterable<string>): V | undefined {
let node = this.root;
for (const segment of path) {

* A simple prefix tree implementation where a value is stored based on
* well-defined prefix segments.
*/
export class WellDefinedPrefixTree<V> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe RadixTrie is a better name? https://en.wikipedia.org/wiki/Radix_tree

}

/** Gets whether the tree has the key, or a parent of the key, already inserted. */
hasKeyOrParent(key: Iterable<string>): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

Suggested change
hasKeyOrParent(key: Iterable<string>): boolean {
containsPrefixOfPath(path: Iterable<string>): boolean {

Might be easier to understand?

}

/** Gets whether the tree has the given key or any children. */
hasKeyOrChildren(key: Iterable<string>): boolean {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

Suggested change
hasKeyOrChildren(key: Iterable<string>): boolean {
containsExtensionOfPath(path: Iterable<string>): boolean {

?
(Assuming the empty extension is an extension)

tree.insert(key, 42);

assert.strictEqual(tree.hasKeyOrParent(['foo', 'bar', 'baz']), true);
assert.strictEqual(tree.hasKeyOrParent(['foo', 'bar']), true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test for tree.hasKeyOrParent(['foo', 'baz']) might be interesting

@connor4312 connor4312 merged commit f821859 into main Jul 18, 2023
7 checks passed
@connor4312 connor4312 deleted the connor4312/finalize-134970 branch July 18, 2023 18:14
@hediet
Copy link
Member

hediet commented Jul 18, 2023

Left some comments, but feel free to ignore

@github-actions github-actions bot locked and limited conversation to collaborators Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants