lspt 0.3.0

Language Server Protocol (LSP) types made easy.
Documentation
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
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
// DO NOT EDIT THIS GENERATED FILE.

use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// A set of predefined token types. This set is not fixed
/// an clients can specify additional token types via the
/// corresponding client capabilities.
///
/// @since 3.16.0
pub enum SemanticTokenTypes {
    #[serde(rename = "namespace")]
    Namespace,

    #[serde(rename = "type")]
    /// Represents a generic type. Acts as a fallback for types which can't be mapped to
    /// a specific type like class or enum.
    Type,

    #[serde(rename = "class")]
    Class,

    #[serde(rename = "enum")]
    Enum,

    #[serde(rename = "interface")]
    Interface,

    #[serde(rename = "struct")]
    Struct,

    #[serde(rename = "typeParameter")]
    TypeParameter,

    #[serde(rename = "parameter")]
    Parameter,

    #[serde(rename = "variable")]
    Variable,

    #[serde(rename = "property")]
    Property,

    #[serde(rename = "enumMember")]
    EnumMember,

    #[serde(rename = "event")]
    Event,

    #[serde(rename = "function")]
    Function,

    #[serde(rename = "method")]
    Method,

    #[serde(rename = "macro")]
    Macro,

    #[serde(rename = "keyword")]
    Keyword,

    #[serde(rename = "modifier")]
    Modifier,

    #[serde(rename = "comment")]
    Comment,

    #[serde(rename = "string")]
    String,

    #[serde(rename = "number")]
    Number,

    #[serde(rename = "regexp")]
    Regexp,

    #[serde(rename = "operator")]
    Operator,

    #[serde(rename = "decorator")]
    /// @since 3.17.0
    Decorator,

    #[serde(rename = "label")]
    /// @since 3.18.0
    Label,

    #[serde(untagged)]
    Custom_(String),
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// A set of predefined token modifiers. This set is not fixed
/// an clients can specify additional token types via the
/// corresponding client capabilities.
///
/// @since 3.16.0
pub enum SemanticTokenModifiers {
    #[serde(rename = "declaration")]
    Declaration,

    #[serde(rename = "definition")]
    Definition,

    #[serde(rename = "readonly")]
    Readonly,

    #[serde(rename = "static")]
    Static,

    #[serde(rename = "deprecated")]
    Deprecated,

    #[serde(rename = "abstract")]
    Abstract,

    #[serde(rename = "async")]
    Async,

    #[serde(rename = "modification")]
    Modification,

    #[serde(rename = "documentation")]
    Documentation,

    #[serde(rename = "defaultLibrary")]
    DefaultLibrary,

    #[serde(untagged)]
    Custom_(String),
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// The document diagnostic report kinds.
///
/// @since 3.17.0
pub enum DocumentDiagnosticReportKind {
    #[serde(rename = "full")]
    /// A diagnostic report with a full
    /// set of problems.
    Full,

    #[serde(rename = "unchanged")]
    /// A report indicating that the last
    /// returned report is still accurate.
    Unchanged,
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Predefined error codes.
pub enum ErrorCodes {
    ParseError = -32700,

    InvalidRequest = -32600,

    MethodNotFound = -32601,

    InvalidParams = -32602,

    InternalError = -32603,

    /// Error code indicating that a server received a notification or
    /// request before the server has received the `initialize` request.
    ServerNotInitialized = -32002,

    UnknownErrorCode = -32001,
}
impl Serialize for ErrorCodes {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            ErrorCodes::ParseError => serializer.serialize_i32(-32700),
            ErrorCodes::InvalidRequest => serializer.serialize_i32(-32600),
            ErrorCodes::MethodNotFound => serializer.serialize_i32(-32601),
            ErrorCodes::InvalidParams => serializer.serialize_i32(-32602),
            ErrorCodes::InternalError => serializer.serialize_i32(-32603),
            ErrorCodes::ServerNotInitialized => serializer.serialize_i32(-32002),
            ErrorCodes::UnknownErrorCode => serializer.serialize_i32(-32001),
        }
    }
}
impl<'de> Deserialize<'de> for ErrorCodes {
    fn deserialize<D>(deserializer: D) -> Result<ErrorCodes, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = i32::deserialize(deserializer)?;
        match value {
            -32700 => Ok(ErrorCodes::ParseError),
            -32600 => Ok(ErrorCodes::InvalidRequest),
            -32601 => Ok(ErrorCodes::MethodNotFound),
            -32602 => Ok(ErrorCodes::InvalidParams),
            -32603 => Ok(ErrorCodes::InternalError),
            -32002 => Ok(ErrorCodes::ServerNotInitialized),
            -32001 => Ok(ErrorCodes::UnknownErrorCode),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of -32700, -32600, -32601, -32602, -32603, -32002, -32001",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum LSPErrorCodes {
    /// A request failed but it was syntactically correct, e.g the
    /// method name was known and the parameters were valid. The error
    /// message should contain human readable information about why
    /// the request failed.
    ///
    /// @since 3.17.0
    RequestFailed = -32803,

    /// The server cancelled the request. This error code should
    /// only be used for requests that explicitly support being
    /// server cancellable.
    ///
    /// @since 3.17.0
    ServerCancelled = -32802,

    /// The server detected that the content of a document got
    /// modified outside normal conditions. A server should
    /// NOT send this error code if it detects a content change
    /// in it unprocessed messages. The result even computed
    /// on an older state might still be useful for the client.
    ///
    /// If a client decides that a result is not of any use anymore
    /// the client should cancel the request.
    ContentModified = -32801,

    /// The client has canceled a request and a server has detected
    /// the cancel.
    RequestCancelled = -32800,
}
impl Serialize for LSPErrorCodes {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            LSPErrorCodes::RequestFailed => serializer.serialize_i32(-32803),
            LSPErrorCodes::ServerCancelled => serializer.serialize_i32(-32802),
            LSPErrorCodes::ContentModified => serializer.serialize_i32(-32801),
            LSPErrorCodes::RequestCancelled => serializer.serialize_i32(-32800),
        }
    }
}
impl<'de> Deserialize<'de> for LSPErrorCodes {
    fn deserialize<D>(deserializer: D) -> Result<LSPErrorCodes, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = i32::deserialize(deserializer)?;
        match value {
            -32803 => Ok(LSPErrorCodes::RequestFailed),
            -32802 => Ok(LSPErrorCodes::ServerCancelled),
            -32801 => Ok(LSPErrorCodes::ContentModified),
            -32800 => Ok(LSPErrorCodes::RequestCancelled),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of -32803, -32802, -32801, -32800",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// A set of predefined range kinds.
pub enum FoldingRangeKind {
    #[serde(rename = "comment")]
    /// Folding range for a comment
    Comment,

    #[serde(rename = "imports")]
    /// Folding range for an import or include
    Imports,

    #[serde(rename = "region")]
    /// Folding range for a region (e.g. `#region`)
    Region,

    #[serde(untagged)]
    Custom_(String),
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// A symbol kind.
pub enum SymbolKind {
    File = 1,

    Module = 2,

    Namespace = 3,

    Package = 4,

    Class = 5,

    Method = 6,

    Property = 7,

    Field = 8,

    Constructor = 9,

    Enum = 10,

    Interface = 11,

    Function = 12,

    Variable = 13,

    Constant = 14,

    String = 15,

    Number = 16,

    Boolean = 17,

    Array = 18,

    Object = 19,

    Key = 20,

    Null = 21,

    EnumMember = 22,

    Struct = 23,

    Event = 24,

    Operator = 25,

    TypeParameter = 26,
}
impl Serialize for SymbolKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            SymbolKind::File => serializer.serialize_u32(1),
            SymbolKind::Module => serializer.serialize_u32(2),
            SymbolKind::Namespace => serializer.serialize_u32(3),
            SymbolKind::Package => serializer.serialize_u32(4),
            SymbolKind::Class => serializer.serialize_u32(5),
            SymbolKind::Method => serializer.serialize_u32(6),
            SymbolKind::Property => serializer.serialize_u32(7),
            SymbolKind::Field => serializer.serialize_u32(8),
            SymbolKind::Constructor => serializer.serialize_u32(9),
            SymbolKind::Enum => serializer.serialize_u32(10),
            SymbolKind::Interface => serializer.serialize_u32(11),
            SymbolKind::Function => serializer.serialize_u32(12),
            SymbolKind::Variable => serializer.serialize_u32(13),
            SymbolKind::Constant => serializer.serialize_u32(14),
            SymbolKind::String => serializer.serialize_u32(15),
            SymbolKind::Number => serializer.serialize_u32(16),
            SymbolKind::Boolean => serializer.serialize_u32(17),
            SymbolKind::Array => serializer.serialize_u32(18),
            SymbolKind::Object => serializer.serialize_u32(19),
            SymbolKind::Key => serializer.serialize_u32(20),
            SymbolKind::Null => serializer.serialize_u32(21),
            SymbolKind::EnumMember => serializer.serialize_u32(22),
            SymbolKind::Struct => serializer.serialize_u32(23),
            SymbolKind::Event => serializer.serialize_u32(24),
            SymbolKind::Operator => serializer.serialize_u32(25),
            SymbolKind::TypeParameter => serializer.serialize_u32(26),
        }
    }
}
impl<'de> Deserialize<'de> for SymbolKind {
    fn deserialize<D>(deserializer: D) -> Result<SymbolKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(SymbolKind::File),
            2 => Ok(SymbolKind::Module),
            3 => Ok(SymbolKind::Namespace),
            4 => Ok(SymbolKind::Package),
            5 => Ok(SymbolKind::Class),
            6 => Ok(SymbolKind::Method),
            7 => Ok(SymbolKind::Property),
            8 => Ok(SymbolKind::Field),
            9 => Ok(SymbolKind::Constructor),
            10 => Ok(SymbolKind::Enum),
            11 => Ok(SymbolKind::Interface),
            12 => Ok(SymbolKind::Function),
            13 => Ok(SymbolKind::Variable),
            14 => Ok(SymbolKind::Constant),
            15 => Ok(SymbolKind::String),
            16 => Ok(SymbolKind::Number),
            17 => Ok(SymbolKind::Boolean),
            18 => Ok(SymbolKind::Array),
            19 => Ok(SymbolKind::Object),
            20 => Ok(SymbolKind::Key),
            21 => Ok(SymbolKind::Null),
            22 => Ok(SymbolKind::EnumMember),
            23 => Ok(SymbolKind::Struct),
            24 => Ok(SymbolKind::Event),
            25 => Ok(SymbolKind::Operator),
            26 => Ok(SymbolKind::TypeParameter),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 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",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Symbol tags are extra annotations that tweak the rendering of a symbol.
///
/// @since 3.16
pub enum SymbolTag {
    /// Render a symbol as obsolete, usually using a strike-out.
    Deprecated = 1,
}
impl Serialize for SymbolTag {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            SymbolTag::Deprecated => serializer.serialize_u32(1),
        }
    }
}
impl<'de> Deserialize<'de> for SymbolTag {
    fn deserialize<D>(deserializer: D) -> Result<SymbolTag, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(SymbolTag::Deprecated),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// Moniker uniqueness level to define scope of the moniker.
///
/// @since 3.16.0
pub enum UniquenessLevel {
    #[serde(rename = "document")]
    /// The moniker is only unique inside a document
    Document,

    #[serde(rename = "project")]
    /// The moniker is unique inside a project for which a dump got created
    Project,

    #[serde(rename = "group")]
    /// The moniker is unique inside the group to which a project belongs
    Group,

    #[serde(rename = "scheme")]
    /// The moniker is unique inside the moniker scheme.
    Scheme,

    #[serde(rename = "global")]
    /// The moniker is globally unique
    Global,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// The moniker kind.
///
/// @since 3.16.0
pub enum MonikerKind {
    #[serde(rename = "import")]
    /// The moniker represent a symbol that is imported into a project
    Import,

    #[serde(rename = "export")]
    /// The moniker represents a symbol that is exported from a project
    Export,

    #[serde(rename = "local")]
    /// The moniker represents a symbol that is local to a project (e.g. a local
    /// variable of a function, a class not visible outside the project, ...)
    Local,
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Inlay hint kinds.
///
/// @since 3.17.0
pub enum InlayHintKind {
    /// An inlay hint that for a type annotation.
    Type = 1,

    /// An inlay hint that is for a parameter.
    Parameter = 2,
}
impl Serialize for InlayHintKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            InlayHintKind::Type => serializer.serialize_u32(1),
            InlayHintKind::Parameter => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for InlayHintKind {
    fn deserialize<D>(deserializer: D) -> Result<InlayHintKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(InlayHintKind::Type),
            2 => Ok(InlayHintKind::Parameter),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// The message type
pub enum MessageType {
    /// An error message.
    Error = 1,

    /// A warning message.
    Warning = 2,

    /// An information message.
    Info = 3,

    /// A log message.
    Log = 4,

    #[cfg(feature = "proposed")]
    /// A debug message.
    ///
    /// @since 3.18.0
    /// @proposed
    Debug = 5,
}
impl Serialize for MessageType {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            MessageType::Error => serializer.serialize_u32(1),
            MessageType::Warning => serializer.serialize_u32(2),
            MessageType::Info => serializer.serialize_u32(3),
            MessageType::Log => serializer.serialize_u32(4),
            #[cfg(feature = "proposed")]
            MessageType::Debug => serializer.serialize_u32(5),
        }
    }
}
impl<'de> Deserialize<'de> for MessageType {
    fn deserialize<D>(deserializer: D) -> Result<MessageType, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(MessageType::Error),
            2 => Ok(MessageType::Warning),
            3 => Ok(MessageType::Info),
            4 => Ok(MessageType::Log),
            #[cfg(feature = "proposed")]
            5 => Ok(MessageType::Debug),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 3, 4, 5",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Defines how the host (editor) should sync
/// document changes to the language server.
pub enum TextDocumentSyncKind {
    /// Documents should not be synced at all.
    None = 0,

    /// Documents are synced by always sending the full content
    /// of the document.
    Full = 1,

    /// Documents are synced by sending the full content on open.
    /// After that only incremental updates to the document are
    /// send.
    Incremental = 2,
}
impl Serialize for TextDocumentSyncKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            TextDocumentSyncKind::None => serializer.serialize_u32(0),
            TextDocumentSyncKind::Full => serializer.serialize_u32(1),
            TextDocumentSyncKind::Incremental => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for TextDocumentSyncKind {
    fn deserialize<D>(deserializer: D) -> Result<TextDocumentSyncKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            0 => Ok(TextDocumentSyncKind::None),
            1 => Ok(TextDocumentSyncKind::Full),
            2 => Ok(TextDocumentSyncKind::Incremental),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 0, 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Represents reasons why a text document is saved.
pub enum TextDocumentSaveReason {
    /// Manually triggered, e.g. by the user pressing save, by starting debugging,
    /// or by an API call.
    Manual = 1,

    /// Automatic after a delay.
    AfterDelay = 2,

    /// When the editor lost focus.
    FocusOut = 3,
}
impl Serialize for TextDocumentSaveReason {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            TextDocumentSaveReason::Manual => serializer.serialize_u32(1),
            TextDocumentSaveReason::AfterDelay => serializer.serialize_u32(2),
            TextDocumentSaveReason::FocusOut => serializer.serialize_u32(3),
        }
    }
}
impl<'de> Deserialize<'de> for TextDocumentSaveReason {
    fn deserialize<D>(deserializer: D) -> Result<TextDocumentSaveReason, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(TextDocumentSaveReason::Manual),
            2 => Ok(TextDocumentSaveReason::AfterDelay),
            3 => Ok(TextDocumentSaveReason::FocusOut),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 3",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// The kind of a completion entry.
pub enum CompletionItemKind {
    Text = 1,

    Method = 2,

    Function = 3,

    Constructor = 4,

    Field = 5,

    Variable = 6,

    Class = 7,

    Interface = 8,

    Module = 9,

    Property = 10,

    Unit = 11,

    Value = 12,

    Enum = 13,

    Keyword = 14,

    Snippet = 15,

    Color = 16,

    File = 17,

    Reference = 18,

    Folder = 19,

    EnumMember = 20,

    Constant = 21,

    Struct = 22,

    Event = 23,

    Operator = 24,

    TypeParameter = 25,
}
impl Serialize for CompletionItemKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            CompletionItemKind::Text => serializer.serialize_u32(1),
            CompletionItemKind::Method => serializer.serialize_u32(2),
            CompletionItemKind::Function => serializer.serialize_u32(3),
            CompletionItemKind::Constructor => serializer.serialize_u32(4),
            CompletionItemKind::Field => serializer.serialize_u32(5),
            CompletionItemKind::Variable => serializer.serialize_u32(6),
            CompletionItemKind::Class => serializer.serialize_u32(7),
            CompletionItemKind::Interface => serializer.serialize_u32(8),
            CompletionItemKind::Module => serializer.serialize_u32(9),
            CompletionItemKind::Property => serializer.serialize_u32(10),
            CompletionItemKind::Unit => serializer.serialize_u32(11),
            CompletionItemKind::Value => serializer.serialize_u32(12),
            CompletionItemKind::Enum => serializer.serialize_u32(13),
            CompletionItemKind::Keyword => serializer.serialize_u32(14),
            CompletionItemKind::Snippet => serializer.serialize_u32(15),
            CompletionItemKind::Color => serializer.serialize_u32(16),
            CompletionItemKind::File => serializer.serialize_u32(17),
            CompletionItemKind::Reference => serializer.serialize_u32(18),
            CompletionItemKind::Folder => serializer.serialize_u32(19),
            CompletionItemKind::EnumMember => serializer.serialize_u32(20),
            CompletionItemKind::Constant => serializer.serialize_u32(21),
            CompletionItemKind::Struct => serializer.serialize_u32(22),
            CompletionItemKind::Event => serializer.serialize_u32(23),
            CompletionItemKind::Operator => serializer.serialize_u32(24),
            CompletionItemKind::TypeParameter => serializer.serialize_u32(25),
        }
    }
}
impl<'de> Deserialize<'de> for CompletionItemKind {
    fn deserialize<D>(deserializer: D) -> Result<CompletionItemKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(CompletionItemKind::Text),
            2 => Ok(CompletionItemKind::Method),
            3 => Ok(CompletionItemKind::Function),
            4 => Ok(CompletionItemKind::Constructor),
            5 => Ok(CompletionItemKind::Field),
            6 => Ok(CompletionItemKind::Variable),
            7 => Ok(CompletionItemKind::Class),
            8 => Ok(CompletionItemKind::Interface),
            9 => Ok(CompletionItemKind::Module),
            10 => Ok(CompletionItemKind::Property),
            11 => Ok(CompletionItemKind::Unit),
            12 => Ok(CompletionItemKind::Value),
            13 => Ok(CompletionItemKind::Enum),
            14 => Ok(CompletionItemKind::Keyword),
            15 => Ok(CompletionItemKind::Snippet),
            16 => Ok(CompletionItemKind::Color),
            17 => Ok(CompletionItemKind::File),
            18 => Ok(CompletionItemKind::Reference),
            19 => Ok(CompletionItemKind::Folder),
            20 => Ok(CompletionItemKind::EnumMember),
            21 => Ok(CompletionItemKind::Constant),
            22 => Ok(CompletionItemKind::Struct),
            23 => Ok(CompletionItemKind::Event),
            24 => Ok(CompletionItemKind::Operator),
            25 => Ok(CompletionItemKind::TypeParameter),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 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",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Completion item tags are extra annotations that tweak the rendering of a completion
/// item.
///
/// @since 3.15.0
pub enum CompletionItemTag {
    /// Render a completion as obsolete, usually using a strike-out.
    Deprecated = 1,
}
impl Serialize for CompletionItemTag {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            CompletionItemTag::Deprecated => serializer.serialize_u32(1),
        }
    }
}
impl<'de> Deserialize<'de> for CompletionItemTag {
    fn deserialize<D>(deserializer: D) -> Result<CompletionItemTag, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(CompletionItemTag::Deprecated),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Defines whether the insert text in a completion item should be interpreted as
/// plain text or a snippet.
pub enum InsertTextFormat {
    /// The primary text to be inserted is treated as a plain string.
    PlainText = 1,

    /// The primary text to be inserted is treated as a snippet.
    ///
    /// A snippet can define tab stops and placeholders with `$1`, `$2`
    /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
    /// the end of the snippet. Placeholders with equal identifiers are linked,
    /// that is typing in one will update others too.
    ///
    /// See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
    Snippet = 2,
}
impl Serialize for InsertTextFormat {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            InsertTextFormat::PlainText => serializer.serialize_u32(1),
            InsertTextFormat::Snippet => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for InsertTextFormat {
    fn deserialize<D>(deserializer: D) -> Result<InsertTextFormat, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(InsertTextFormat::PlainText),
            2 => Ok(InsertTextFormat::Snippet),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// How whitespace and indentation is handled during completion
/// item insertion.
///
/// @since 3.16.0
pub enum InsertTextMode {
    /// The insertion or replace strings is taken as it is. If the
    /// value is multi line the lines below the cursor will be
    /// inserted using the indentation defined in the string value.
    /// The client will not apply any kind of adjustments to the
    /// string.
    AsIs = 1,

    /// The editor adjusts leading whitespace of new lines so that
    /// they match the indentation up to the cursor of the line for
    /// which the item is accepted.
    ///
    /// Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
    /// multi line completion item is indented using 2 tabs and all
    /// following lines inserted will be indented using 2 tabs as well.
    AdjustIndentation = 2,
}
impl Serialize for InsertTextMode {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            InsertTextMode::AsIs => serializer.serialize_u32(1),
            InsertTextMode::AdjustIndentation => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for InsertTextMode {
    fn deserialize<D>(deserializer: D) -> Result<InsertTextMode, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(InsertTextMode::AsIs),
            2 => Ok(InsertTextMode::AdjustIndentation),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// A document highlight kind.
pub enum DocumentHighlightKind {
    /// A textual occurrence.
    Text = 1,

    /// Read-access of a symbol, like reading a variable.
    Read = 2,

    /// Write-access of a symbol, like writing to a variable.
    Write = 3,
}
impl Serialize for DocumentHighlightKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            DocumentHighlightKind::Text => serializer.serialize_u32(1),
            DocumentHighlightKind::Read => serializer.serialize_u32(2),
            DocumentHighlightKind::Write => serializer.serialize_u32(3),
        }
    }
}
impl<'de> Deserialize<'de> for DocumentHighlightKind {
    fn deserialize<D>(deserializer: D) -> Result<DocumentHighlightKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(DocumentHighlightKind::Text),
            2 => Ok(DocumentHighlightKind::Read),
            3 => Ok(DocumentHighlightKind::Write),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 3",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// A set of predefined code action kinds
pub enum CodeActionKind {
    #[serde(rename = "")]
    /// Empty kind.
    Empty,

    #[serde(rename = "quickfix")]
    /// Base kind for quickfix actions: 'quickfix'
    QuickFix,

    #[serde(rename = "refactor")]
    /// Base kind for refactoring actions: 'refactor'
    Refactor,

    #[serde(rename = "refactor.extract")]
    /// Base kind for refactoring extraction actions: 'refactor.extract'
    ///
    /// Example extract actions:
    ///
    /// - Extract method
    /// - Extract function
    /// - Extract variable
    /// - Extract interface from class
    /// - ...
    RefactorExtract,

    #[serde(rename = "refactor.inline")]
    /// Base kind for refactoring inline actions: 'refactor.inline'
    ///
    /// Example inline actions:
    ///
    /// - Inline function
    /// - Inline variable
    /// - Inline constant
    /// - ...
    RefactorInline,

    #[cfg(feature = "proposed")]
    #[serde(rename = "refactor.move")]
    /// Base kind for refactoring move actions: `refactor.move`
    ///
    /// Example move actions:
    ///
    /// - Move a function to a new file
    /// - Move a property between classes
    /// - Move method to base class
    /// - ...
    ///
    /// @since 3.18.0
    /// @proposed
    RefactorMove,

    #[serde(rename = "refactor.rewrite")]
    /// Base kind for refactoring rewrite actions: 'refactor.rewrite'
    ///
    /// Example rewrite actions:
    ///
    /// - Convert JavaScript function to class
    /// - Add or remove parameter
    /// - Encapsulate field
    /// - Make method static
    /// - Move method to base class
    /// - ...
    RefactorRewrite,

    #[serde(rename = "source")]
    /// Base kind for source actions: `source`
    ///
    /// Source code actions apply to the entire file.
    Source,

    #[serde(rename = "source.organizeImports")]
    /// Base kind for an organize imports source action: `source.organizeImports`
    SourceOrganizeImports,

    #[serde(rename = "source.fixAll")]
    /// Base kind for auto-fix source actions: `source.fixAll`.
    ///
    /// Fix all actions automatically fix errors that have a clear fix that do not require user input.
    /// They should not suppress errors or perform unsafe fixes such as generating new types or classes.
    ///
    /// @since 3.15.0
    SourceFixAll,

    #[serde(rename = "notebook")]
    /// Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using
    /// this should always begin with `notebook.`
    ///
    /// @since 3.18.0
    Notebook,

    #[serde(untagged)]
    Custom_(String),
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Code action tags are extra annotations that tweak the behavior of a code action.
///
/// @since 3.18.0 - proposed
pub enum CodeActionTag {
    /// Marks the code action as LLM-generated.
    LlmGenerated = 1,
}
impl Serialize for CodeActionTag {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            CodeActionTag::LlmGenerated => serializer.serialize_u32(1),
        }
    }
}
impl<'de> Deserialize<'de> for CodeActionTag {
    fn deserialize<D>(deserializer: D) -> Result<CodeActionTag, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(CodeActionTag::LlmGenerated),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum TraceValue {
    #[serde(rename = "off")]
    /// Turn tracing off.
    Off,

    #[serde(rename = "messages")]
    /// Trace messages only.
    Messages,

    #[serde(rename = "verbose")]
    /// Verbose message tracing.
    Verbose,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// Describes the content type that a client supports in various
/// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
///
/// Please note that `MarkupKinds` must not start with a `$`. This kinds
/// are reserved for internal usage.
pub enum MarkupKind {
    #[serde(rename = "plaintext")]
    /// Plain text is supported as a content format
    PlainText,

    #[serde(rename = "markdown")]
    /// Markdown is supported as a content format
    Markdown,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// Predefined Language kinds
/// @since 3.18.0
pub enum LanguageKind {
    #[serde(rename = "abap")]
    Abap,

    #[serde(rename = "bat")]
    WindowsBat,

    #[serde(rename = "bibtex")]
    BibTeX,

    #[serde(rename = "clojure")]
    Clojure,

    #[serde(rename = "coffeescript")]
    Coffeescript,

    #[serde(rename = "c")]
    C,

    #[serde(rename = "cpp")]
    Cpp,

    #[serde(rename = "csharp")]
    CSharp,

    #[serde(rename = "css")]
    Css,

    #[cfg(feature = "proposed")]
    #[serde(rename = "d")]
    /// @since 3.18.0
    /// @proposed
    D,

    #[cfg(feature = "proposed")]
    #[serde(rename = "pascal")]
    /// @since 3.18.0
    /// @proposed
    Delphi,

    #[serde(rename = "diff")]
    Diff,

    #[serde(rename = "dart")]
    Dart,

    #[serde(rename = "dockerfile")]
    Dockerfile,

    #[serde(rename = "elixir")]
    Elixir,

    #[serde(rename = "erlang")]
    Erlang,

    #[serde(rename = "fsharp")]
    FSharp,

    #[serde(rename = "git-commit")]
    GitCommit,

    #[serde(rename = "rebase")]
    GitRebase,

    #[serde(rename = "go")]
    Go,

    #[serde(rename = "groovy")]
    Groovy,

    #[serde(rename = "handlebars")]
    Handlebars,

    #[serde(rename = "haskell")]
    Haskell,

    #[serde(rename = "html")]
    Html,

    #[serde(rename = "ini")]
    Ini,

    #[serde(rename = "java")]
    Java,

    #[serde(rename = "javascript")]
    JavaScript,

    #[serde(rename = "javascriptreact")]
    JavaScriptReact,

    #[serde(rename = "json")]
    Json,

    #[serde(rename = "latex")]
    LaTeX,

    #[serde(rename = "less")]
    Less,

    #[serde(rename = "lua")]
    Lua,

    #[serde(rename = "makefile")]
    Makefile,

    #[serde(rename = "markdown")]
    Markdown,

    #[serde(rename = "objective-c")]
    ObjectiveC,

    #[serde(rename = "objective-cpp")]
    ObjectiveCpp,

    #[cfg(feature = "proposed")]
    #[serde(rename = "pascal")]
    /// @since 3.18.0
    /// @proposed
    Pascal,

    #[serde(rename = "perl")]
    Perl,

    #[serde(rename = "perl6")]
    Perl6,

    #[serde(rename = "php")]
    Php,

    #[serde(rename = "powershell")]
    Powershell,

    #[serde(rename = "jade")]
    Pug,

    #[serde(rename = "python")]
    Python,

    #[serde(rename = "r")]
    R,

    #[serde(rename = "razor")]
    Razor,

    #[serde(rename = "ruby")]
    Ruby,

    #[serde(rename = "rust")]
    Rust,

    #[serde(rename = "scss")]
    Scss,

    #[serde(rename = "sass")]
    Sass,

    #[serde(rename = "scala")]
    Scala,

    #[serde(rename = "shaderlab")]
    ShaderLab,

    #[serde(rename = "shellscript")]
    ShellScript,

    #[serde(rename = "sql")]
    Sql,

    #[serde(rename = "swift")]
    Swift,

    #[serde(rename = "typescript")]
    TypeScript,

    #[serde(rename = "typescriptreact")]
    TypeScriptReact,

    #[serde(rename = "tex")]
    TeX,

    #[serde(rename = "vb")]
    VisualBasic,

    #[serde(rename = "xml")]
    Xml,

    #[serde(rename = "xsl")]
    Xsl,

    #[serde(rename = "yaml")]
    Yaml,

    #[serde(untagged)]
    Custom_(String),
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
///
/// @since 3.18.0
/// @proposed
pub enum InlineCompletionTriggerKind {
    /// Completion was triggered explicitly by a user gesture.
    Invoked = 1,

    /// Completion was triggered automatically while editing.
    Automatic = 2,
}
impl Serialize for InlineCompletionTriggerKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            InlineCompletionTriggerKind::Invoked => serializer.serialize_u32(1),
            InlineCompletionTriggerKind::Automatic => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for InlineCompletionTriggerKind {
    fn deserialize<D>(deserializer: D) -> Result<InlineCompletionTriggerKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(InlineCompletionTriggerKind::Invoked),
            2 => Ok(InlineCompletionTriggerKind::Automatic),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// A set of predefined position encoding kinds.
///
/// @since 3.17.0
pub enum PositionEncodingKind {
    #[serde(rename = "utf-8")]
    /// Character offsets count UTF-8 code units (e.g. bytes).
    Utf8,

    #[serde(rename = "utf-16")]
    /// Character offsets count UTF-16 code units.
    ///
    /// This is the default and must always be supported
    /// by servers
    Utf16,

    #[serde(rename = "utf-32")]
    /// Character offsets count UTF-32 code units.
    ///
    /// Implementation note: these are the same as Unicode codepoints,
    /// so this `PositionEncodingKind` may also be used for an
    /// encoding-agnostic representation of character offsets.
    Utf32,

    #[serde(untagged)]
    Custom_(String),
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// The file event type
pub enum FileChangeType {
    /// The file got created.
    Created = 1,

    /// The file got changed.
    Changed = 2,

    /// The file got deleted.
    Deleted = 3,
}
impl Serialize for FileChangeType {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            FileChangeType::Created => serializer.serialize_u32(1),
            FileChangeType::Changed => serializer.serialize_u32(2),
            FileChangeType::Deleted => serializer.serialize_u32(3),
        }
    }
}
impl<'de> Deserialize<'de> for FileChangeType {
    fn deserialize<D>(deserializer: D) -> Result<FileChangeType, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(FileChangeType::Created),
            2 => Ok(FileChangeType::Changed),
            3 => Ok(FileChangeType::Deleted),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 3",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum WatchKind {
    /// Interested in create events.
    Create = 1,

    /// Interested in change events
    Change = 2,

    /// Interested in delete events
    Delete = 4,
}
impl Serialize for WatchKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            WatchKind::Create => serializer.serialize_u32(1),
            WatchKind::Change => serializer.serialize_u32(2),
            WatchKind::Delete => serializer.serialize_u32(4),
        }
    }
}
impl<'de> Deserialize<'de> for WatchKind {
    fn deserialize<D>(deserializer: D) -> Result<WatchKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(WatchKind::Create),
            2 => Ok(WatchKind::Change),
            4 => Ok(WatchKind::Delete),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 4",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Copy)]
/// The diagnostic's severity.
pub enum DiagnosticSeverity {
    /// Reports an error.
    Error = 1,

    /// Reports a warning.
    Warning = 2,

    /// Reports an information.
    Information = 3,

    /// Reports a hint.
    Hint = 4,
}
impl Serialize for DiagnosticSeverity {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            DiagnosticSeverity::Error => serializer.serialize_u32(1),
            DiagnosticSeverity::Warning => serializer.serialize_u32(2),
            DiagnosticSeverity::Information => serializer.serialize_u32(3),
            DiagnosticSeverity::Hint => serializer.serialize_u32(4),
        }
    }
}
impl<'de> Deserialize<'de> for DiagnosticSeverity {
    fn deserialize<D>(deserializer: D) -> Result<DiagnosticSeverity, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(DiagnosticSeverity::Error),
            2 => Ok(DiagnosticSeverity::Warning),
            3 => Ok(DiagnosticSeverity::Information),
            4 => Ok(DiagnosticSeverity::Hint),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 3, 4",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// The diagnostic tags.
///
/// @since 3.15.0
pub enum DiagnosticTag {
    /// Unused or unnecessary code.
    ///
    /// Clients are allowed to render diagnostics with this tag faded out instead of having
    /// an error squiggle.
    Unnecessary = 1,

    /// Deprecated or obsolete code.
    ///
    /// Clients are allowed to rendered diagnostics with this tag strike through.
    Deprecated = 2,
}
impl Serialize for DiagnosticTag {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            DiagnosticTag::Unnecessary => serializer.serialize_u32(1),
            DiagnosticTag::Deprecated => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for DiagnosticTag {
    fn deserialize<D>(deserializer: D) -> Result<DiagnosticTag, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(DiagnosticTag::Unnecessary),
            2 => Ok(DiagnosticTag::Deprecated),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// How a completion was triggered
pub enum CompletionTriggerKind {
    /// Completion was triggered by typing an identifier (24x7 code
    /// complete), manual invocation (e.g Ctrl+Space) or via API.
    Invoked = 1,

    /// Completion was triggered by a trigger character specified by
    /// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
    TriggerCharacter = 2,

    /// Completion was re-triggered as current completion list is incomplete
    TriggerForIncompleteCompletions = 3,
}
impl Serialize for CompletionTriggerKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            CompletionTriggerKind::Invoked => serializer.serialize_u32(1),
            CompletionTriggerKind::TriggerCharacter => serializer.serialize_u32(2),
            CompletionTriggerKind::TriggerForIncompleteCompletions => serializer.serialize_u32(3),
        }
    }
}
impl<'de> Deserialize<'de> for CompletionTriggerKind {
    fn deserialize<D>(deserializer: D) -> Result<CompletionTriggerKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(CompletionTriggerKind::Invoked),
            2 => Ok(CompletionTriggerKind::TriggerCharacter),
            3 => Ok(CompletionTriggerKind::TriggerForIncompleteCompletions),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 3",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// Defines how values from a set of defaults and an individual item will be
/// merged.
///
/// @since 3.18.0
pub enum ApplyKind {
    /// The value from the individual item (if provided and not `null`) will be
    /// used instead of the default.
    Replace = 1,

    /// The value from the item will be merged with the default.
    ///
    /// The specific rules for mergeing values are defined against each field
    /// that supports merging.
    Merge = 2,
}
impl Serialize for ApplyKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            ApplyKind::Replace => serializer.serialize_u32(1),
            ApplyKind::Merge => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for ApplyKind {
    fn deserialize<D>(deserializer: D) -> Result<ApplyKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(ApplyKind::Replace),
            2 => Ok(ApplyKind::Merge),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// How a signature help was triggered.
///
/// @since 3.15.0
pub enum SignatureHelpTriggerKind {
    /// Signature help was invoked manually by the user or by a command.
    Invoked = 1,

    /// Signature help was triggered by a trigger character.
    TriggerCharacter = 2,

    /// Signature help was triggered by the cursor moving or by the document content changing.
    ContentChange = 3,
}
impl Serialize for SignatureHelpTriggerKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            SignatureHelpTriggerKind::Invoked => serializer.serialize_u32(1),
            SignatureHelpTriggerKind::TriggerCharacter => serializer.serialize_u32(2),
            SignatureHelpTriggerKind::ContentChange => serializer.serialize_u32(3),
        }
    }
}
impl<'de> Deserialize<'de> for SignatureHelpTriggerKind {
    fn deserialize<D>(deserializer: D) -> Result<SignatureHelpTriggerKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(SignatureHelpTriggerKind::Invoked),
            2 => Ok(SignatureHelpTriggerKind::TriggerCharacter),
            3 => Ok(SignatureHelpTriggerKind::ContentChange),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2, 3",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// The reason why code actions were requested.
///
/// @since 3.17.0
pub enum CodeActionTriggerKind {
    /// Code actions were explicitly requested by the user or by an extension.
    Invoked = 1,

    /// Code actions were requested automatically.
    ///
    /// This typically happens when current selection in a file changes, but can
    /// also be triggered when file content changes.
    Automatic = 2,
}
impl Serialize for CodeActionTriggerKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            CodeActionTriggerKind::Invoked => serializer.serialize_u32(1),
            CodeActionTriggerKind::Automatic => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for CodeActionTriggerKind {
    fn deserialize<D>(deserializer: D) -> Result<CodeActionTriggerKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(CodeActionTriggerKind::Invoked),
            2 => Ok(CodeActionTriggerKind::Automatic),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// A pattern kind describing if a glob pattern matches a file a folder or
/// both.
///
/// @since 3.16.0
pub enum FileOperationPatternKind {
    #[serde(rename = "file")]
    /// The pattern matches a file only.
    File,

    #[serde(rename = "folder")]
    /// The pattern matches a folder only.
    Folder,
}

#[derive(Clone, Debug, PartialEq, Eq)]
/// A notebook cell kind.
///
/// @since 3.17.0
pub enum NotebookCellKind {
    /// A markup-cell is formatted source that is used for display.
    Markup = 1,

    /// A code-cell is source code.
    Code = 2,
}
impl Serialize for NotebookCellKind {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            NotebookCellKind::Markup => serializer.serialize_u32(1),
            NotebookCellKind::Code => serializer.serialize_u32(2),
        }
    }
}
impl<'de> Deserialize<'de> for NotebookCellKind {
    fn deserialize<D>(deserializer: D) -> Result<NotebookCellKind, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(NotebookCellKind::Markup),
            2 => Ok(NotebookCellKind::Code),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1, 2",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum ResourceOperationKind {
    #[serde(rename = "create")]
    /// Supports creating new files and folders.
    Create,

    #[serde(rename = "rename")]
    /// Supports renaming existing files and folders.
    Rename,

    #[serde(rename = "delete")]
    /// Supports deleting existing files and folders.
    Delete,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum FailureHandlingKind {
    #[serde(rename = "abort")]
    /// Applying the workspace change is simply aborted if one of the changes provided
    /// fails. All operations executed before the failing operation stay executed.
    Abort,

    #[serde(rename = "transactional")]
    /// All operations are executed transactional. That means they either all
    /// succeed or no changes at all are applied to the workspace.
    Transactional,

    #[serde(rename = "textOnlyTransactional")]
    /// If the workspace edit contains only textual file changes they are executed transactional.
    /// If resource changes (create, rename or delete file) are part of the change the failure
    /// handling strategy is abort.
    TextOnlyTransactional,

    #[serde(rename = "undo")]
    /// The client tries to undo the operations already executed. But there is no
    /// guarantee that this is succeeding.
    Undo,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum PrepareSupportDefaultBehavior {
    /// The client's default behavior is to select the identifier
    /// according the to language's syntax rule.
    Identifier = 1,
}
impl Serialize for PrepareSupportDefaultBehavior {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            PrepareSupportDefaultBehavior::Identifier => serializer.serialize_u32(1),
        }
    }
}
impl<'de> Deserialize<'de> for PrepareSupportDefaultBehavior {
    fn deserialize<D>(deserializer: D) -> Result<PrepareSupportDefaultBehavior, D::Error>
    where
        D: Deserializer<'de>,
    {
        let value = u32::deserialize(deserializer)?;
        match value {
            1 => Ok(PrepareSupportDefaultBehavior::Identifier),
            value => Err(serde::de::Error::invalid_value(
                serde::de::Unexpected::Signed(value as i64),
                &"one of 1",
            )),
        }
    }
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum TokenFormat {
    #[serde(rename = "relative")]
    Relative,
}