ide-lsp-client.h 5.1 KB
Newer Older
1
/* ide-lsp-client.h
2
 *
3
 * Copyright 2016-2019 Christian Hergert <chergert@redhat.com>
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 18
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
19 20
 */

21
#pragma once
22

23 24 25
#if !defined (IDE_LSP_INSIDE) && !defined (IDE_LSP_COMPILATION)
# error "Only <libide-lsp.h> can be included directly."
#endif
26

27
#include <libide-core.h>
28 29 30

G_BEGIN_DECLS

31
#define IDE_TYPE_LSP_CLIENT (ide_lsp_client_get_type())
32

Christian Hergert's avatar
Christian Hergert committed
33
IDE_AVAILABLE_IN_3_32
34
G_DECLARE_DERIVABLE_TYPE (IdeLspClient, ide_lsp_client, IDE, LSP_CLIENT, IdeObject)
35

36
struct _IdeLspClientClass
37 38 39
{
  IdeObjectClass parent_class;

40
  void     (*notification)          (IdeLspClient *self,
41
                                     const gchar       *method,
42
                                     GVariant          *params);
43
  gboolean (*supports_language)     (IdeLspClient *self,
44
                                     const gchar       *language_id);
45
  void     (*published_diagnostics) (IdeLspClient *self,
46 47
                                     GFile             *file,
                                     IdeDiagnostics    *diagnostics);
48

49
  /*< private >*/
50
  gpointer _reserved[16];
51 52
};

Christian Hergert's avatar
Christian Hergert committed
53
IDE_AVAILABLE_IN_3_32
54
IdeLspClient *ide_lsp_client_new                      (GIOStream            *io_stream);
Christian Hergert's avatar
Christian Hergert committed
55
IDE_AVAILABLE_IN_3_32
56
void               ide_lsp_client_add_language             (IdeLspClient    *self,
57
                                                                 const gchar          *language_id);
Christian Hergert's avatar
Christian Hergert committed
58
IDE_AVAILABLE_IN_3_32
59
void               ide_lsp_client_start                    (IdeLspClient    *self);
Christian Hergert's avatar
Christian Hergert committed
60
IDE_AVAILABLE_IN_3_32
61
void               ide_lsp_client_stop                     (IdeLspClient    *self);
Christian Hergert's avatar
Christian Hergert committed
62
IDE_AVAILABLE_IN_3_32
63
void               ide_lsp_client_call_async               (IdeLspClient    *self,
64 65 66 67 68
                                                                 const gchar          *method,
                                                                 GVariant             *params,
                                                                 GCancellable         *cancellable,
                                                                 GAsyncReadyCallback   callback,
                                                                 gpointer              user_data);
Christian Hergert's avatar
Christian Hergert committed
69
IDE_AVAILABLE_IN_3_32
70
gboolean           ide_lsp_client_call_finish              (IdeLspClient    *self,
71 72 73
                                                                 GAsyncResult         *result,
                                                                 GVariant            **return_value,
                                                                 GError              **error);
Christian Hergert's avatar
Christian Hergert committed
74
IDE_AVAILABLE_IN_3_32
75
void               ide_lsp_client_send_notification_async  (IdeLspClient    *self,
76
                                                                 const gchar          *method,
77
                                                                 GVariant             *params,
78 79 80
                                                                 GCancellable         *cancellable,
                                                                 GAsyncReadyCallback   notificationback,
                                                                 gpointer              user_data);
Christian Hergert's avatar
Christian Hergert committed
81
IDE_AVAILABLE_IN_3_32
82
gboolean           ide_lsp_client_send_notification_finish (IdeLspClient    *self,
83 84
                                                                 GAsyncResult         *result,
                                                                 GError              **error);
Christian Hergert's avatar
Christian Hergert committed
85
IDE_AVAILABLE_IN_3_32
86
void               ide_lsp_client_get_diagnostics_async    (IdeLspClient    *self,
87
                                                                 GFile                *file,
88 89
                                                                 GBytes *content,
                                                                 const gchar *lang_id,
90 91 92
                                                                 GCancellable         *cancellable,
                                                                 GAsyncReadyCallback   callback,
                                                                 gpointer              user_data);
Christian Hergert's avatar
Christian Hergert committed
93
IDE_AVAILABLE_IN_3_32
94
gboolean           ide_lsp_client_get_diagnostics_finish   (IdeLspClient    *self,
95 96 97
                                                                 GAsyncResult         *result,
                                                                 IdeDiagnostics      **diagnostics,
                                                                 GError              **error);
98 99

G_END_DECLS