summaryrefslogtreecommitdiff
path: root/elpa/company-20220326.48/company.info
blob: c01ccb5f2507ba95e14e624487c7b51609f60f45 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
This is company.info, produced by makeinfo version 6.7 from
company.texi.

This user manual is for Company version 0.9.14snapshot (8 January 2022).

Copyright © 2021-2022 Free Software Foundation, Inc.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.3 or any later version published by the Free Software
     Foundation.
INFO-DIR-SECTION Emacs misc features
START-INFO-DIR-ENTRY
* Company: (company).           A modular text completion framework.
END-INFO-DIR-ENTRY


File: company.info,  Node: Top,  Next: Overview,  Up: (dir)

Company
*******

Company is a modular text completion framework for GNU Emacs.

The goal of this document is to lay out the foundational knowledge of
the package, so that the readers of the manual could competently start
adapting Company to their needs and preferences.

This user manual is for Company version 0.9.14snapshot (8 January 2022).

Copyright © 2021-2022 Free Software Foundation, Inc.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.3 or any later version published by the Free Software
     Foundation.

* Menu:

* Overview:: Terminology and Structure
* Getting Started:: Quick Start Guide
* Customization:: User Options
* Frontends:: Frontends Usage Instructions
* Backends:: Backends Usage Instructions
* Troubleshooting:: When Something Goes Wrong
* Index::

— The Detailed Node Listing —

Overview

* Terminology::
* Structure::

Getting Started

* Installation::
* Initial Setup::
* Usage Basics::
* Commands::

Customization

* Customization Interface::
* Configuration File::

Frontends

* Tooltip Frontends::
* Preview Frontends::
* Echo Frontends::
* Candidates Search::
* Filter Candidates::
* Quick Access a Candidate::

Backends

* Backends Usage Basics::
* Grouped Backends::
* Package Backends::
* Candidates Post-Processing::



File: company.info,  Node: Overview,  Next: Getting Started,  Prev: Top,  Up: Top

1 Overview
**********

“Company” is a modular text completion framework for GNU Emacs.

In other words, it is a package for retrieving, manipulating, and
displaying text completion candidates.  It aims to assist developers,
writers, and scientists during code and text writing.

* Menu:

* Terminology::
* Structure::


File: company.info,  Node: Terminology,  Next: Structure,  Up: Overview

1.1 Terminology
===============

“Completion” is an act of intelligibly guessing possible variants of
words based on already typed characters.  To “complete” a word means to
insert a correctly guessed variant into the buffer.

Consequently, the “candidates” are the aforementioned guessed variants
of words.  Each of the candidates has the potential to be chosen for
successful completion.  And each of the candidates contains the
initially typed characters: either only at the beginning (so-called
“prefix matches”), or also inside (“non-prefix matches”) of a candidate
(1).

The package’s name “Company” is based on the combination of the two
words: ‘Complete’ and ‘Anything’.  These words reflect the package’s
commitment to handling completion candidates and its extensible nature
allowing it to cover a wide range of usage scenarios.

   ---------- Footnotes ----------

   (1) A good starting point to learn about types of matches is to play
with the Emacs’s user option ‘completion-styles’.  For illustrations on
how Company visualizes the matches, *note Frontends::.


File: company.info,  Node: Structure,  Prev: Terminology,  Up: Overview

1.2 Structure
=============

The Company is easily extensible because its significant building blocks
are pluggable modules: backends (*note Backends::) and frontends (*note
Frontends::).

The “backends” are responsible for retrieving completion candidates;
which are then outputted by the “frontends”.  For an easy and quick
initial setup, Company is supplied with the preconfigured sets of the
backends and frontends.  The default behavior of the modules can be
adjusted per particular needs, goals, and preferences.  It is also
typical to utilize backends from a variety of third-party libraries
(https://github.com/company-mode/company-mode/wiki/Third-Party-Packages),
developed to be pluggable with Company.

But Company consists not only of the backends and frontends.

A core of the package plays the role of a controller, connecting the
modules, making them work together; and exposing configurations and
commands for a user to operate with.  For more details, *note
Customization:: and *note Commands::.

Also, Company is bundled with an alternative workflow configuration
“company-tng” — defining ‘company-tng-frontend’, ‘company-tng-mode’, and
‘company-tng-map’ — that allows performing completion with just <TAB>.
To enable this configuration, add the following line to the Emacs
initialization file (*note (emacs)Init File::):

     (add-hook 'after-init-hook 'company-tng-mode)


File: company.info,  Node: Getting Started,  Next: Customization,  Prev: Overview,  Up: Top

2 Getting Started
*****************

This chapter provides basic instructions for Company setup and usage.

* Menu:

* Installation::
* Initial Setup::
* Usage Basics::
* Commands::


File: company.info,  Node: Installation,  Next: Initial Setup,  Up: Getting Started

2.1 Installation
================

Company package is distributed via commonly used package archives in a
form of both stable and development releases.  To install Company, type
‘M-x package-install <RET> company <RET>’.

For more details on Emacs package archives, *note (emacs)Packages::.


File: company.info,  Node: Initial Setup,  Next: Usage Basics,  Prev: Installation,  Up: Getting Started

2.2 Initial Setup
=================

The package Company provides a minor mode “company-mode”.

To activate the _company-mode_, execute the command ‘M-x company-mode’
that toggles the mode on and off.  When it is switched on, the mode line
(*note (emacs)Mode line::) should indicate its presence with an
indicator ‘company’.

After _company-mode_ had been enabled, the package auto-starts
suggesting completion candidates.  The candidates are retrieved and
shown according to the typed characters and the default (until a user
specifies otherwise) configurations.

To have Company always enabled for the following sessions, add the line
‘(global-company-mode)’ to the Emacs configuration file
(*note (emacs)Init File::).


File: company.info,  Node: Usage Basics,  Next: Commands,  Prev: Initial Setup,  Up: Getting Started

2.3 Usage Basics
================

By default — having _company-mode_ enabled (*note Initial Setup::) — a
tooltip with completion candidates is shown when a user types in a few
characters.

To initiate completion manually, use the command ‘M-x company-complete’.

To select next or previous of the shown completion candidates, use
respectively key bindings ‘C-n’ and ‘C-p’, then do one of the following:

   • Hit <RET> to choose a selected candidate for completion.

   • Hit <TAB> to complete with the “common part”: characters present at
     the beginning of all the candidates.

   • Hit ‘C-g’ to stop activity of Company.


File: company.info,  Node: Commands,  Prev: Usage Basics,  Up: Getting Started

2.4 Commands
============

Under the hood, mentioned in the previous section keys are bound to the
commands of the out-of-the-box Company.

‘C-n’
‘M-n’
     Select the next candidate (‘company-select-next-or-abort’,
     ‘company-select-next’).

‘C-p’
‘M-p’
     Select the previous candidate (‘company-select-previous-or-abort’,
     ‘company-select-previous’).

‘RET’
‘<return>’
     Insert the selected candidate (‘company-complete-selection’).

‘TAB’
‘<tab>’
     Insert the common part of all the candidates
     (‘company-complete-common’).

‘C-g’
‘<ESC ESC ESC>’
     Cancel _company-mode_ activity (‘company-abort’).

‘C-h’
‘<f1>’
     Display a buffer with the documentation for the selected candidate
     (‘company-show-doc-buffer’).

‘C-w’
     Display a buffer with the definition of the selected candidate
     (‘company-show-location’).

The full list of the default key bindings is stored in the variables
‘company-active-map’ and ‘company-search-map’ (1).

Moreover, Company is bundled with a number of convenience commands that
do not have default key bindings defined.  The following examples
illustrate how to assign key bindings to such commands.

     (global-set-key (kbd "<tab>") #'company-indent-or-complete-common)

     (with-eval-after-load 'company
       (define-key company-active-map (kbd "M-/") #'company-complete))

     (with-eval-after-load 'company
       (define-key company-active-map
                   (kbd "TAB")
                   #'company-complete-common-or-cycle)
       (define-key company-active-map
                   (kbd "<backtab>")
                   (lambda ()
                     (interactive)
                     (company-complete-common-or-cycle -1))))

In the same manner, an additional key can be assigned to a command or a
command can be unbound from a key.  For instance:

     (with-eval-after-load 'company
       (define-key company-active-map (kbd "M-.") #'company-show-location)
       (define-key company-active-map (kbd "RET") nil))

   ---------- Footnotes ----------

   (1) For a more user-friendly output of the pre-defined key bindings,
utilize ‘M-x describe-keymap <RET> company-active-map’ or
‘C-h f <RET> company-mode’.


File: company.info,  Node: Customization,  Next: Frontends,  Prev: Getting Started,  Up: Top

3 Customization
***************

Emacs provides two equally acceptable ways for user preferences
configuration: via customization interface (for more details, *note
(emacs)Easy Customization::) and a configuration file
(*note (emacs)Init File::).  Naturally, Company can be configured by
both of these approaches.

* Menu:

* Customization Interface::
* Configuration File::


File: company.info,  Node: Customization Interface,  Next: Configuration File,  Up: Customization

3.1 Customization Interface
===========================

In order to employ the customization interface, run
‘M-x customize-group <RET> company’.

This interface outputs all the options available for user customization,
so you may find it beneficial to review this list even if you are going
to configure Company with the configuration file.

For instructions on how to change the settings, *note (emacs)Changing a
Variable::.


File: company.info,  Node: Configuration File,  Prev: Customization Interface,  Up: Customization

3.2 Configuration File
======================

Company is a customization-rich package.  This section lists some of the
core settings that influence the overall behavior of the _company-mode_.

 -- User Option: company-minimum-prefix-length
     This is one of the values (together with ‘company-idle-delay’),
     based on which Company auto-stars looking up completion candidates.
     This option configures how many characters have to be typed in by a
     user before candidates start to be collected and displayed.  An
     often choice nowadays is to configure this option to a lower number
     than the default value of ‘3’.

 -- User Option: company-idle-delay
     This is the second of the options that configure Company’s
     auto-start behavior (together with
     ‘company-minimum-prefix-length’).  The value of this option defines
     how fast Company is going to react to the typed input, such that
     setting ‘company-idle-delay’ to ‘0’ makes Company react
     immediately, ‘nil’ disables auto-starting, and a larger value
     postpones completion auto-start for that number of seconds.  For an
     even fancier setup, set this option value to a predicate function,
     as shown in the following example:

          (setq company-idle-delay
                (lambda () (if (company-in-string-or-comment) nil 0.3)))

 -- User Option: company-global-modes
     This option allows to specify in which major modes _company-mode_
     can be enabled by ‘(global-company-mode)’.  *Note Initial Setup::.
     The default value of ‘t’ enables Company in all major modes.
     Setting ‘company-global-modes’ to ‘nil’ equal in action to toggling
     off _global-company-mode_.  Providing a list of major modes results
     in having _company-mode_ enabled in the listed modes only.  For the
     opposite result, provide a list of major modes with ‘not’ being the
     first element of the list, as shown in the following example:

          (setq company-global-modes '(not erc-mode message-mode eshell-mode))

 -- User Option: company-selection-wrap-around
     Enable this option to loop (cycle) the candidates’ selection: after
     selecting the last candidate on the list, a command to select the
     next candidate does so with the first candidate.  By default, this
     option is disabled, which means the selection of the next candidate
     stops on the last item.  The selection of the previous candidate is
     influenced by this option similarly.

 -- User Option: company-require-match
     To allow typing in characters that don’t match the candidates, set
     the value of this option to ‘nil’.  For an opposite behavior (that
     is, to disallow non-matching input), set it to ‘t’.  By default,
     Company is configured to require a matching input only if a user
     manually enables completion or selects a candidate; by having the
     option configured to call the function ‘company-explicit-action-p’.

 -- User Option: company-lighter-base
     This user options allows to configure a string indicator of the
     enabled _company-mode_ in the mode line.  The default value is
     ‘company’.

 -- User Option: company-insertion-on-trigger
     One more pair of the user options may instruct Company to complete
     with the selected candidate by typing one of the
     ‘company-insertion-triggers’.  The user option
     ‘company-insertion-on-trigger’ can be enabled or disabled by
     setting its value to one of: ‘nil’, ‘t’, or a predicate function
     name.  *note Predicate: (eintr)Wrong Type of Argument.

 -- User Option: company-insertion-triggers
     This option has an effect only when ‘company-insertion-on-trigger’
     is enabled.  The value can be one of: a string of characters, a
     list of syntax description characters (*note (elisp)Syntax Class
     Table::), or a predicate function.  By default, this user option is
     set to the list of the syntax characters: ‘(?\ ?\) ?.)’, which
     translates to the whitespaces, close parenthesis, and punctuation.
     It is safe to configure the value to a character that can
     potentially be part of a valid completion; in this case, Company
     does not treat such characters as triggers.

Hooks
-----

Company exposes the following life-cycle hooks:

 -- User Option: company-completion-started-hook

 -- User Option: company-completion-cancelled-hook

 -- User Option: company-completion-finished-hook

 -- User Option: company-after-completion-hook


File: company.info,  Node: Frontends,  Next: Backends,  Prev: Customization,  Up: Top

4 Frontends
***********

Company is packaged with several frontends and provides a predefined set
of enabled frontends.  A list of the enabled frontends can be changed by
configuring the user option ‘company-frontends’.

Each frontend is simply a function that receives a command and acts
accordingly to it: outputs candidates, hides its output, refreshes
displayed data, and so on.

All of the Company frontends can be categorized by the type of the
output into the three groups: “tooltip-”, “preview-”, and “echo-”
frontends.  We overview these groups in the first sections of this
chapter.  The sections that follow are dedicated to the ways the
displayed candidates can be searched, filtered, and quick-accessed.

* Menu:

* Tooltip Frontends::
* Preview Frontends::
* Echo Frontends::
* Candidates Search::
* Filter Candidates::
* Quick Access a Candidate::


File: company.info,  Node: Tooltip Frontends,  Next: Preview Frontends,  Up: Frontends

4.1 Tooltip Frontends
=====================

This group of frontends displays completion candidates in an overlayed
tooltip (aka pop-up).  Company provides three _tooltip frontends_,
listed below.

 -- Function: company-pseudo-tooltip-unless-just-one-frontend
     This is one of the default frontends.  It starts displaying a
     tooltip only if more than one completion candidate is available,
     which nicely combines — and it is done so by default — with
     ‘company-preview-if-just-one-frontend’, *note Preview Frontends::.

 -- Function: company-pseudo-tooltip-frontend
     This frontend outputs a tooltip for any number of completion
     candidates.

 -- Function: company-pseudo-tooltip-unless-just-one-frontend-with-delay
     This is a peculiar frontend, that displays a tooltip only if more
     than one candidate is available, and only after a delay.  The delay
     can be configured with the user option
     ‘company-tooltip-idle-delay’.  A typical use case for plugging in
     this frontend would be displaying a tooltip only on a manual
     request (when needed), as shown in the following example:

          (setq company-idle-delay 0
                company-tooltip-idle-delay 10
                company-require-match nil
                company-frontends
                '(company-pseudo-tooltip-unless-just-one-frontend-with-delay
                  company-preview-frontend
                  company-echo-metadata-frontend)
                company-backends '(company-capf))

          (global-set-key (kbd "<tab>")
                          (lambda ()
                            (interactive)
                            (let ((company-tooltip-idle-delay 0.0))
                              (company-complete)
                              (and company-candidates
                                   (company-call-frontends 'post-command)))))

User Options
------------

To change the _tooltip frontends_ configuration, adjust the following
user options.

 -- User Option: company-tooltip-align-annotations
     An “annotation” is a string that carries additional information
     about a candidate; such as a data type, function arguments, or
     whatever a backend appoints to be a valuable piece of information
     about a candidate.  By default, the annotations are shown right
     beside the candidates.  Setting the option value to ‘t’ aligns
     annotations to the right side of the tooltip.

          (setq company-tooltip-align-annotations t)