Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoupled Completion List and Call Tips from Scintilla and removed from MainForm #1020

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
584b46d
CompletionList and RichToolTip refactoring
Neverbirth Feb 1, 2015
0d74117
Correct tooltip start position
Neverbirth Feb 1, 2015
cffc83f
Fixed MethodCallTip
Neverbirth Feb 1, 2015
4ed1f7d
Some further refactoring:
Neverbirth Feb 2, 2015
ccd2fb9
Some more CompletionList decoupling.
Neverbirth Feb 11, 2015
d6903ba
Merge branch 'fd5' into completionlist
Neverbirth Feb 17, 2015
9b76b42
Some more work
Neverbirth Feb 18, 2015
f49dd4d
Scintilla creation modification
Neverbirth Feb 20, 2015
9c92429
Removed Completion.Delete shortcut
Neverbirth Feb 20, 2015
d66396a
Some more CompletionList decoupling
Neverbirth Feb 20, 2015
3886987
Better completion list positioning in Immediate Panel
Neverbirth Feb 20, 2015
dd21e41
Restore list visibility on Control key press
Neverbirth Feb 20, 2015
30269a0
Completion list visibility was pointing to the global list
Neverbirth Feb 20, 2015
d2a6c39
Only display the completion list if the editor is focused
Neverbirth Feb 23, 2015
28df076
Completion List control improvements
Neverbirth Feb 23, 2015
162e32f
Better Completion List handling in Immediate Panel and the default co…
Neverbirth Feb 23, 2015
7b591cd
Further work
Neverbirth Feb 24, 2015
6afff3d
Some more keys supported by completion list
Neverbirth Feb 24, 2015
24cf1c4
More list conrol
Neverbirth Feb 25, 2015
9a8db43
Scintilla commands replacement
Neverbirth Feb 26, 2015
e0b9eb4
Scintilla focus event change
Neverbirth Feb 26, 2015
c697262
Only handle back key in ASComplete if the editor has the focus
Neverbirth Feb 27, 2015
1080373
Restore back key notification on ASComplete
Neverbirth Feb 27, 2015
c24b0bd
Don't hide simple tip in DwellEnd if the completion list is active
Neverbirth Feb 27, 2015
c102b25
Some default ScintilaHost improvements
Neverbirth Feb 27, 2015
15befec
F1 key support
Neverbirth Feb 27, 2015
6343665
Do not always propagate F1 key
Neverbirth Feb 27, 2015
e7ca7c3
Key detection fix
Neverbirth Feb 27, 2015
762aa04
Ctrl + Backspace when CamelHumps = true
Neverbirth Mar 2, 2015
601a917
Finished with the refactoring
Neverbirth Mar 5, 2015
939f88e
Added SizeChanged event to ICompletionListHost.
Neverbirth Mar 5, 2015
6e27759
Custom word part functions
Neverbirth Mar 9, 2015
bbc35b5
Fixed completion list location on control hosts with Y or X != 0.
Neverbirth Apr 19, 2015
6aa42fd
Merge branch 'development' into completionlist
Neverbirth Apr 21, 2015
08f8a6f
Merge branch 'development' into completionlist
Neverbirth Apr 22, 2015
8372566
In the BreakPoint panel get the file contents from MainForm.Documents…
Neverbirth Apr 23, 2015
53c1516
Finished for now.
Neverbirth Apr 24, 2015
2e04bd0
Missing file
Neverbirth May 11, 2015
130b71a
Merge branch 'development' into completionlist
Neverbirth Nov 6, 2015
3e93285
Left some dummy code... (still more in there, but doesn't matter that…
Neverbirth Nov 6, 2015
2d1aac2
Merge branch 'development' into completionlist
Neverbirth Jan 11, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions External/Plugins/ASCompletion/ASCompletion.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<Compile Include="CustomControls\ModelsExplorer.Designer.cs">
<DependentUpon>ModelsExplorer.cs</DependentUpon>
</Compile>
<Compile Include="Helpers\ASCompletionBackend.cs" />
<Compile Include="Helpers\FlashErrorsWatcher.cs" />
<Compile Include="Model\ASFileParser.cs" />
<Compile Include="Model\MemberModel.cs" />
Expand Down
44 changes: 31 additions & 13 deletions External/Plugins/ASCompletion/Completion/ASComplete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static public bool OnChar(ScintillaControl Sci, int Value, bool autoHide)
{
return HandleColonCompletion(Sci, "", autoHide);
}
else break;
break;

case '<':
if (features.hasGenerics && position > 2)
Expand All @@ -188,7 +188,7 @@ static public bool OnChar(ScintillaControl Sci, int Value, bool autoHide)
return HandleColonCompletion(Sci, "", autoHide);
return false;
}
else break;
break;

case '(':
case ',':
Expand All @@ -197,7 +197,7 @@ static public bool OnChar(ScintillaControl Sci, int Value, bool autoHide)
else return false;

case ')':
if (UITools.CallTip.CallTipActive) UITools.CallTip.Hide();
if (CompletionList.CallTip.CallTipActive) CompletionList.CallTip.Hide();
return false;

case '*':
Expand Down Expand Up @@ -241,7 +241,7 @@ static public bool OnShortcut(Keys keys, ScintillaControl Sci)
// dot complete
if (keys == (Keys.Control | Keys.Space))
{
if (ASContext.HasContext && ASContext.Context.IsFileValid)
if (ASContext.HasContext && ASContext.Context.IsFileValid && Sci.ContainsFocus)
{
// try to get completion as if we had just typed the previous char
if (OnChar(Sci, Sci.CharAt(Sci.PositionBefore(Sci.CurrentPos)), false))
Expand All @@ -257,11 +257,11 @@ static public bool OnShortcut(Keys keys, ScintillaControl Sci)
}
else if (keys == Keys.Back)
{
HandleAddClosingBraces(Sci, Sci.CurrentChar, false);
if (Sci.ContainsFocus) HandleAddClosingBraces(Sci, Sci.CurrentChar, false);
return false;
}
// show calltip
else if (keys == (Keys.Control | Keys.Shift | Keys.Space))
else if (keys == (Keys.Control | Keys.Shift | Keys.Space) && Sci.ContainsFocus)
{
if (ASContext.HasContext && ASContext.Context.IsFileValid)
{
Expand All @@ -275,7 +275,7 @@ static public bool OnShortcut(Keys keys, ScintillaControl Sci)
// project types completion
else if (keys == (Keys.Control | Keys.Alt | Keys.Space))
{
if (ASContext.HasContext && ASContext.Context.IsFileValid && !ASContext.Context.Settings.LazyClasspathExploration)
if (ASContext.HasContext && ASContext.Context.IsFileValid && !ASContext.Context.Settings.LazyClasspathExploration && Sci.ContainsFocus)
{
int position = Sci.CurrentPos-1;
string tail = GetWordLeft(Sci, ref position);
Expand Down Expand Up @@ -1285,9 +1285,27 @@ private static bool IsDeclaration(string line, ContextFeatures features)
static private string prevParam = "";
static private string paramInfo = "";

static private CompletionListControl completionList;
/// <summary>
/// Target Completion List to use
/// </summary>
static public CompletionListControl CompletionList
{
get
{
if (completionList == null)
completionList = UITools.CompletionList;
return completionList;
}
set
{
completionList = value;
}
}

static public bool HasCalltip()
{
return UITools.CallTip.CallTipActive && (calltipDef != null);
return CompletionList.CallTip.CallTipActive && (calltipDef != null);
}

/// <summary>
Expand Down Expand Up @@ -1339,17 +1357,17 @@ static private void ShowCalltip(ScintillaControl Sci, int paramIndex, bool force
}

// show calltip
if (!UITools.CallTip.CallTipActive || UITools.Manager.ShowDetails != calltipDetails || paramName != prevParam)
if (!CompletionList.CallTip.CallTipActive || UITools.Manager.ShowDetails != calltipDetails || paramName != prevParam)
{
prevParam = paramName;
calltipDetails = UITools.Manager.ShowDetails;
string text = calltipDef + ASDocumentation.GetTipDetails(calltipMember, paramName);
UITools.CallTip.CallTipShow(Sci, calltipPos - calltipOffset, text, forceRedraw);
CompletionList.CallTip.CallTipShow(calltipPos - calltipOffset, text, forceRedraw);
}

// highlight
if ((start < 0) || (end < 0)) UITools.CallTip.CallTipSetHlt(0, 0, true);
else UITools.CallTip.CallTipSetHlt(start + 1, end, true);
if ((start < 0) || (end < 0)) CompletionList.CallTip.CallTipSetHlt(0, 0, true);
else CompletionList.CallTip.CallTipSetHlt(start + 1, end, true);
}

static private int FindNearSymbolInFunctDef(string defBody, char symbol, int startAt)
Expand Down Expand Up @@ -1460,7 +1478,7 @@ static public bool HandleFunctionCompletion(ScintillaControl Sci, bool autoHide,
ShowCalltip(Sci, paramIndex, forceRedraw);
return true;
}
else UITools.CallTip.Hide();
else CompletionList.CallTip.Hide();
}

if (!ResolveFunction(Sci, position, autoHide))
Expand Down
11 changes: 11 additions & 0 deletions External/Plugins/ASCompletion/Context/ASContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,24 @@ static public IMainForm MainForm
get { return PluginBase.MainForm; }
}

private static WeakReference curSciControl;
static public ScintillaControl CurSciControl
{
get
{
if (curSciControl != null && curSciControl.IsAlive)
return (ScintillaNet.ScintillaControl) curSciControl.Target;

ITabbedDocument doc = PluginBase.MainForm.CurrentDocument;
return doc != null ? doc.SciControl : null;
}
internal set
{
// Used for ASCompletionBackend.
// Maybe another option would be to inherit HaxeContext and modify the DotContextResolved call. One question
// would be where to place ASCompletionBackend.
curSciControl = value != null ? new WeakReference(value) : null;
}
}

static public PluginUI Panel
Expand Down
Loading