Esempio n. 1
0
        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();");
        }
Esempio n. 2
0
 public RenameHandler(ISolution solution, BufferParser bufferParser, OmniSharpConfiguration config, FindUsagesHandler findUsagesHandler)
 {
     _solution = solution;
     _bufferParser = bufferParser;
     _findUsagesHandler = findUsagesHandler;
     _config = config;
 }
Esempio n. 3
0
 public FindUsagesModule(FindUsagesHandler findUsagesHandler)
 {
     Post["/findusages"] = x =>
     {
         var req    = this.Bind <FindUsagesRequest>();
         var usages = findUsagesHandler.FindUsages(req);
         return(Response.AsJson(usages));
     };
 }
Esempio n. 4
0
 public FindUsagesModule(FindUsagesHandler findUsagesHandler)
 {
     Post["FindUsages", "/findusages"] = x =>
     {
         var req = this.Bind<FindUsagesRequest>();
         var usages = findUsagesHandler.FindUsages(req);
         return Response.AsJson(usages);
     };    
 }
Esempio n. 5
0
 public RenameHandler(ISolution solution, BufferParser bufferParser)
 {
     _solution = solution;
     _bufferParser = bufferParser;
     _findUsagesHandler = new FindUsagesHandler(bufferParser, solution);
 }