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 16 #ifndef GET_CLASS_PROPERTY_INFO_H 17 #define GET_CLASS_PROPERTY_INFO_H 18 19 #include <cstddef> 20 #include <string> 21 #include <tuple> 22 #include <vector> 23 24 #include "ast_verifier/helpers.h" 25 #include "cancellation_token.h" 26 #include "es2panda.h" 27 #include "class_hierarchy.h" 28 #include "api.h" 29 #include "internal_api.h" 30 #include "public/public.h" 31 #include "types.h" 32 33 namespace ark::es2panda::lsp { 34 // NOLINTBEGIN(misc-non-private-member-variables-in-classes) 35 struct InstallPackageAction { 36 std::string type; 37 std::optional<std::string> file; 38 std::optional<std::string> packageName; 39 InstallPackageActionInstallPackageAction40 InstallPackageAction() : type("install package") {} 41 }; 42 43 using CodeActionCommand = InstallPackageAction; 44 45 struct RefactorEditInfoes { 46 std::vector<FileTextChanges> edits; 47 std::optional<std::string> renameFilename; 48 std::optional<int> renameNumber; 49 std::optional<std::vector<CodeActionCommand>> commands; 50 }; 51 52 // NOLINTEND(misc-non-private-member-variables-in-classes) 53 /** 54 * @brief Get class property info at position, optionally including inherited. 55 * @param context Parser context (es2panda_Context*). 56 * @param pos Position to locate class declaration. 57 * @param shouldCollectInherited Collect inherited properties if true (default: false). 58 * @return Vector of FieldsInfo. Empty if context/position invalid or class not found. 59 */ 60 std::vector<FieldsInfo> GetClassPropertyInfo(es2panda_Context *context, size_t pos, 61 bool shouldCollectInherited = false); 62 } // namespace ark::es2panda::lsp 63 64 #endif