55import os
66import re
77
8+ COMPLETER_PATTERN = re .compile (r"[A-z0-9-_.]+" )
9+
810
911class JumpCompleter (Completer ):
1012 """Completer that shows available conversation turns when typing /jump command."""
@@ -17,7 +19,9 @@ def get_completions(self, document, complete_event):
1719
1820 # Only provide completions for the /jump command
1921 if text .startswith ("/jump " ):
20- word_before_cursor = document .get_word_before_cursor ()
22+ word_before_cursor = document .get_word_before_cursor (
23+ pattern = COMPLETER_PATTERN
24+ )
2125
2226 conversation_turns = (
2327 self .message_handler .conversation_turns if self .message_handler else []
@@ -47,7 +51,9 @@ def get_completions(self, document, complete_event):
4751
4852 # Only provide completions for the /model command
4953 if text .startswith ("/model " ):
50- word_before_cursor = document .get_word_before_cursor ()
54+ word_before_cursor = document .get_word_before_cursor (
55+ pattern = COMPLETER_PATTERN
56+ )
5157
5258 # Get all available models from the registry
5359 all_models = []
@@ -79,7 +85,9 @@ def get_completions(self, document, complete_event):
7985
8086 # Only provide completions for the /agent command
8187 if text .startswith ("/agent " ):
82- word_before_cursor = document .get_word_before_cursor ()
88+ word_before_cursor = document .get_word_before_cursor (
89+ pattern = COMPLETER_PATTERN
90+ )
8391
8492 # Get all available agents from the manager
8593 all_agents = []
@@ -189,7 +197,9 @@ def __init__(self, message_handler=None):
189197 def get_completions (self , document , complete_event ):
190198 text = document .text
191199 if text .startswith ("/mcp " ):
192- word_before_cursor = document .get_word_before_cursor ()
200+ word_before_cursor = document .get_word_before_cursor (
201+ pattern = COMPLETER_PATTERN
202+ )
193203 # Collect all prompts from all servers
194204 if self .mcp_service and hasattr (self .mcp_service , "server_prompts" ):
195205 for server_id , prompts in self .mcp_service .server_prompts .items ():
0 commit comments