| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/JsonRpc/RequestInMessage.h" |
| 4 |
#include "LibLsp/JsonRpc/lsResponseMessage.h" |
| 5 |
|
| 6 |
#include <string> |
| 7 |
#include <vector> |
| 8 |
#include "WorkspaceSymbolParams.h" |
| 9 |
#include "LibLsp/lsp/method_type.h" |
| 10 |
#include "LibLsp/lsp/textDocument/code_action.h" |
| 11 |
#include "LibLsp/lsp/lsFormattingOptions.h" |
| 12 |
|
| 13 |
namespace RefactorProposalUtility |
| 14 |
{ |
| 15 |
extern char const* APPLY_REFACTORING_COMMAND_ID; |
| 16 |
extern char const* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND; |
| 17 |
extern char const* EXTRACT_VARIABLE_COMMAND; |
| 18 |
extern char const* EXTRACT_CONSTANT_COMMAND; |
| 19 |
extern char const* EXTRACT_METHOD_COMMAND; |
| 20 |
extern char const* EXTRACT_FIELD_COMMAND; |
| 21 |
extern char const* CONVERT_VARIABLE_TO_FIELD_COMMAND; |
| 22 |
extern char const* MOVE_FILE_COMMAND; |
| 23 |
extern char const* MOVE_INSTANCE_METHOD_COMMAND; |
| 24 |
extern char const* MOVE_STATIC_MEMBER_COMMAND; |
| 25 |
extern char const* MOVE_TYPE_COMMAND; |
| 26 |
}; // namespace RefactorProposalUtility |
| 27 |
|
| 28 |
struct RenamePosition |
| 29 |
{ |
| 30 |
lsDocumentUri uri; |
| 31 |
int offset = 0; |
| 32 |
int length = 0; |
| 33 |
void swap(RenamePosition& arg) noexcept |
| 34 |
{ |
| 35 |
uri.swap(arg.uri); |
| 36 |
std::swap(offset, arg.offset); |
| 37 |
std::swap(length, arg.length); |
| 38 |
} |
| 39 |
}; |
| 40 |
MAKE_REFLECT_STRUCT(RenamePosition, uri, offset, length); |
| 41 |
|
| 42 |
struct GetRefactorEditParams |
| 43 |
{ |
| 44 |
std::string command; |
| 45 |
std::vector<lsp::Any> commandArguments; |
| 46 |
lsCodeActionParams context; |
| 47 |
optional<lsFormattingOptions> options; |
| 48 |
MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options); |
| 49 |
}; |
| 50 |
MAKE_REFLECT_STRUCT(GetRefactorEditParams, command, context, options); |
| 51 |
|
| 52 |
struct RefactorWorkspaceEdit |
| 53 |
{ |
| 54 |
/** |
| 55 |
* The workspace edit this code action performs. |
| 56 |
*/ |
| 57 |
lsWorkspaceEdit edit; |
| 58 |
/** |
| 59 |
* A command this code action executes. If a code action provides a edit and a |
| 60 |
* command, first the edit is executed and then the command. |
| 61 |
*/ |
| 62 |
|
| 63 |
optional<std::string> errorMessage; |
| 64 |
|
| 65 |
optional<lsCommandWithAny> command; |
| 66 |
|
| 67 |
MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage) |
| 68 |
}; |
| 69 |
MAKE_REFLECT_STRUCT(RefactorWorkspaceEdit, edit, command, errorMessage) |
| 70 |
|
| 71 |
DEFINE_REQUEST_RESPONSE_TYPE( |
| 72 |
java_getRefactorEdit, GetRefactorEditParams, RefactorWorkspaceEdit, "java/getRefactorEdit" |
| 73 |
); |