@@ -1089,13 +1089,15 @@ defmodule ElixirLS.LanguageServer.Server do
1089
1089
end
1090
1090
1091
1091
defp handle_request (
1092
- % GenLSP.Requests.Initialize { params: params } ,
1092
+ % GenLSP.Requests.Initialize {
1093
+ params: % GenLSP.Structures.InitializeParams {
1094
+ root_uri: root_uri ,
1095
+ capabilities: client_capabilities = % GenLSP.Structures.ClientCapabilities { }
1096
+ }
1097
+ } ,
1093
1098
state = % __MODULE__ { server_instance_id: server_instance_id }
1094
1099
)
1095
1100
when not is_initialized ( server_instance_id ) do
1096
- root_uri = params . root_uri
1097
- client_capabilities = params . capabilities
1098
-
1099
1101
show_version_warnings ( )
1100
1102
1101
1103
server_instance_id =
@@ -1133,13 +1135,19 @@ defmodule ElixirLS.LanguageServer.Server do
1133
1135
end
1134
1136
1135
1137
defp handle_request (
1136
- % GenLSP.Requests.TextDocumentDefinition { params: params } ,
1138
+ % GenLSP.Requests.TextDocumentDefinition {
1139
+ params: % GenLSP.Structures.TextDocumentPositionParams {
1140
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1141
+ uri: uri
1142
+ } ,
1143
+ position: % GenLSP.Structures.Position {
1144
+ line: line ,
1145
+ character: character
1146
+ }
1147
+ }
1148
+ } ,
1137
1149
state = % __MODULE__ { }
1138
1150
) do
1139
- uri = params . text_document . uri
1140
- line = params . position . line
1141
- character = params . position . character
1142
-
1143
1151
source_file = get_source_file ( state , uri )
1144
1152
1145
1153
fun = fn ->
@@ -1152,13 +1160,19 @@ defmodule ElixirLS.LanguageServer.Server do
1152
1160
end
1153
1161
1154
1162
defp handle_request (
1155
- % GenLSP.Requests.TextDocumentDeclaration { params: params } ,
1163
+ % GenLSP.Requests.TextDocumentDeclaration {
1164
+ params: % GenLSP.Structures.TextDocumentPositionParams {
1165
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1166
+ uri: uri
1167
+ } ,
1168
+ position: % GenLSP.Structures.Position {
1169
+ line: line ,
1170
+ character: character
1171
+ }
1172
+ }
1173
+ } ,
1156
1174
state = % __MODULE__ { }
1157
1175
) do
1158
- uri = params . text_document . uri
1159
- line = params . position . line
1160
- character = params . position . character
1161
-
1162
1176
source_file = get_source_file ( state , uri )
1163
1177
1164
1178
fun = fn ->
@@ -1171,13 +1185,19 @@ defmodule ElixirLS.LanguageServer.Server do
1171
1185
end
1172
1186
1173
1187
defp handle_request (
1174
- % GenLSP.Requests.TextDocumentImplementation { params: params } ,
1188
+ % GenLSP.Requests.TextDocumentImplementation {
1189
+ params: % GenLSP.Structures.TextDocumentPositionParams {
1190
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1191
+ uri: uri
1192
+ } ,
1193
+ position: % GenLSP.Structures.Position {
1194
+ line: line ,
1195
+ character: character
1196
+ }
1197
+ }
1198
+ } ,
1175
1199
state = % __MODULE__ { }
1176
1200
) do
1177
- uri = params . text_document . uri
1178
- line = params . position . line
1179
- character = params . position . character
1180
-
1181
1201
source_file = get_source_file ( state , uri )
1182
1202
1183
1203
fun = fn ->
@@ -1190,14 +1210,22 @@ defmodule ElixirLS.LanguageServer.Server do
1190
1210
end
1191
1211
1192
1212
defp handle_request (
1193
- % GenLSP.Requests.TextDocumentReferences { params: params } ,
1213
+ % GenLSP.Requests.TextDocumentReferences {
1214
+ params: % GenLSP.Structures.ReferenceParams {
1215
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1216
+ uri: uri
1217
+ } ,
1218
+ position: % GenLSP.Structures.Position {
1219
+ line: line ,
1220
+ character: character
1221
+ } ,
1222
+ context: % GenLSP.Structures.ReferenceContext {
1223
+ include_declaration: include_declaration
1224
+ }
1225
+ }
1226
+ } ,
1194
1227
state = % __MODULE__ { }
1195
1228
) do
1196
- uri = params . text_document . uri
1197
- line = params . position . line
1198
- character = params . position . character
1199
- include_declaration = params . context . include_declaration
1200
-
1201
1229
source_file = get_source_file ( state , uri )
1202
1230
1203
1231
fun = fn ->
@@ -1218,11 +1246,20 @@ defmodule ElixirLS.LanguageServer.Server do
1218
1246
{ :async , fun , state }
1219
1247
end
1220
1248
1221
- defp handle_request ( % GenLSP.Requests.TextDocumentHover { params: params } , state = % __MODULE__ { } ) do
1222
- uri = params . text_document . uri
1223
- line = params . position . line
1224
- character = params . position . character
1225
-
1249
+ defp handle_request (
1250
+ % GenLSP.Requests.TextDocumentHover {
1251
+ params: % GenLSP.Structures.TextDocumentPositionParams {
1252
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1253
+ uri: uri
1254
+ } ,
1255
+ position: % GenLSP.Structures.Position {
1256
+ line: line ,
1257
+ character: character
1258
+ }
1259
+ }
1260
+ } ,
1261
+ state = % __MODULE__ { }
1262
+ ) do
1226
1263
source_file = get_source_file ( state , uri )
1227
1264
1228
1265
fun = fn ->
@@ -1235,10 +1272,15 @@ defmodule ElixirLS.LanguageServer.Server do
1235
1272
end
1236
1273
1237
1274
defp handle_request (
1238
- % GenLSP.Requests.TextDocumentDocumentSymbol { params: params } ,
1275
+ % GenLSP.Requests.TextDocumentDocumentSymbol {
1276
+ params: % GenLSP.Structures.DocumentSymbolParams {
1277
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1278
+ uri: uri
1279
+ }
1280
+ }
1281
+ } ,
1239
1282
state = % __MODULE__ { }
1240
1283
) do
1241
- uri = params . text_document . uri
1242
1284
source_file = get_source_file ( state , uri )
1243
1285
1244
1286
fun = fn ->
@@ -1261,13 +1303,14 @@ defmodule ElixirLS.LanguageServer.Server do
1261
1303
{ :async , fun , state }
1262
1304
end
1263
1305
1264
- defp handle_request ( % GenLSP.Requests.WorkspaceSymbol { params: params } , state = % __MODULE__ { } ) do
1265
- query =
1266
- case params do
1267
- % GenLSP.Structures.WorkspaceSymbolParams { query: query } -> query
1268
- _ -> ""
1269
- end
1270
-
1306
+ defp handle_request (
1307
+ % GenLSP.Requests.WorkspaceSymbol {
1308
+ params: % GenLSP.Structures.WorkspaceSymbolParams {
1309
+ query: query
1310
+ }
1311
+ } ,
1312
+ state = % __MODULE__ { }
1313
+ ) do
1271
1314
fun = fn ->
1272
1315
WorkspaceSymbols . symbols ( query )
1273
1316
end
@@ -1276,17 +1319,25 @@ defmodule ElixirLS.LanguageServer.Server do
1276
1319
end
1277
1320
1278
1321
defp handle_request (
1279
- % GenLSP.Requests.TextDocumentCompletion { params: params } ,
1322
+ % GenLSP.Requests.TextDocumentCompletion {
1323
+ params: % GenLSP.Structures.TextDocumentPositionParams {
1324
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1325
+ uri: uri
1326
+ } ,
1327
+ position: % GenLSP.Structures.Position {
1328
+ line: line ,
1329
+ character: character
1330
+ }
1331
+ }
1332
+ } ,
1280
1333
state = % __MODULE__ { }
1281
1334
) do
1282
- uri = params . text_document . uri
1283
- line = params . position . line
1284
- character = params . position . character
1285
-
1286
1335
settings = state . settings || % { }
1287
1336
1288
1337
source_file = get_source_file ( state , uri )
1289
1338
1339
+ # TODO: GenLSP
1340
+
1290
1341
snippets_supported =
1291
1342
! ! ( state . client_capabilities &&
1292
1343
state . client_capabilities . text_document &&
@@ -1362,23 +1413,34 @@ defmodule ElixirLS.LanguageServer.Server do
1362
1413
end
1363
1414
1364
1415
defp handle_request (
1365
- % GenLSP.Requests.TextDocumentFormatting { params: params } ,
1416
+ % GenLSP.Requests.TextDocumentFormatting {
1417
+ params: % GenLSP.Structures.DocumentFormattingParams {
1418
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1419
+ uri: uri
1420
+ }
1421
+ }
1422
+ } ,
1366
1423
state = % __MODULE__ { }
1367
1424
) do
1368
- uri = params . text_document . uri
1369
1425
source_file = get_source_file ( state , uri )
1370
1426
fun = fn -> Formatting . format ( source_file , uri , state . project_dir , state . mix_project? ) end
1371
1427
{ :async , fun , state }
1372
1428
end
1373
1429
1374
1430
defp handle_request (
1375
- % GenLSP.Requests.TextDocumentSignatureHelp { params: params } ,
1431
+ % GenLSP.Requests.TextDocumentSignatureHelp {
1432
+ params: % GenLSP.Structures.TextDocumentPositionParams {
1433
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1434
+ uri: uri
1435
+ } ,
1436
+ position: % GenLSP.Structures.Position {
1437
+ line: line ,
1438
+ character: character
1439
+ }
1440
+ }
1441
+ } ,
1376
1442
state = % __MODULE__ { }
1377
1443
) do
1378
- uri = params . text_document . uri
1379
- line = params . position . line
1380
- character = params . position . character
1381
-
1382
1444
source_file = get_source_file ( state , uri )
1383
1445
1384
1446
fun = fn ->
@@ -1392,14 +1454,21 @@ defmodule ElixirLS.LanguageServer.Server do
1392
1454
end
1393
1455
1394
1456
defp handle_request (
1395
- % GenLSP.Requests.TextDocumentOnTypeFormatting { params: params } ,
1457
+ % GenLSP.Requests.TextDocumentOnTypeFormatting {
1458
+ params: % GenLSP.Structures.DocumentOnTypeFormattingParams {
1459
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1460
+ uri: uri
1461
+ } ,
1462
+ position: % GenLSP.Structures.Position {
1463
+ line: line ,
1464
+ character: character
1465
+ } ,
1466
+ ch: ch ,
1467
+ options: options
1468
+ }
1469
+ } ,
1396
1470
state = % __MODULE__ { }
1397
1471
) do
1398
- uri = params . text_document . uri
1399
- line = params . position . line
1400
- character = params . position . character
1401
- ch = params . ch
1402
- options = params . options
1403
1472
source_file = get_source_file ( state , uri )
1404
1473
1405
1474
fun = fn ->
@@ -1415,10 +1484,15 @@ defmodule ElixirLS.LanguageServer.Server do
1415
1484
end
1416
1485
1417
1486
defp handle_request (
1418
- % GenLSP.Requests.TextDocumentCodeLens { params: params } ,
1487
+ % GenLSP.Requests.TextDocumentCodeLens {
1488
+ params: % GenLSP.Structures.CodeLensParams {
1489
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1490
+ uri: uri
1491
+ }
1492
+ }
1493
+ } ,
1419
1494
state = % __MODULE__ { }
1420
1495
) do
1421
- uri = params . text_document . uri
1422
1496
source_file = get_source_file ( state , uri )
1423
1497
1424
1498
fun = fn ->
@@ -1434,11 +1508,15 @@ defmodule ElixirLS.LanguageServer.Server do
1434
1508
end
1435
1509
1436
1510
defp handle_request (
1437
- % GenLSP.Requests.WorkspaceExecuteCommand { params: params } = req ,
1511
+ % GenLSP.Requests.WorkspaceExecuteCommand {
1512
+ params: % GenLSP.Structures.ExecuteCommandParams {
1513
+ command: command ,
1514
+ arguments: arguments
1515
+ }
1516
+ } = req ,
1438
1517
state = % __MODULE__ { }
1439
1518
) do
1440
- command = params . command
1441
- args = params . arguments || [ ]
1519
+ args = arguments || [ ]
1442
1520
1443
1521
{ :async ,
1444
1522
fn ->
@@ -1454,10 +1532,15 @@ defmodule ElixirLS.LanguageServer.Server do
1454
1532
end
1455
1533
1456
1534
defp handle_request (
1457
- % GenLSP.Requests.TextDocumentFoldingRange { params: params } ,
1535
+ % GenLSP.Requests.TextDocumentFoldingRange {
1536
+ params: % GenLSP.Structures.FoldingRangeParams {
1537
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1538
+ uri: uri
1539
+ }
1540
+ }
1541
+ } ,
1458
1542
state = % __MODULE__ { }
1459
1543
) do
1460
- uri = params . text_document . uri
1461
1544
source_file = get_source_file ( state , uri )
1462
1545
1463
1546
fun = fn ->
@@ -1473,11 +1556,16 @@ defmodule ElixirLS.LanguageServer.Server do
1473
1556
end
1474
1557
1475
1558
defp handle_request (
1476
- % GenLSP.Requests.TextDocumentSelectionRange { params: params } ,
1559
+ % GenLSP.Requests.TextDocumentSelectionRange {
1560
+ params: % GenLSP.Structures.SelectionRangeParams {
1561
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1562
+ uri: uri
1563
+ } ,
1564
+ positions: positions
1565
+ }
1566
+ } ,
1477
1567
state = % __MODULE__ { }
1478
1568
) do
1479
- uri = params . text_document . uri
1480
- positions = params . positions
1481
1569
source_file = get_source_file ( state , uri )
1482
1570
1483
1571
fun = fn ->
@@ -1504,11 +1592,18 @@ defmodule ElixirLS.LanguageServer.Server do
1504
1592
end
1505
1593
1506
1594
defp handle_request (
1507
- % GenLSP.Requests.TextDocumentCodeAction { params: params } ,
1595
+ % GenLSP.Requests.TextDocumentCodeAction {
1596
+ params: % GenLSP.Structures.CodeActionParams {
1597
+ text_document: % GenLSP.Structures.TextDocumentIdentifier {
1598
+ uri: uri
1599
+ } ,
1600
+ context: % GenLSP.Structures.CodeActionContext {
1601
+ diagnostics: diagnostics
1602
+ }
1603
+ }
1604
+ } ,
1508
1605
state = % __MODULE__ { }
1509
1606
) do
1510
- uri = params . text_document . uri
1511
- diagnostics = params . context . diagnostics
1512
1607
source_file = get_source_file ( state , uri )
1513
1608
1514
1609
{ :async , fn -> CodeAction . code_actions ( source_file , uri , diagnostics ) end , state }
0 commit comments