Пример #1
0
 public TypeLookupModule(TypeLookupHandler typeLookupHandler)
 {
     Post["TypeLookup", "/typelookup"] = x =>
     {
         var req = this.Bind <TypeLookupRequest>();
         var res = typeLookupHandler.GetTypeLookupResponse(req);
         return(Response.AsJson(res));
     };
 }
Пример #2
0
 public TypeLookupModule(TypeLookupHandler typeLookupHandler)
 {
     Post["/typelookup"] = x =>
         {
             var req = this.Bind<TypeLookupRequest>();
             var res = typeLookupHandler.GetTypeLookupResponse(req);
             return Response.AsJson(res);
         };
 }
Пример #3
0
        public static string LookupType(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 TypeLookupHandler(new BufferParser(solution));
            var request = new TypeLookupRequest()
                {
                    Buffer = editorText,
                    FileName = "myfile",
                    Line = cursorPosition.Line,
                    Column = cursorPosition.Column,
                };

            return handler.GetTypeLookupResponse(request).Type;
        }