-
Notifications
You must be signed in to change notification settings - Fork 184
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
Conversation
src/utils/EventEmitterBasedState.ts
Outdated
import { isEqual } from "underscore"; | ||
import { Disposable, EventEmitter } from "vscode"; | ||
|
||
export default class EventEmitterBasedState<T> { |
There was a problem hiding this comment.
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< |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/utils/deriveState.ts
Outdated
|
||
export type DerivedState<T> = Disposable & EventEmitterBasedState<T>; | ||
|
||
export default function deriveState<I, O, S extends EventEmitterBasedState<I>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it exported?
lets move all the "state management" under state folder instead of utils |
There was a problem hiding this 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
No description provided.