Guest User

Untitled

a guest
Oct 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. //var topPanel = panel.clear().add_Panel();
  2. var topPanel = "Simple AstTester".popupWindow(700,300);
  3. var codeViewer = topPanel.title("Code").add_SourceCodeViewer();
  4. var errorsList = topPanel.insert_Right(300,"AstTree Errors").add_TextArea();
  5. Action<string> showErrors =
  6. (newCode)=>{
  7. codeViewer.editor().clearBookmarksAndMarkers();
  8. var astTree = newCode.tree();
  9. var errors = astTree.errors();
  10. foreach(var error in errors)
  11. {
  12. var startLinePosition = error.Location
  13. .GetLineSpan(true)
  14. .StartLinePosition;
  15. codeViewer.editor().setSelectedText(startLinePosition.Line +1,
  16. startLinePosition.Character,
  17. true);
  18. }
  19. errorsList.set_Text(astTree.errors_Details());
  20. };
  21.  
  22. var code =
  23. @"var a = 12;
  24. this is an error
  25.  
  26. string b = 333;
  27. aaaaaa-
  28. class test
  29. {
  30. public methodWithNoReturnType()
  31. {}
  32. }";
  33.  
  34.  
  35. codeViewer.onTextChange(showErrors)
  36. .set_Text(code,".cs");
  37.  
  38. return "ok";
  39.  
  40. //O2Ref:O2_FluentSharp_Roslyn.dll
  41. //O2Ref:Roslyn.Compilers.CSharp.dll
  42. //O2Ref:Roslyn.Compilers.dll
Add Comment
Please, Sign In to add comment