summaryrefslogtreecommitdiff
path: root/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h
blob: 131612dc2e3bff17302a45df8c42c6f253b0dcc4 (plain)
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
#pragma once

#include "LibLsp/JsonRpc/RequestInMessage.h"
#include "LibLsp/JsonRpc/lsResponseMessage.h"



#include <string>
#include <vector>
#include "WorkspaceSymbolParams.h"
#include "LibLsp/lsp/method_type.h"
#include "LibLsp/lsp/textDocument/code_action.h"
#include "LibLsp/lsp/lsFormattingOptions.h"

namespace
RefactorProposalUtility
{
        extern  const char* APPLY_REFACTORING_COMMAND_ID;
        extern  const char* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND;
        extern  const char* EXTRACT_VARIABLE_COMMAND;
        extern  const char* EXTRACT_CONSTANT_COMMAND;
        extern  const char* EXTRACT_METHOD_COMMAND;
        extern  const char* EXTRACT_FIELD_COMMAND;
        extern  const char* CONVERT_VARIABLE_TO_FIELD_COMMAND;
        extern  const char* MOVE_FILE_COMMAND;
        extern  const char* MOVE_INSTANCE_METHOD_COMMAND;
        extern  const char* MOVE_STATIC_MEMBER_COMMAND;
        extern  const char* MOVE_TYPE_COMMAND;
};


struct RenamePosition {
        lsDocumentUri uri;
        int offset = 0;
        int length = 0;
        void swap(RenamePosition& arg) noexcept
        {
                uri.swap(arg.uri);
                std::swap(offset, arg.offset);
                std::swap(length, arg.length);
        }
};
MAKE_REFLECT_STRUCT(RenamePosition, uri, offset, length);

struct GetRefactorEditParams
{
        std::string command;
        std::vector<lsp::Any>  commandArguments;
        lsCodeActionParams context;
        boost::optional<lsFormattingOptions> options;
        MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options);
};
MAKE_REFLECT_STRUCT(GetRefactorEditParams, command, context, options);




struct RefactorWorkspaceEdit {
        /**
         * The workspace edit this code action performs.
         */
         lsWorkspaceEdit edit;
        /**
         * A command this code action executes. If a code action provides a edit and a
         * command, first the edit is executed and then the command.
         */

        boost::optional<std::string> errorMessage;

        boost::optional < lsCommandWithAny > command;

        MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage)
};
MAKE_REFLECT_STRUCT(RefactorWorkspaceEdit,edit,command,errorMessage)

DEFINE_REQUEST_RESPONSE_TYPE(java_getRefactorEdit, GetRefactorEditParams, RefactorWorkspaceEdit, "java/getRefactorEdit");