MCPcopy Create free account
hub / github.com/continuedev/continue / selectSlashCommand

Function selectSlashCommand

extensions/cli/src/ui/UserInput.tsx:375–394  ·  view source on GitHub ↗
(commandName: string)

Source from the content-addressed store, hash-verified

373
374 // Handle slash command selection
375 const selectSlashCommand = (commandName: string) => {
376 const beforeCursor = inputText.slice(0, cursorPosition);
377 const lastSlashIndex = beforeCursor.lastIndexOf("/");
378
379 if (lastSlashIndex !== -1) {
380 const beforeSlash = inputText.slice(0, lastSlashIndex);
381 const afterCursor = inputText.slice(cursorPosition);
382
383 // Replace the partial command with the full command
384 const newText = beforeSlash + "/" + commandName + " " + afterCursor;
385 const newCursorPos = lastSlashIndex + 1 + commandName.length + 1;
386
387 textBuffer.setText(newText);
388 textBuffer.setCursor(newCursorPos);
389 setInputText(newText);
390 setCursorPosition(newCursorPos);
391 setShowSlashCommands(false);
392 setShowBashMode(false);
393 }
394 };
395
396 // Handle file selection
397 const selectFile = async (filePath: string) => {

Callers 1

Calls 2

setTextMethod · 0.80
setCursorMethod · 0.80

Tested by

no test coverage detected