File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
CSScriptIntellisense/CSharpIntellisense Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public string GetFileName()
5353 public bool AutoSuggestOnOpenEndLine = false ;
5454 public bool FormatOnSave = false ;
5555 public bool AutoInsertSingeSuggestion = false ;
56- public bool AutoSelectFirstSuggestion = false ;
56+ public bool AutoSelectFirstSuggestion = true ;
5757 public bool VbSupportEnabled = true ;
5858 public bool FormatAsYouType = true ;
5959 public string DefaultRefAsms = "System.Linq|System.Xml|System.Xml.Linq|System.Windows.Forms|System.Drawing|System.Core|Microsoft.CSharp" ;
Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
3+ using System . Linq ;
34using System . Reflection ;
45using System . Runtime . InteropServices ;
56using System . Windows . Forms ;
7+ using static System . Windows . Forms . VisualStyles . VisualStyleElement . TextBox ;
8+ using System . Xml . Linq ;
69using CSScriptIntellisense ;
710using Kbg . NppPluginNET ;
811using Kbg . NppPluginNET . PluginInfrastructure ;
@@ -129,7 +132,25 @@ public void beNotified(IntPtr notifyCode)
129132 }
130133 else if ( nc . Header . Code == ( uint ) SciMsg . SCN_CHARADDED )
131134 {
132- CSScriptIntellisense . Plugin . OnCharTyped ( nc . Character ) ;
135+ if ( nc . character == 0 )
136+ {
137+ // There is a defect either in Scintilla or in Npp that prevents correct SciMsg.SCN_CHARADDED
138+ // notification, which leads to `nc.character` being set to zero. Detected in v8.6.2 Npp.
139+ // So extract the character from side of the caret.
140+ // This is only a work around as any direct solution is problematic since it is a Scintilla
141+ // change in behavior.
142+
143+ var document = Npp . GetCurrentDocument ( ) ;
144+ var caret = document . GetCurrentPos ( ) ;
145+
146+ if ( caret > 0 )
147+ {
148+ string textOnLeft = document . GetTextBetween ( caret - 1 , caret ) ;
149+ CSScriptIntellisense . Plugin . OnCharTyped ( textOnLeft . LastOrDefault ( ) ) ;
150+ }
151+ }
152+ else
153+ CSScriptIntellisense . Plugin . OnCharTyped ( nc . Character ) ;
133154 }
134155 else if ( nc . Header . Code == ( uint ) SciMsg . SCN_DWELLSTART ) //tooltip
135156 {
You can’t perform that action at this time.
0 commit comments