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

DEV2-4157: Add tabnine chat state #1376

Merged
merged 8 commits into from
Dec 4, 2023
Merged

DEV2-4157: Add tabnine chat state #1376

merged 8 commits into from
Dec 4, 2023

Conversation

ofekby
Copy link
Contributor

@ofekby ofekby commented Nov 26, 2023

No description provided.

@ofekby ofekby requested a review from a team as a code owner November 26, 2023 17:51
import { isEqual } from "underscore";
import { Disposable, EventEmitter } from "vscode";

export default class EventEmitterBasedState<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

i think it should be disposable bc EventEmitter is disposable.

moreover EventEmitterBasedState can extend EventEmitter instead of composition

@@ -0,0 +1,15 @@
import EventEmitterBasedState from "./EventEmitterBasedState";

export default class EventEmitterBasedNonNullState<
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need this wrapper? in what case null state is valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly for typescript. Null is the default initial state. But this wrapper is for when you an actual initial state. By the current state design, the value is only null able before initialisation after that the state will never change back to null. And the listeners are only notified on when the non null value has changed.


export type DerivedState<T> = Disposable & EventEmitterBasedState<T>;

export default function deriveState<I, O, S extends EventEmitterBasedState<I>>(
Copy link
Contributor

Choose a reason for hiding this comment

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

why is it exported?

@dimacodota
Copy link
Contributor

lets move all the "state management" under state folder instead of utils

Copy link
Contributor

@dimacodota dimacodota left a comment

Choose a reason for hiding this comment

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

lgtm, has some minor comments

@ofekby ofekby merged commit 45283c8 into master Dec 4, 2023
3 of 4 checks passed
@ofekby ofekby deleted the add-tabnine-chat-state branch December 4, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants