Пример #1
0
 public GetContextModule(GetContextHandler handler)
 {
     Post["/getcontext"] = x =>
     {
         var request = this.Bind <Common.Request>();
         return(Response.AsJson(handler.GetContextResponse(request)));
     };
 }
Пример #2
0
 public GetContextModule(GetContextHandler handler)
 {
     Post["/getcontext"] = x =>
         {
             var request = this.Bind<Common.Request>();
             return Response.AsJson(handler.GetContextResponse(request));
         };
 }
Пример #3
0
        public static GetContextResponse GetContextInformation(this string editorText)
        {
            int cursorOffset = editorText.IndexOf("$", StringComparison.Ordinal);
            var cursorPosition = TestHelpers.GetLineAndColumnFromIndex(editorText, cursorOffset);
            editorText = editorText.Replace("$", "");

            var solution = new FakeSolution();
            var project = new FakeProject();
            project.AddFile(editorText);
            solution.Projects.Add(project);

            var handler = new GetContextHandler(solution, new BufferParser(solution));
            var request = new Request
            {
                Buffer = editorText,
                FileName = "myfile",
                Line = cursorPosition.Line,
                Column = cursorPosition.Column,
            };

            return handler.GetContextResponse(request);
        }