File tree Expand file tree Collapse file tree 3 files changed +5
-11
lines changed
packages/jupyter-chat/src
python/jupyterlab-chat/src/chat-commands/providers Expand file tree Collapse file tree 3 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -50,21 +50,15 @@ export interface IChatCommandProvider {
5050 id : string ;
5151
5252 /**
53- * Async function which accepts the current word and returns a list of
53+ * Async function which accepts the input model and returns a list of
5454 * valid chat commands that match the current word. The current word is
5555 * space-separated word at the user's cursor.
56- *
57- * TODO: Pass a ChatModel/InputModel instance here to give the command access
58- * to more than the current word.
5956 */
60- getChatCommands ( currentWord : string ) : Promise < ChatCommand [ ] > ;
57+ getChatCommands ( inputModel : IInputModel ) : Promise < ChatCommand [ ] > ;
6158
6259 /**
6360 * Function called when a chat command is run by the user through the chat
6461 * commands menu.
65- *
66- * TODO: Pass a ChatModel/InputModel instance here to provide a function to
67- * replace the current word.
6862 */
6963 handleChatCommand (
7064 command : ChatCommand ,
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export function useChatCommands(
6363 // TODO: optimize performance when this method is truly async
6464 try {
6565 newCommands = newCommands . concat (
66- await provider . getChatCommands ( currentWord )
66+ await provider . getChatCommands ( inputModel )
6767 ) ;
6868 } catch ( e ) {
6969 console . error (
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ export class EmojiCommandProvider implements IChatCommandProvider {
4747 // regex used to test the current word
4848 private _regex : RegExp = / ^ : \w * : ? / ;
4949
50- async getChatCommands ( currentWord : string ) {
51- const match = currentWord . match ( this . _regex ) ?. [ 0 ] ;
50+ async getChatCommands ( inputModel : IInputModel ) {
51+ const match = inputModel . currentWord ? .match ( this . _regex ) ?. [ 0 ] ;
5252 if ( ! match ) {
5353 return [ ] ;
5454 }
You can’t perform that action at this time.
0 commit comments