@@ -6,7 +6,6 @@ import { PasteWithBullets } from './pasteWithBullets';
66import { EnterKeyHandler } from './enterKey' ;
77import { getBulletFromLine } from '../utils/bulletPointUtils.vscode' ;
88import { getBulletStyleFromAdjacentLines } from '../utils/bulletStyleUtils' ;
9- // ...existing code...
109import { Configuration } from '../config/configuration' ;
1110import { QueryService } from '../queries/queryService' ;
1211
@@ -81,6 +80,24 @@ export class CommandManager {
8180 await vscode . commands . executeCommand ( 'default:type' , args ) ;
8281 return ;
8382 }
83+
84+ // --- Auto-completion Handling ---
85+ // Defer to default handler for chars that trigger auto-completion to prevent interference.
86+ const autoCompleteChars = [ '[' , '{' , '(' , "'" , '"' ] ;
87+ if ( autoCompleteChars . includes ( typedChar ) && line . text . trim ( ) . length === 0 ) {
88+ await vscode . commands . executeCommand ( 'default:type' , args ) ;
89+ // Now, check if we should add a bullet *before* the auto-completed pair.
90+ const lineAfterType = editor . document . lineAt ( editor . selection . active . line ) ;
91+ if ( lineAfterType . text . trim ( ) . length > 0 ) { // Check if something was actually inserted
92+ const indent = line . firstNonWhitespaceCharacterIndex ;
93+ const bulletToInsert = getBulletStyleFromAdjacentLines ( editor . document , position . line , indent , '• ' ) ;
94+ await editor . edit ( editBuilder => {
95+ editBuilder . insert ( new vscode . Position ( position . line , indent ) , bulletToInsert ) ;
96+ } ) ;
97+ }
98+ return ; // Stop further processing
99+ }
100+
84101 if ( typedChar === '[' && position . character > 0 && line . text . charAt ( position . character - 1 ) === '[' ) {
85102 await vscode . commands . executeCommand ( 'default:type' , args ) ;
86103 return ;
0 commit comments