internal static void JumpForward() { if (FrmMain == null) { ShowNppPIALexer2View(); } Jump cur = Jump.Cursor; if (cur != null) { string file = NPP.GetCurrentFile(); int line = NPP.GetCurrentLine(); if (file != cur.File || line != cur.LineNo) { cur.Go(); } else { Jump fard = Jump.Forward; if (fard != null) { fard.Go(); } } } }
public static void Add(string info, string file, int pos) { if (!System.IO.File.Exists(file)) { return; } Jump oldPos = new Jump(NPP.GetCurrentWord2(), NPP.GetCurrentFile(), NPP.GetCurrentLine(), NPP.GetCurrentPosition()); if (oldPos.Info == "") { oldPos.Info = string.Format("line-{0}", oldPos.LineNo + 1); } Jump newPos = new Jump(info, file, 0, pos); while (_JumpList.Count > _Cursor + 1 || _JumpList.Count > 0 && _JumpList[_JumpList.Count - 1].File == file && _JumpList[_JumpList.Count - 1].Pos == pos) { _JumpList.RemoveAt(_JumpList.Count - 1); } if (_JumpList.Count == 0 || _JumpList.Count > 0 && (_JumpList[_JumpList.Count - 1].LineNo != oldPos.LineNo || _JumpList[_JumpList.Count - 1].File != oldPos.File)) { _JumpList.Add(oldPos); } _JumpList.Add(newPos); while (_JumpList.Count > 20) // Keep up to 20 items { _JumpList.RemoveAt(0); } _Cursor = _JumpList.Count - 1; }
/// <summary> /// 智能提示 /// </summary> /// <param name="enfocus"></param> internal static void ShowAutoCompletion(bool enfocus) { if (FrmMain == null) { ShowNppPIALexer2View(); } string curFile = NPP.GetCurrentFile(); string ext = Path.GetExtension(curFile); //TagParser.Ext2Lang.TryGetValue(ext, out lang); //??if (Utility.IsAllowedAutoCompletion(lang)) if (ext.Equals(ModelDocument.FileExtension, StringComparison.OrdinalIgnoreCase)) { Project proj = ProjectManager.GetProjectByItsFile(curFile); if (proj != null) { string word = NPP.GetCurrentWord(); string line = NPP.GetLine(NPP.GetCurrentLine()); if (word.Length >= 2) { List <NppPIALexer2.ObjDecl> lst = proj.Model.lookupAll(word, line, proj.Model.GetRelativePath(curFile)); //proj.Model.GetObjects(word, curFile, "", out lst); if (enfocus || lst.Count > 0) //&& !_IsEqual(lst)) { NPP.ShowAutoCompletion(word.Length, lst); } //_Last = lst; //if (lst.Count > 0) //{ // if (focus) // NPP.ShowAutoCompletion(word.Length, lst); // else // { // if (!_IsEqual(lst)) // { // NPP.ShowAutoCompletion(word.Length, lst); // } // } //} //_Last = lst; //if (lst.Count > 0) //{ // if (_LastWord != lst[0] || _Count != lst.Count) // { // _LastWord = lst[0]; // _Count = lst.Count; // NPP.ShowAutoCompletion(word.Length, lst); // } //} //else //{ // _LastWord = ""; // _Count = 0; //} } } } }