• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at*
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0*
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef FIND_RENAME_LOCATIONS_H
16 #define FIND_RENAME_LOCATIONS_H
17 
18 #include <cstddef>
19 #include <string>
20 #include <set>
21 
22 #include "es2panda.h"
23 #include "cancellation_token.h"
24 
25 namespace ark::es2panda::lsp {
26 
27 // NOLINTBEGIN(misc-non-private-member-variables-in-classes)
28 struct RenameLocation {
29     std::string filePath;
30     size_t start = 0;
31     size_t end = 0;
32     size_t line = 0;
33     std::string prefixText;
34     std::string suffixText;
35 
36     bool operator<(const RenameLocation &other) const
37     {
38         return std::tie(filePath, start, end, line, prefixText, suffixText) <
39                std::tie(other.filePath, other.start, other.end, other.line, other.prefixText, other.suffixText);
40     }
41 };
42 // NOLINTEND(misc-non-private-member-variables-in-classes)
43 
44 std::set<RenameLocation> FindRenameLocations(CancellationToken *tkn,
45                                              const std::vector<ark::es2panda::SourceFile> &files,
46                                              const ark::es2panda::SourceFile &file, size_t position);
47 
48 std::set<RenameLocation> FindRenameLocations(const std::vector<ark::es2panda::SourceFile> &files,
49                                              const ark::es2panda::SourceFile &file, size_t position);
50 
51 }  // namespace ark::es2panda::lsp
52 
53 #endif  // FIND_RENAME_LOCATIONS_H