| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/JsonRpc/RequestInMessage.h" |
| 4 |
#include "LibLsp/JsonRpc/lsResponseMessage.h" |
| 5 |
#include <string> |
| 6 |
#include "LibLsp/lsp/lsAny.h" |
| 7 |
#include "LibLsp/lsp/CodeActionParams.h" |
| 8 |
|
| 9 |
struct MoveKindInfo |
| 10 |
{ |
| 11 |
static std::string moveResource() |
| 12 |
{ |
| 13 |
return "moveResource"; |
| 14 |
} |
| 15 |
static std::string moveInstanceMethod() |
| 16 |
{ |
| 17 |
return "moveInstanceMethod"; |
| 18 |
} |
| 19 |
static std::string moveStaticMember() |
| 20 |
{ |
| 21 |
return "moveStaticMember"; |
| 22 |
} |
| 23 |
}; |
| 24 |
|
| 25 |
struct MoveParams |
| 26 |
{ |
| 27 |
/** |
| 28 |
* The supported move kind: moveResource, moveInstanceMethod, moveStaticMember, |
| 29 |
* moveTypeToNewFile. |
| 30 |
*/ |
| 31 |
std::string moveKind; |
| 32 |
/** |
| 33 |
* The selected resource uris when the move operation is triggered. |
| 34 |
*/ |
| 35 |
std::vector<std::string> sourceUris; |
| 36 |
/** |
| 37 |
* The code action params when the move operation is triggered. |
| 38 |
*/ |
| 39 |
optional<lsCodeActionParams> params; |
| 40 |
/** |
| 41 |
* The possible destination: a folder/package, class, instanceDeclaration. |
| 42 |
*/ |
| 43 |
lsp::Any destination; |
| 44 |
bool updateReferences; |
| 45 |
void swap(MoveParams& arg) noexcept |
| 46 |
{ |
| 47 |
moveKind.swap(arg.moveKind); |
| 48 |
sourceUris.swap(arg.sourceUris); |
| 49 |
params.swap(arg.params); |
| 50 |
destination.swap(arg.destination); |
| 51 |
std::swap(updateReferences, arg.updateReferences); |
| 52 |
} |
| 53 |
}; |
| 54 |
MAKE_REFLECT_STRUCT(MoveParams, moveKind, sourceUris, params, destination, updateReferences); |
| 55 |
|
| 56 |
struct MoveDestinationsResponse |
| 57 |
{ |
| 58 |
std::string errorMessage; |
| 59 |
std::vector<lsp::Any> destinations; |
| 60 |
MAKE_SWAP_METHOD(MoveDestinationsResponse, errorMessage, destinations); |
| 61 |
}; |
| 62 |
MAKE_REFLECT_STRUCT(MoveDestinationsResponse, errorMessage, destinations); |
| 63 |
|
| 64 |
DEFINE_REQUEST_RESPONSE_TYPE( |
| 65 |
java_getMoveDestinations, MoveParams, MoveDestinationsResponse, "java/getMoveDestinations" |
| 66 |
); |