-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Subissue: Lift chat input state to ChatModel
#163
Labels
Comments
ChatModel
ChatModel
Discussed this briefly with @brichet on Thursday 02/13. Nicolas mentioned that it may make more sense for this to live in a |
@brichet Here is an interface that describes the methods & properties needed by the Chat Commands framework: interface IInputModel {
/* the entire input */
get value(): string
set value(newInput: string): void
valueChanged: ISignal<IInputModel, string>;
/**
* the current cursor index.
* this refers to the index of the character in front of the cursor.
*/
get cursorIndex(): number
set cursorIndex(newIndex: number): void
cursorIndexChanged: ISignal<IInputModel, number>
/**
* the current word behind the user's cursor, space-separated.
* should call functions defined under `input/utils.ts`.
*/
get currentWord(): string
set currentWord(newWord: string): void
currentWordChanged: ISignal<IInputModel, string>;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
While building #161, I noticed that I had to pass
input
andsetInput
from the<ChatInput />
component to the chat command providers, since they need to read & write from the input. This results in a weird interface:If a
ChatModel
instance could provide methods for reading & writing to the input, the interface can then be simplified to:Proposed Solution
Lift chat input state up to the
ChatModel
instance. The<ChatInput />
component should be updated accordingly.Additional context
Chat commands PR: #161
The text was updated successfully, but these errors were encountered: