forked from ycm-core/ycmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yml
1328 lines (1238 loc) · 48 KB
/
openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2017-2018 ycmd contributors.
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd 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 ycmd. If not, see <http://www.gnu.org/licenses/>.
swagger: "2.0"
info:
title: ycmd
description: |-
ycmd is a code-completion & code-comprehension server.
ycmd presents a JSON/REST interface to clients over HTTP, validated by HMAC.
An instance of ycmd is started for each client application.
## General Notes
The REST interface typically uses HTTP POST requests and expects the payload
data to be a valid JSON document. The following general principles are
applied:
- All strings going into and out of the server are UTF-8 encoded.
- All lines end with `\n`.
- All line and column numbers are 1-based, not 0-based. They are also byte
offsets, not Unicode codepoint offsets.
- All file paths are full, absolute paths. If a file has not been written
to disk yet, supply a temporary path.
- All requests to the server must include an HMAC in the x-ycm-hmac HTTP
header.
- All responses from the server must be validated using the x-ycm-hmac
header.
## The example client
ycmd contains a simple example client in the `example` directory of the
source tree. It is written in pure Python with only minimal dependencies.
It contains trivial implementations of most endpoints and serves to
supplement this API documentation.
Consult `example/README.md` for instructions on getting it running.
## Starting the server
The ycmd server is typically started by a client in order to provide
services to it. Briefly, starting the server requires supplying some
configuration and initializing some security features (HMAC).
The server should be started with a supported version of Python.
The full list of command line options can be obtained by passing `--help`
to ycmd (e.g. `python -m ycmd --help`). However, the following
options warrant further discussion:
### `--options_file`
This mandatory option supplies the name of a file containing user options
data. This option (and thus the file) are mandatory, as they are required
to set the shared HMAC secret.
Once the server has read the options, the server deletes the options file.
Therefore, the client should typically create a secure temporary file (e.g.
`mkstemp`) which contains the options to be used.
The default options and their values are found in `default_settings.json`
within the ycmd codebase.
The file contains a JSON-formatted object, where the keys are the names of
options (with any `ycm_` prefix removed) and the values are the option
values.
The canonical list of supported user options can be found in
YouCompleteMe's `README.md`. The option values should have the `ycm_`
prefix removed.
The following additional options are required to be set by the client
application and should *not* be visible to the user:
- `hmac_secret`: The shared secret for HMAC authentication. This should be
16 bytes of random data with as much entropy as possible, encoded as a
base-64 UTF-8 string. Code for generating this in Python can be found
in the ycmd example client.
## HMAC
All requests to the server must include an HMAC in the x-ycm-hmac HTTP
header. The HMAC is computed from the shared secret passed to the server
on startup and the request/response body. The digest algorithm is SHA-256.
The server will also include the HMAC in its responses; you must verify it
before using the response. See the example client to see how it's done.
## Filetypes
ycmd uses `filetypes` to identify the "language" of a given buffer. These
filetype values are strictly the values understood by Vim. Please see the
YCM README.md for the list of filetypes recognized by ycmd for semantic
completion.
version: 0.3.0
externalDocs:
description: ycmd GitHub page
url: https://github.com/Valloric/ycmd
definitions:
YesNo:
type: boolean
description: "Result of the query: `true` if yes, `false` otherwise."
AlwaysYes:
type: boolean
description: "`true` is always returned, unless there is an error."
LineNumber:
type: integer
description: 1-based line number.
ColumnNumber:
type: integer
description: 1-based column byte offset within the line.
FilePath:
type: string
description: |-
Absolute path to the file in the filesystem. If the file does
not yet exist (for example, a new file), then the value should be an
arbitrary unique string.
CompleterTarget:
type: string
description: |-
The completer implementation for which the command is intended. Typically,
this is set to `filetype_default`, but may also take any of the following
values:
- `filetype_default`
Use the semantic completer associated with the filetype of the current
buffer. This is the default when a target is not supplied.
- `identifier`
Use the identifier completer.
- Any filetype
Use the completer associated with the supplied filetype.
WorkingDirectory:
type: string
description: |-
Absolute path to the filesystem working directory of the client. This is
used by completer engines to determine things like the project root
for the file being modified, amongst other things.
ExtraConfData:
type: object
description: |-
A dictionary passed to the `Settings( **kwargs )` function of the
`.ycm_extra_conf.py` file under the `client_data` key of `kwargs`. This
optional field should be used to give users a way to customize the
`.ycm_extra_conf.py` file with their own set of options.
FileData:
type: object
description: |-
Contents and details of a dirty buffer.
required:
- filetypes
- contents
properties:
filetypes:
type: array
items:
type: string
contents:
type: string
description: The entire contents of the buffer encoded as UTF-8.
FileDataMap:
type: object
description: |-
An object mapping whose keys are the absolute paths to the
files and whose values are data relating unsaved buffers.
An unsaved buffer is any file that is opened in the editor and has been
changed without saving the contents to disk.
The file referred to in the request `filepath` entry must _always_ be
included. For most requests this is the user's current buffer, but may
be any buffer (e.g. in the case of closing a buffer which is not current).
When a file is closed in the editor, a `BufferUnload` event should be sent
and the file should not be included in further `FileDataMap` entries
until (or unless) it is opened and changed again.
additionalProperties:
$ref: "#/definitions/FileData"
# Due to the way the API combines keys at the top level, we are not able to
# compose this item per-request. So this definition must be copy-pasted for
# some requests.
SimpleRequest:
type: object
required:
- line_num
- column_num
- filepath
- file_data
properties:
line_num:
$ref: "#/definitions/LineNumber"
column_num:
$ref: "#/definitions/ColumnNumber"
filepath:
$ref: "#/definitions/FilePath"
file_data:
$ref: "#/definitions/FileDataMap"
completer_target:
$ref: "#/definitions/CompleterTarget"
working_dir:
$ref: "#/definitions/WorkingDirectory"
extra_conf_data:
$ref: "#/definitions/ExtraConfData"
Exception:
type: object
description: JSON-encoded representation of a Python Exception object.
# We don't document the contents of this object, as it is defined in the
# Python documentation.
additionalProperties: true
ExceptionResponse:
type: object
description: |-
The server raised an exception processing the request. This response is
often returned when the server is unable to perform the requested action,
not due to a bug or other error, but because it is not possible to do so.
For example, it is common for an exception response to be returned when
requesting "GoToDefinition" on an identifier for which the semantic,
engine is unable to find such a definition.
properties:
exception:
$ref: "#/definitions/Exception"
message:
type: string
description: |-
The exception message. Typically a single line and suitable for
display to a user.
traceback:
type: string
description: |-
A detailed report of the ycmd call stack at the point the exception
was thrown. It is typically not required to display this to a user,
as ycmd will print all exceptions to its log file (standard error).
Location:
type: object
description: |-
A contiguous range of bytes in a source buffer starting at `start` and
finishing at `end`. The range is (effectively) exclusive. That is if start
points to (10,1) and end points to (10,3), then the length of the range
is 2 characters.
required:
- line_num
- column_num
- filepath
properties:
line_num:
$ref: "#/definitions/LineNumber"
column_num:
$ref: "#/definitions/ColumnNumber"
filepath:
$ref: "#/definitions/FilePath"
Range:
type: object
description: A contiguous range of bytes in a source buffer.
required:
- start
- end
properties:
start:
$ref: "#/definitions/Location"
end:
$ref: "#/definitions/Location"
DiagnosticData:
type: object
description: |-
- `location`
The source location where the diagnostic applies. This is typically
(but not always) the start of `location_extent`.
- `location_extent`
The source range to which the diagnostic applies. This differs from
the `location` in that it refers to the whole range. Typically this is
used to underline, or otherwise render as "error" the source code
which caused the diagnostic.
required:
- ranges
- location
- location_extent
- text
- kind
properties:
ranges:
type: array
description: |-
List of ranges to which this diagnostic applies. These ranges
typically identify the source locations which should be
"highlighted" as incorrect.
items:
$ref: "#/definitions/Range"
location:
$ref: "#/definitions/Location"
location_extent:
$ref: "#/definitions/Range"
text:
type: string
description: The diagnostic text (e.g. error message)
kind:
type: string
enum:
- WARNING
- ERROR
- INFORMATION
- HINT
description: |-
The type of diagnostic being reported. Typically semantic engines will
differentiate between warnings and fatal errors. Informational and
hint messages should be treated as warnings where the client does not
differentiate.
fixit_available:
type: boolean
description: |-
If set to true, indicates that a quick fix action (FixIt) is
available for this diagnostic. Typically this is used to indicate to
the user that the `FixIt` subcommand is available.
DiagnosticResponse:
type: array
items:
$ref: "#/definitions/DiagnosticData"
FixIt:
type: object
required:
- location
- chunks
properties:
text:
type: string
description: |-
The diagnostic text or a description of the modification to be made.
This is the text displayed to the user when selecting from multiple
available FixIts.
location:
$ref: "#/definitions/Location"
chunks:
type: array
description: |-
A list of ranges and replacements which must be applied to source
files. *NOTE*: The source ranges may span arbitrary files and the
sequence of `chunks` is not defined.
items:
type: object
required:
- replacement_text
- range
properties:
replacement_text:
type: string
description: |-
The text with which to replace the range identified by `range`.
range:
$ref: "#/definitions/Range"
Candidate:
type: object
properties:
insertion_text:
type: string
description: |-
The word to insert when selecting the completion.
Equivalent of the Vim `complete-items` entry: `word`.
menu_text:
type: string
description: |-
The word to display as the suggestion to the user. If not
supplied, `insertion_text` is displayed to the user.
Equivalent of the Vim `complete-items` entry: `abbr`.
extra_menu_info:
type: string
description: |-
Additional information to display about the suggestion within
the completion menu (or equivalent). Typically this is the
signature/declaration of the item being suggested, or some
additional free-text qualifiers (such as `[File]` etc.). These
are a single line and typically short. For more detailed
information, such as usage and docs, see `detailed_info`.
Equivalent of the Vim `complete-items` entry: `menu`.
detailed_info:
type: string
description: |-
Additional information, such as the full signature and method
documentation, suitable for display in a preview window or
tooltip.
Equivalent of the Vim `complete-items` entry: `info`.
kind:
type: string
description: |-
An indicator of the type of suggestion. Only the first character
of `kind` should be displayed.
Equivalent of the Vim `complete-items` entry: `kind`.
extra_data:
type: object
description: |-
Completer-specific additional information.
properties:
doc_string:
type: string
description: |-
Additional documentation/information to be displayed
alongside (after) information in `detailed_info`.
CompletionResponse:
type: object
required:
- completions
- completion_start_column
properties:
completions:
type: array
description: List of completion suggestions.
items:
$ref: "#/definitions/Candidate"
completion_start_column:
type: integer
description: |-
1-based byte index of the column from which the completion should be
applied. This is the column in which the words suggested in
`completions` should be placed.
errors:
type: array
description: Any errors reported by the semantic completion engine.
items:
$ref: "#/definitions/ExceptionResponse"
ItemData:
type: object
required:
- key
- value
properties:
key:
type: string
value:
type: string
ServerData:
type: object
required:
- name
- is_running
- executable
- address
- port
- pid
- logfiles
- extras
properties:
name:
type: string
description: The server name.
is_running:
type: boolean
description: |-
`true` if the server is running, `false` otherwise.
executable:
type: string
description: The executable path used to start the server.
address:
type: string
description: |-
The address on which the server is listening. `null` if not
applicable.
port:
type: integer
description: |-
The port on which the server is listening. `null` if not applicable.
pid:
type: integer
description: |-
The process identifier of the server. `null` if the server is not
running.
logfiles:
type: array
description: A list of logging files used by the server.
items:
type: string
description: A logging file path.
extras:
type: array
items:
$ref: "#/definitions/ItemData"
DebugInfoResponse:
type: object
required:
- name
- servers
- items
properties:
name:
type: string
description: The completer name.
servers:
type: array
description: A list of servers used by the completer.
items:
$ref: "#/definitions/ServerData"
items:
type: array
description: Additional debugging information.
items:
$ref: "#/definitions/ItemData"
MessagePollResponse:
type: boolean
description: |-
When `true` is returned, the request timed out (meaning no
messages were returned in the poll period). Clients should
send another `receive_messages` request immediately.
When `false` is returned, the server determined that message
polling should abort for the current file type context. Clients
should not re-send this request until the filetype being edited
changes or the server is restarted.
MessageList:
type: array
description: |-
A list of messages in the sequence they should be handled.
The type of message in each item is determined by the property name:
- An object with a property `message` is a *simple display message* where
the property value is the message.
- An object with a property `diagnostics` contains diagnotics for a
project file. The value of the property is described below.
items:
$ref: '#/definitions/Message'
Message:
type: object
description:
An object containing a single asynchronous message.
It is either a `SimpleDisplayMessage` or a `DiagnosticsMessage`
properties:
message:
$ref: '#/definitions/SimpleDisplayMessage'
description: If present, this object is a `SimpleDisplayMessage`
diagnostics:
$ref: '#/definitions/DiagnosticsMessage'
description: If present, this object is a `DiagnosticsMessage`
SimpleDisplayMessage:
type: string
description: |-
A message for display to the user. Note: the message should be displayed
discreetly (such as in a status bar) and should not block the user or
interrupt them.
DiagnosticsMessage:
type: object
description: |-
Diagnostics for a particular file. Note: diagnostics may be supplied for
any arbitrary file. The client is responsible for displaying the
diagnostics in an appropriate manner. The server supplies an empty set of
diagnostics to clear the diagnostics for a particular file.
required:
- filepath
- diagnostics
properties:
filpath:
$ref: '#/definitions/FilePath'
diagnotics:
type: array
items:
$ref: "#/definitions/DiagnosticData"
paths:
/event_notification:
post:
summary: Notify the server of various client events.
description: |-
The server needs to react to a number of client events in order to
provide things like diagnostics and to handle downstream server states
etc. The client must inform the server of the following events,
populating the event name in the `event_name` property:
- `FileReadyToParse`
Call when a new buffer is opened or after the user has
stopped typing for some time, or at any other time when the client
believes that it is worthwhile reparsing the current file and
updating semantic engines' ASTs and reporting things like updated
diagnostics.
- `BufferUnload`
Call when the user closes a buffer that was previously known to be
open. Closing buffers is important to limit resource usage.
- `BufferVisit` (optional)
Call when the user focusses on a buffer that is already known.
*Note*: The `ultisnips_snippets` property is optional when firing
calling this event. Otherwise it is ignored.
- `InsertLeave` (optional)
For modal editors, call when exiting insert mode. It is equivalent
to `CurrentIdentifierFinished`.
- `CurrentIdentifierFinished` (optional)
Call when the user finishes typing what appears to the client to be
an identifier.
produces:
- application/json
parameters:
- name: request_data
in: body
description: |-
The notification data. The line and column are typically not used,
but the `filepath` and file data properties are used to perform
semantic analysis (e.g. in the `FileReadyToParse` handler).
required: true
schema:
type: object
required:
- line_num
- column_num
- filepath
- file_data
- event_name
properties:
line_num:
$ref: "#/definitions/LineNumber"
column_num:
$ref: "#/definitions/ColumnNumber"
filepath:
$ref: "#/definitions/FilePath"
file_data:
$ref: "#/definitions/FileDataMap"
completer_target:
$ref: "#/definitions/CompleterTarget"
working_dir:
$ref: "#/definitions/WorkingDirectory"
extra_conf_data:
$ref: "#/definitions/ExtraConfData"
event_name:
type: string
enum:
- FileReadyToParse
- BufferUnload
- BufferVisit
- InsertLeave
- CurrentIdentifierFinished
description: The event that occurred.
ultisnips_snippets:
type: object
description: |-
*Optional when `event_name` is BufferVisit*
Supplies the ultisips snippets known for the current
filetypes. Can be used to supply any other type of additional
completion suggestions generated by the client.
required:
- trigger
- description
properties:
trigger:
type: string
description: |-
The text to insert in order to trigger the snippet. When
supplying non-ultisnips suggestions, this is the text
to be inserted.
description:
type: string
description: |-
Additional text to display in the completion menu, such
as a summary of the snippet to be inserted.
example:
line_num: 10
column_num: 20
filepath: "/home/test/dev/test.js"
file_data:
"/home/test/dev/test.cc":
filetypes: [ 'cpp' ]
contents: "<file contents>"
event_name: "FileReadyToParse"
responses:
200:
description: Optional set of diagnostics for the current buffer.
schema:
$ref: "#/definitions/DiagnosticResponse"
500:
description: An error occurred.
schema:
$ref: "#/definitions/ExceptionResponse"
/run_completer_command:
post:
summary: Run a semantic completer subcommand.
description: |-
Semantic completers offer additional engine-specific commands, known
as completer subcommands. This endpoint requests a specific command to
be executed. Typically the "default" semantic completer for the current
filetype is used, but it is possible to force the use of a particular
completer, using the `completer_target` property.
The command to execute is passed as a list of arguments, the first of
which is the command name followed by any command- and
completer-specific additional arguments. This "command line" is passed
in the `command_arguments` property.
The list of available subcommands for a particular semantic completer
can be queried using the `/defined_subcommands` endpoint.
Subcommands may return one of a number of actions, depending on the
type of command. The following types of response are returned:
- A *simple display message* response. This is identified where the
type of the response is scalar (i.e. boolean, number, string) or the
type of the response is an object with a `message` property. These
messages are typically only a single line and can be displayed in
a message-box or similarly echoed in a status bar or equivalent.
- A *FixIt* response. This is identified where the type of the response
is an object with a property named `fixits`.
- A *detailed information* response. This is identified where the type
of the response is an object with a `detailed_info` property. These
messages are typically multiple lines (such as the documentation and
signature for a method) and are best displayed in a panel or preview
area (or equivalent).
- A *GoTo* response. This is identified where the response type cannot
be determined by any of the above methods. A GoTo response may contain
either a single location (e.g. for `GoToDeclaration`), or a list of
possible locations for the user to chose from (such as in a
`GoToReferences` subcommand).
produces:
- application/json
parameters:
- name: request_data
in: body
description: |-
The context data, including the current cursor position, and details
of dirty buffers.
required: true
schema:
type: object
required:
- line_num
- column_num
- filepath
- file_data
- command_arguments
- options
properties:
line_num:
$ref: "#/definitions/LineNumber"
column_num:
$ref: "#/definitions/ColumnNumber"
filepath:
$ref: "#/definitions/FilePath"
file_data:
$ref: "#/definitions/FileDataMap"
completer_target:
$ref: "#/definitions/CompleterTarget"
working_dir:
$ref: "#/definitions/WorkingDirectory"
extra_conf_data:
$ref: "#/definitions/ExtraConfData"
command_arguments:
type: array
description: |-
The command line to execute as a list of arguments. The first
such argument is the subcommand to execute (for example:
`GoTo`).
items:
type: string
range:
description: |-
The range to which the command is applied (only used by the
*Format* command).
$ref: "#/definitions/Range"
options:
type: object
description: |-
A set of editor-related options for the current buffer (only
used by the *Format* command).
required:
- tab_size
- insert_spaces
properties:
tab_size:
description: The size of a tabulation in spaces.
type: integer
insert_spaces:
description: Use spaces to represent tabulations.
type: boolean
example:
line_num: 10
column_num: 20
filepath: "/home/test/dev/test.js"
file_data:
"/home/test/dev/test.js":
filetypes: [ 'javascript' ]
contents: "<file contents>"
completer_target: "filetype_default"
command_arguments: [ 'RefactorRename', 'Testing' ]
options:
tab_size: 4
insert_spaces: true
responses:
200:
description: |-
Optional action or display text in response to the request.
*NOTE*: If the type of the response is not an object or list,
then the response is a *simple display message*.
*NOTE*: If the type of the response is a list, then the response is
a GoTo list (e.g. quick-fix list or equivalent) and the
items in the list are of type `GoToLocations`
(see definitions).
schema:
type: object
properties:
fixits:
type: array
description: |-
If present, this is a *FixIt* or *Refactor* response and the
value of this property is a list of potential changes to
buffers to apply the quick fix or refactoring operation.
An empty `fixits` list means that no FixIt or refactoring
was available. If multiple entries are supplied, the user is
prompted to select which one to apply.
items:
$ref: "#/definitions/FixIt"
maxItems: 1
minItems: 0
message:
type: string
description: |-
If present, this is a *simple display message* and the value
of this property is the message to display.
detailed_info:
type: string
description: |-
If present, this is a *detailed information* response and
the value of this property is the multi-line information
to display as unformatted plain text.
filepath:
type: string
description: |-
If present, this is a single *GoTo response* and this value
contains the absolute path of the buffer containing the
target location (identified in `line_num` and `column_num`).
line_num:
$ref: "#/definitions/LineNumber"
column_num:
$ref: "#/definitions/ColumnNumber"
500:
description: An error occurred.
schema:
$ref: "#/definitions/ExceptionResponse"
/completions:
post:
summary: Get completion suggestions for the current file context.
description: |-
Returns the autocompletion suggestions for the current cursor
position. Typically, the server determines whether or not to use
semantic completion or general (i.e. identifier-based) completion
based on the language (filetype) and the context. Clients can force
the use of semantic completion by setting the `force_semantic`
property to `true`.
Note that if `force_semantic` is not set to `true` and the completion
engine returns an error, the server still tries to fall back to
general completion, so this endpoint will typically always return
successfully. Any semantic completer error raised is included in the
response to be dealt with by the client.
When `force_semantic` is `true`, any error returned by the semantic
engine is returned via a 500 response.
produces:
- application/json
parameters:
- name: request_data
in: body
description: |-
The context data, including the current cursor position, and details
of dirty buffers.
required: true
schema:
$ref: "#/definitions/SimpleRequest"
responses:
200:
description: The list of completion suggestions.
schema:
$ref: "#/definitions/CompletionResponse"
500:
description: An error occurred.
schema:
$ref: "#/definitions/ExceptionResponse"
/filter_and_sort_candidates:
post:
summary: Filter and sort a set of candidates using ycmd's fuzzy matching.
description: |-
For filetypes not natively supported by ycmd, clients can often
determine a set of suitable candidate completion suggestions by other
means. In Vim this is typically from the `omnifunc` and other clients
will have equivalents.
This endpoint allows clients to use ycmd's powerful filtering and
ranking capabilities (including longest-common-subsequence and
word-boundary-character ranking) on arbitrary sets of identifiers.
*NOTE:* This API is primarily intended for use when subclassing the
`Completer` class outside of ycmd which is a very niche case,
specific to the `OmniCompleter` in the Vim client. It is not
expected that this API be used elsewhere.
produces:
- application/json
parameters:
- name: request_data
in: body
required: true
description: |-
The set of candidates to sort of the query parameters.
*NOTE:* This `request_data` object is different from most other
ycmd requests as it does not contain buffer data or
cursor locations.
schema:
type: object
properties:
candidates:
type: array
description: The candidates to filter and sort
items:
$ref: "#/definitions/Candidate"
sort_property:
type: string
enum:
- word
- insertion_text
description: |-
Typically set to `insertion_text`, but can be set to `word` when
the candidates are in the form of a simple list of words. In
the latter case, `candidates` must be a list of strings.
query:
type: string
description: |-
The text the user has typed so far for the current identifier.
This is to filter against the suggestions in `candidates`.
responses:
200:
description: The filtered list of candidated
schema:
type: array
items:
$ref: "#/definitions/Candidate"
500:
description: An error occurred
schema:
$ref: "#/definitions/ExceptionResponse"
/healthy:
get:
summary: Check if the server is healthy.
description: |-
Return `true` if the server is healthy, `false` otherwise. The client
should use this endpoint to keep the server alive.
# We don't document the subserver query parameter as it is only for
# testing.
produces:
- application/json
responses:
200:
description: Server is healthy.
schema:
$ref: "#/definitions/AlwaysYes"
500:
description: An error occurred.
schema:
$ref: "#/definitions/ExceptionResponse"
# We don't document the /ready handler as it is only for testing.
/semantic_completer_available:
post:
summary: Determine if semantic completion is available for current buffer.
produces:
- application/json
parameters:
- name: request_data