/// <summary> /// 转到定义 /// </summary> public override void Run() { // 解析 string selection = ExtUtil.GetSelection(Dte); if (string.IsNullOrWhiteSpace(selection)) { return; } AnalyzeInfo(selection); // 校验 if (string.IsNullOrEmpty(_funcInfo.FullName)) { MessageBox.Show("该方法缺少引用,请检查require!"); return; } // 查找 string path = GetFullPath(); if (string.IsNullOrEmpty(path)) { MessageBox.Show("未找到对应的后端文件!"); return; } Window win = Dte.ItemOperations.OpenFile(path); if (!ExtUtil.ToCode(win, _funcInfo)) { if (_funcInfo.ParamNum > -1) { // 如果带参数匹配不到,那么仅匹配方法名 _funcInfo.ParamNum = -1; if (ToFunc(win)) { MessageBox.Show("未找到匹配的方法,已定位到同名方法!"); return; } } MessageBox.Show("未找到匹配的方法!"); return; } }