public void Open(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISolution solution, DocumentManager documentManager, IActionManager actionManager, ICommandProcessor commandProcessor, TextControlChangeUnitFactory changeUnitFactory, JetPopupMenus jetPopupMenus) { Debug.Assert(!IsOpened); _solution = solution; DocumentManager = documentManager; _jetPopupMenus = jetPopupMenus; changeManager.Changed2.Advise(lifetime, Handler); lifetime.AddAction(Close); var expandAction = actionManager.Defs.TryGetActionDefById(GotoDeclarationAction.ACTION_ID); if (expandAction != null) { var postfixHandler = new GotoDeclarationHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this); lifetime.AddBracket( FOpening: () => actionManager.Handlers.AddHandler(expandAction, postfixHandler), FClosing: () => actionManager.Handlers.RemoveHandler(expandAction, postfixHandler)); } var findUsagesAction = actionManager.Defs.GetActionDef <FindUsagesAction>(); var findUsagesHandler = new FindUsagesHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this); lifetime.AddBracket( FOpening: () => actionManager.Handlers.AddHandler(findUsagesAction, findUsagesHandler), FClosing: () => actionManager.Handlers.RemoveHandler(findUsagesAction, findUsagesHandler)); }
public RenameHandler(ISolution solution, BufferParser bufferParser, OmniSharpConfiguration config) { _solution = solution; _bufferParser = bufferParser; _findUsagesHandler = new FindUsagesHandler(bufferParser, solution); _config = config; }
public void Should_find_usages_of_class() { const string editorText = @"public class myclass { public void method() { } public void method_calling_method() { method(); } } "; var solution = new FakeSolution(); var project = new FakeProject(); project.AddFile(editorText); solution.Projects.Add(project); var handler = new FindUsagesHandler(new OmniSharp.Parser.BufferParser(solution), solution, new ProjectFinder(solution)); var usages = handler.FindUsages(new FindUsagesRequest { FileName = "myfile", Line = 3, Column = 21, Buffer = editorText }).QuickFixes.ToArray(); usages.Length.ShouldEqual(2); usages[0].Text.Trim().ShouldEqual("public void method() { }"); usages[1].Text.Trim().ShouldEqual("method();"); }
public void Open(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISolution solution, DocumentManager documentManager, IActionManager actionManager, ICommandProcessor commandProcessor, TextControlChangeUnitFactory changeUnitFactory, JetPopupMenus jetPopupMenus) { Debug.Assert(!IsOpened); _solution = solution; DocumentManager = documentManager; _jetPopupMenus = jetPopupMenus; changeManager.Changed2.Advise(lifetime, Handler); lifetime.AddAction(Close); var expandAction = actionManager.Defs.TryGetActionDefById(GotoDeclarationAction.ACTION_ID); if (expandAction != null) { var postfixHandler = new GotoDeclarationHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this); lifetime.AddBracket( FOpening: () => actionManager.Handlers.AddHandler(expandAction, postfixHandler), FClosing: () => actionManager.Handlers.RemoveHandler(expandAction, postfixHandler)); } var findUsagesAction = actionManager.Defs.GetActionDef<FindUsagesAction>(); var findUsagesHandler = new FindUsagesHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this); lifetime.AddBracket( FOpening: () => actionManager.Handlers.AddHandler(findUsagesAction, findUsagesHandler), FClosing: () => actionManager.Handlers.RemoveHandler(findUsagesAction, findUsagesHandler)); }
public RenameHandler(ISolution solution, BufferParser bufferParser) { _solution = solution; _bufferParser = bufferParser; _findUsagesHandler = new FindUsagesHandler(bufferParser, solution); }