ide-lsp-client.h 5.43 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-code.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 37 38 39 40 41 42
typedef enum
{
  IDE_LSP_TRACE_OFF,
  IDE_LSP_TRACE_MESSAGES,
  IDE_LSP_TRACE_VERBOSE,
} IdeLspTrace;

43
struct _IdeLspClientClass
44 45 46
{
  IdeObjectClass parent_class;

47 48 49 50 51 52 53 54 55
  void      (*notification)          (IdeLspClient   *self,
                                      const gchar    *method,
                                      GVariant       *params);
  gboolean  (*supports_language)     (IdeLspClient   *self,
                                      const gchar    *language_id);
  void      (*published_diagnostics) (IdeLspClient   *self,
                                      GFile          *file,
                                      IdeDiagnostics *diagnostics);
  GVariant *(*load_configuration)    (IdeLspClient   *self);
56

57
  /*< private >*/
58
  gpointer _reserved[15];
59 60
};

Christian Hergert's avatar
Christian Hergert committed
61
IDE_AVAILABLE_IN_3_32
62
IdeLspClient *ide_lsp_client_new                      (GIOStream            *io_stream);
63 64 65 66 67
IDE_AVAILABLE_IN_3_36
IdeLspTrace   ide_lsp_client_get_trace                (IdeLspClient         *self);
IDE_AVAILABLE_IN_3_36
void          ide_lsp_client_set_trace                (IdeLspClient         *self,
                                                       IdeLspTrace           trace);
68 69
IDE_AVAILABLE_IN_3_36
GVariant     *ide_lsp_client_get_server_capabilities  (IdeLspClient         *self);
Christian Hergert's avatar
Christian Hergert committed
70
IDE_AVAILABLE_IN_3_32
71 72
void          ide_lsp_client_add_language             (IdeLspClient         *self,
                                                       const gchar          *language_id);
Christian Hergert's avatar
Christian Hergert committed
73
IDE_AVAILABLE_IN_3_32
74
void          ide_lsp_client_start                    (IdeLspClient         *self);
Christian Hergert's avatar
Christian Hergert committed
75
IDE_AVAILABLE_IN_3_32
76
void          ide_lsp_client_stop                     (IdeLspClient         *self);
Christian Hergert's avatar
Christian Hergert committed
77
IDE_AVAILABLE_IN_3_32
78 79 80 81 82 83
void          ide_lsp_client_call_async               (IdeLspClient         *self,
                                                       const gchar          *method,
                                                       GVariant             *params,
                                                       GCancellable         *cancellable,
                                                       GAsyncReadyCallback   callback,
                                                       gpointer              user_data);
Christian Hergert's avatar
Christian Hergert committed
84
IDE_AVAILABLE_IN_3_32
85 86 87 88
gboolean      ide_lsp_client_call_finish              (IdeLspClient         *self,
                                                       GAsyncResult         *result,
                                                       GVariant            **return_value,
                                                       GError              **error);
Christian Hergert's avatar
Christian Hergert committed
89
IDE_AVAILABLE_IN_3_32
90 91 92 93 94 95
void          ide_lsp_client_send_notification_async  (IdeLspClient         *self,
                                                       const gchar          *method,
                                                       GVariant             *params,
                                                       GCancellable         *cancellable,
                                                       GAsyncReadyCallback   notificationback,
                                                       gpointer              user_data);
Christian Hergert's avatar
Christian Hergert committed
96
IDE_AVAILABLE_IN_3_32
97 98 99
gboolean      ide_lsp_client_send_notification_finish (IdeLspClient         *self,
                                                       GAsyncResult         *result,
                                                       GError              **error);
Christian Hergert's avatar
Christian Hergert committed
100
IDE_AVAILABLE_IN_3_32
101 102 103 104 105 106 107
void          ide_lsp_client_get_diagnostics_async    (IdeLspClient         *self,
                                                       GFile                *file,
                                                       GBytes               *content,
                                                       const gchar          *lang_id,
                                                       GCancellable         *cancellable,
                                                       GAsyncReadyCallback   callback,
                                                       gpointer              user_data);
Christian Hergert's avatar
Christian Hergert committed
108
IDE_AVAILABLE_IN_3_32
109 110 111 112
gboolean      ide_lsp_client_get_diagnostics_finish   (IdeLspClient         *self,
                                                       GAsyncResult         *result,
                                                       IdeDiagnostics      **diagnostics,
                                                       GError              **error);
113 114

G_END_DECLS