By default, we have to manually run 'AutoComplete.Show()' in the 'CharAdded' event.
However, I would like to suggest it to be auto-launch.
Default behaviour:
This is the original codes of the method of
Patches:
If the developer don't want automatic launch AutoComplete or he/she want to implement different behaviour, he/she may do this to suspend default behaviour:
However, I would like to suggest it to be auto-launch.
Default behaviour:
- If the AutoComplete.List is empty, AutoComplete will not launch.
- If the AutoComplete.List is not empty, it will launch for matched character enter by user.
-
If the developer want to implement different behaviour, he/she can override the methods or turn it off.
This is the original codes of the method of
OnCharAdded()
in ScintillaNET.Scintilla
///<summary>/// Raises the <see cref="CharAdded"/> event.///</summary>///<param name="e">An <see cref="CharAddedEventArgs"/> that contains the event data.</param>protectedvirtualvoid OnCharAdded(CharAddedEventArgs e) { EventHandler<CharAddedEventArgs> handler = Events[_charAddedEventKey] as EventHandler<CharAddedEventArgs>; if (handler != null) handler(this, e); if (_indentation.SmartIndentType != SmartIndent.None) _indentation.CheckSmartIndent(e.Ch); }
private Bool _autoLaunchAutoComplete = true; public Bool AutoLaunchAutoComplete { get { return _autoLaunchAutoComplete; } set { _autoLaunchAutoComplete = value; } } ///<summary>/// Raises the <see cref="CharAdded"/> event.///</summary>///<param name="e">An <see cref="CharAddedEventArgs"/> that contains the event data.</param>protectedvirtualvoid OnCharAdded(CharAddedEventArgs e) { EventHandler<CharAddedEventArgs> handler = Events[_charAddedEventKey] as EventHandler<CharAddedEventArgs>; if (handler != null) handler(this, e); if (_indentation.SmartIndentType != SmartIndent.None) _indentation.CheckSmartIndent(e.Ch); if (_autoLaunchAutoComplete) LaunchAutoComplete(); } publicvirtualvoid LaunchAutoComplete() { if (this.AutoComplete.List.Count == 0) return; int pos = this.NativeInterface.GetCurrentPos(); int length = pos - this.NativeInterface.WordStartPosition(pos, true); if (length == 0) return; this.AutoComplete.Show(length); }
ScintillaNET.Scintilla scintilla1 = new ScintillaNET.Scintilla(); scintilla1.AutoLaunchAutoComplete = false;