Requests.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // ReSharper disable ClassNeverInstantiated.Global
  2. // ReSharper disable UnusedMember.Global
  3. // ReSharper disable UnusedAutoPropertyAccessor.Global
  4. using System;
  5. using Newtonsoft.Json;
  6. namespace GodotTools.IdeMessaging.Requests
  7. {
  8. public abstract class Request
  9. {
  10. [JsonIgnore] public string Id { get; }
  11. protected Request(string id)
  12. {
  13. Id = id;
  14. }
  15. }
  16. public abstract class Response
  17. {
  18. [JsonIgnore] public MessageStatus Status { get; set; } = MessageStatus.Ok;
  19. }
  20. public sealed class CodeCompletionRequest : Request
  21. {
  22. public enum CompletionKind
  23. {
  24. InputActions = 0,
  25. NodePaths,
  26. ResourcePaths,
  27. ScenePaths,
  28. ShaderParams,
  29. Signals,
  30. ThemeColors,
  31. ThemeConstants,
  32. ThemeFonts,
  33. ThemeStyles
  34. }
  35. public CompletionKind Kind { get; set; }
  36. public string ScriptFile { get; set; } = string.Empty;
  37. public new const string Id = "CodeCompletion";
  38. public CodeCompletionRequest() : base(Id)
  39. {
  40. }
  41. }
  42. public sealed class CodeCompletionResponse : Response
  43. {
  44. public CodeCompletionRequest.CompletionKind Kind;
  45. public string ScriptFile { get; set; } = string.Empty;
  46. public string[] Suggestions { get; set; } = Array.Empty<string>();
  47. }
  48. public sealed class PlayRequest : Request
  49. {
  50. public new const string Id = "Play";
  51. public PlayRequest() : base(Id)
  52. {
  53. }
  54. }
  55. public sealed class PlayResponse : Response
  56. {
  57. }
  58. public sealed class StopPlayRequest : Request
  59. {
  60. public new const string Id = "StopPlay";
  61. public StopPlayRequest() : base(Id)
  62. {
  63. }
  64. }
  65. public sealed class StopPlayResponse : Response
  66. {
  67. }
  68. public sealed class DebugPlayRequest : Request
  69. {
  70. public string DebuggerHost { get; set; } = string.Empty;
  71. public int DebuggerPort { get; set; }
  72. public bool? BuildBeforePlaying { get; set; }
  73. public new const string Id = "DebugPlay";
  74. public DebugPlayRequest() : base(Id)
  75. {
  76. }
  77. }
  78. public sealed class DebugPlayResponse : Response
  79. {
  80. }
  81. public sealed class OpenFileRequest : Request
  82. {
  83. public string File { get; set; } = string.Empty;
  84. public int? Line { get; set; }
  85. public int? Column { get; set; }
  86. public new const string Id = "OpenFile";
  87. public OpenFileRequest() : base(Id)
  88. {
  89. }
  90. }
  91. public sealed class OpenFileResponse : Response
  92. {
  93. }
  94. public sealed class ReloadScriptsRequest : Request
  95. {
  96. public new const string Id = "ReloadScripts";
  97. public ReloadScriptsRequest() : base(Id)
  98. {
  99. }
  100. }
  101. public sealed class ReloadScriptsResponse : Response
  102. {
  103. }
  104. }