Updated intellisense only shows unique hits and the new files are always added to the console.

This commit is contained in:
mvl1986 2014-01-28 14:04:58 +00:00
parent 2050420565
commit c392321bb0
1 changed files with 79 additions and 83 deletions

View File

@ -16,21 +16,12 @@ namespace BizHawk.Client.EmuHawk
{
//TODO:
//Loads of exceptions when closing the writer, primarily in System.Windows.Forms.dll and mscorlib.dll
//ability to save new script (currently causes an exception) - done
//New scripts should be added to lua console automatically - done
//make functions is string part of string or comment since the actual way of validating it isn't correct
//Save fontstyle to config - done
//Line numbersjn
//Option to toggle line numbers
//Auto-complete drop down on functions in libraries - done
//intellisense on library functions
//Option to turn off basic lua script
//Tool strip
//function toolstrip button (inserts a function end block and puts cursor on blank line between them
//error checking logic on library functions (check parameters, etc)
//fix so drag & drop text file on edit box works (not just the edges around it
//listview object with lua functions, double click inserts them into the script
//fix so drag & drop text file on edit box works (not just the edges around it)
public string CurrentFile = "";
public Regex keyWords = new Regex("and|break|do|else|if|end|false|for|function|in|local|nil|not|or|repeat|return|then|true|until|while|elseif");
@ -564,6 +555,7 @@ namespace BizHawk.Client.EmuHawk
SaveScript();
MessageLabel.Text = Path.GetFileName(CurrentFile) + " saved.";
Global.Config.RecentLua.Add(file.FullName);
_owner.LoadLuaFile(CurrentFile);
}
}
@ -717,13 +709,17 @@ namespace BizHawk.Client.EmuHawk
private void LuaText_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
if (e.KeyCode == Keys.Escape )
{
AutoCompleteView.Visible = false;
e.SuppressKeyPress = true;
return;
}
else if (e.KeyCode == Keys.Back)
{
AutoCompleteView.Visible = false;
return;
}
else if (e.KeyCode == Keys.OemPeriod)
{
string currentword = CurrentWord();
@ -820,8 +816,8 @@ namespace BizHawk.Client.EmuHawk
String currentWord = CurrentWord();
currentWord += e.KeyCode;
currentWord = currentWord.ToLower();
List<string> libList = GlobalWin.Tools.LuaConsole.LuaImp.Docs.GetLibraryList().ToList();
List<string> libList2 = GlobalWin.Tools.LuaConsole.LuaImp.Docs.GetLibraryList().ToList();
var libList = (from d in libList2 select d).Distinct();
int x = LuaText.GetPositionFromCharIndex(LuaText.SelectionStart).X + LuaText.Location.X + 5;
int y = LuaText.GetPositionFromCharIndex(LuaText.SelectionStart).Y + LuaText.Location.Y + (int)LuaText.Font.GetHeight() + 5; // One row down
AutoCompleteView.Location = new Point(x, y);
@ -841,7 +837,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
String [] words = currentWord.Split('.');
String[] words = currentWord.Split('.');
String fileName = words[0];
if (IsLibraryWord(fileName))
{
@ -996,7 +992,7 @@ namespace BizHawk.Client.EmuHawk
if (result == DialogResult.Yes)
{
SaveScript();
_owner.LoadLuaFile(CurrentFile);
}
}