|
| 1 | +------------------------------------------------------------------------------ |
| 2 | +-- Language Server Protocol -- |
| 3 | +-- -- |
| 4 | +-- Copyright (C) 2022, AdaCore -- |
| 5 | +-- -- |
| 6 | +-- This is free software; you can redistribute it and/or modify it under -- |
| 7 | +-- terms of the GNU General Public License as published by the Free Soft- -- |
| 8 | +-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 9 | +-- sion. This software is distributed in the hope that it will be useful, -- |
| 10 | +-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- |
| 11 | +-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- |
| 12 | +-- License for more details. You should have received a copy of the GNU -- |
| 13 | +-- General Public License distributed with this software; see file -- |
| 14 | +-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- |
| 15 | +-- of the license. -- |
| 16 | +------------------------------------------------------------------------------ |
| 17 | + |
| 18 | +package body LSP.Ada_Handlers.Project_Reload_Commands is |
| 19 | + |
| 20 | + ------------ |
| 21 | + -- Create -- |
| 22 | + ------------ |
| 23 | + |
| 24 | + overriding function Create |
| 25 | + (JS : not null access LSP.JSON_Streams.JSON_Stream'Class) return Command |
| 26 | + is |
| 27 | + pragma Unreferenced (JS); |
| 28 | + begin |
| 29 | + return (LSP.Commands.Command with null record); |
| 30 | + end Create; |
| 31 | + |
| 32 | + ------------- |
| 33 | + -- Execute -- |
| 34 | + ------------- |
| 35 | + |
| 36 | + overriding procedure Execute |
| 37 | + (Self : Command; |
| 38 | + Handler : not null access LSP.Server_Notification_Receivers |
| 39 | + .Server_Notification_Receiver'Class; |
| 40 | + Client : not null access LSP.Client_Message_Receivers |
| 41 | + .Client_Message_Receiver'Class; |
| 42 | + Error : in out LSP.Errors.Optional_ResponseError) |
| 43 | + is |
| 44 | + Message_Handler : LSP.Ada_Handlers.Message_Handler renames |
| 45 | + LSP.Ada_Handlers.Message_Handler (Handler.all); |
| 46 | + |
| 47 | + begin |
| 48 | + Message_Handler.Reload_Project; |
| 49 | + end Execute; |
| 50 | + |
| 51 | + ------------------- |
| 52 | + -- Write_Command -- |
| 53 | + ------------------- |
| 54 | + |
| 55 | + procedure Write_Command |
| 56 | + (S : access Ada.Streams.Root_Stream_Type'Class; |
| 57 | + V : Command) |
| 58 | + is |
| 59 | + JS : LSP.JSON_Streams.JSON_Stream'Class renames |
| 60 | + LSP.JSON_Streams.JSON_Stream'Class (S.all); |
| 61 | + begin |
| 62 | + JS.Start_Object; |
| 63 | + -- no command arguments! |
| 64 | + JS.End_Object; |
| 65 | + end Write_Command; |
| 66 | + |
| 67 | +end LSP.Ada_Handlers.Project_Reload_Commands; |
0 commit comments