@@ -1089,13 +1089,15 @@ defmodule ElixirLS.LanguageServer.Server do
10891089 end
10901090
10911091 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+ } ,
10931098 state = % __MODULE__ { server_instance_id: server_instance_id }
10941099 )
10951100 when not is_initialized ( server_instance_id ) do
1096- root_uri = params . root_uri
1097- client_capabilities = params . capabilities
1098-
10991101 show_version_warnings ( )
11001102
11011103 server_instance_id =
@@ -1133,13 +1135,19 @@ defmodule ElixirLS.LanguageServer.Server do
11331135 end
11341136
11351137 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+ } ,
11371149 state = % __MODULE__ { }
11381150 ) do
1139- uri = params . text_document . uri
1140- line = params . position . line
1141- character = params . position . character
1142-
11431151 source_file = get_source_file ( state , uri )
11441152
11451153 fun = fn ->
@@ -1152,13 +1160,19 @@ defmodule ElixirLS.LanguageServer.Server do
11521160 end
11531161
11541162 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+ } ,
11561174 state = % __MODULE__ { }
11571175 ) do
1158- uri = params . text_document . uri
1159- line = params . position . line
1160- character = params . position . character
1161-
11621176 source_file = get_source_file ( state , uri )
11631177
11641178 fun = fn ->
@@ -1171,13 +1185,19 @@ defmodule ElixirLS.LanguageServer.Server do
11711185 end
11721186
11731187 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+ } ,
11751199 state = % __MODULE__ { }
11761200 ) do
1177- uri = params . text_document . uri
1178- line = params . position . line
1179- character = params . position . character
1180-
11811201 source_file = get_source_file ( state , uri )
11821202
11831203 fun = fn ->
@@ -1190,14 +1210,22 @@ defmodule ElixirLS.LanguageServer.Server do
11901210 end
11911211
11921212 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+ } ,
11941227 state = % __MODULE__ { }
11951228 ) 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-
12011229 source_file = get_source_file ( state , uri )
12021230
12031231 fun = fn ->
@@ -1218,11 +1246,20 @@ defmodule ElixirLS.LanguageServer.Server do
12181246 { :async , fun , state }
12191247 end
12201248
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
12261263 source_file = get_source_file ( state , uri )
12271264
12281265 fun = fn ->
@@ -1235,10 +1272,15 @@ defmodule ElixirLS.LanguageServer.Server do
12351272 end
12361273
12371274 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+ } ,
12391282 state = % __MODULE__ { }
12401283 ) do
1241- uri = params . text_document . uri
12421284 source_file = get_source_file ( state , uri )
12431285
12441286 fun = fn ->
@@ -1261,13 +1303,14 @@ defmodule ElixirLS.LanguageServer.Server do
12611303 { :async , fun , state }
12621304 end
12631305
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
12711314 fun = fn ->
12721315 WorkspaceSymbols . symbols ( query )
12731316 end
@@ -1276,17 +1319,25 @@ defmodule ElixirLS.LanguageServer.Server do
12761319 end
12771320
12781321 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+ } ,
12801333 state = % __MODULE__ { }
12811334 ) do
1282- uri = params . text_document . uri
1283- line = params . position . line
1284- character = params . position . character
1285-
12861335 settings = state . settings || % { }
12871336
12881337 source_file = get_source_file ( state , uri )
12891338
1339+ # TODO: GenLSP
1340+
12901341 snippets_supported =
12911342 ! ! ( state . client_capabilities &&
12921343 state . client_capabilities . text_document &&
@@ -1362,23 +1413,34 @@ defmodule ElixirLS.LanguageServer.Server do
13621413 end
13631414
13641415 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+ } ,
13661423 state = % __MODULE__ { }
13671424 ) do
1368- uri = params . text_document . uri
13691425 source_file = get_source_file ( state , uri )
13701426 fun = fn -> Formatting . format ( source_file , uri , state . project_dir , state . mix_project? ) end
13711427 { :async , fun , state }
13721428 end
13731429
13741430 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+ } ,
13761442 state = % __MODULE__ { }
13771443 ) do
1378- uri = params . text_document . uri
1379- line = params . position . line
1380- character = params . position . character
1381-
13821444 source_file = get_source_file ( state , uri )
13831445
13841446 fun = fn ->
@@ -1392,14 +1454,21 @@ defmodule ElixirLS.LanguageServer.Server do
13921454 end
13931455
13941456 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+ } ,
13961470 state = % __MODULE__ { }
13971471 ) 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
14031472 source_file = get_source_file ( state , uri )
14041473
14051474 fun = fn ->
@@ -1415,10 +1484,15 @@ defmodule ElixirLS.LanguageServer.Server do
14151484 end
14161485
14171486 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+ } ,
14191494 state = % __MODULE__ { }
14201495 ) do
1421- uri = params . text_document . uri
14221496 source_file = get_source_file ( state , uri )
14231497
14241498 fun = fn ->
@@ -1434,11 +1508,15 @@ defmodule ElixirLS.LanguageServer.Server do
14341508 end
14351509
14361510 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 ,
14381517 state = % __MODULE__ { }
14391518 ) do
1440- command = params . command
1441- args = params . arguments || [ ]
1519+ args = arguments || [ ]
14421520
14431521 { :async ,
14441522 fn ->
@@ -1454,10 +1532,15 @@ defmodule ElixirLS.LanguageServer.Server do
14541532 end
14551533
14561534 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+ } ,
14581542 state = % __MODULE__ { }
14591543 ) do
1460- uri = params . text_document . uri
14611544 source_file = get_source_file ( state , uri )
14621545
14631546 fun = fn ->
@@ -1473,11 +1556,16 @@ defmodule ElixirLS.LanguageServer.Server do
14731556 end
14741557
14751558 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+ } ,
14771567 state = % __MODULE__ { }
14781568 ) do
1479- uri = params . text_document . uri
1480- positions = params . positions
14811569 source_file = get_source_file ( state , uri )
14821570
14831571 fun = fn ->
@@ -1504,11 +1592,18 @@ defmodule ElixirLS.LanguageServer.Server do
15041592 end
15051593
15061594 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+ } ,
15081605 state = % __MODULE__ { }
15091606 ) do
1510- uri = params . text_document . uri
1511- diagnostics = params . context . diagnostics
15121607 source_file = get_source_file ( state , uri )
15131608
15141609 { :async , fn -> CodeAction . code_actions ( source_file , uri , diagnostics ) end , state }
0 commit comments