• 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 
16 #ifndef ES2PANDA_LSP_INCLUDE_QUICK_INFO_H
17 #define ES2PANDA_LSP_INCLUDE_QUICK_INFO_H
18 
19 #include "ir/astNode.h"
20 #include "public/es2panda_lib.h"
21 #include "api.h"
22 #include "types.h"
23 
24 namespace ark::es2panda::lsp {
25 
26 bool IsIncludedToken(const ir::AstNode *node);
27 ir::AstNode *GetTokenForQuickInfo(es2panda_Context *context, size_t position);
28 bool IsObjectLiteralElement(ir::AstNode *node);
29 ir::AstNode *GetContainingObjectLiteralNode(ir::AstNode *node);
30 ir::AstNode *GetContextualTypeNode(ir::AstNode *node);
31 ir::AstNode *GetPropertyNodeFromContextualType(ir::AstNode *node, ir::AstNode *contextualTypeNode);
32 ir::AstNode *GetNodeAtLocationForQuickInfo(ir::AstNode *node);
33 std::vector<SymbolDisplayPart> CreateDisplayForClass(ir::AstNode *node);
34 std::vector<SymbolDisplayPart> CreateDisplayForInterface(ir::AstNode *node);
35 std::vector<SymbolDisplayPart> CreateDisplayForTypeAlias(ir::AstNode *node);
36 std::vector<SymbolDisplayPart> CreateDisplayForEnum(ir::AstNode *node);
37 std::vector<SymbolDisplayPart> CreateDisplayForEnumMember(ir::AstNode *node);
38 std::vector<SymbolDisplayPart> CreateDisplayForTypeParameter(ir::AstNode *node);
39 std::vector<SymbolDisplayPart> CreateDisplayForMethodDefinition(ir::AstNode *node, const std::string &kindModifier);
40 std::vector<SymbolDisplayPart> CreateDisplayForClassProperty(ir::AstNode *node, const std::string &kindModifier);
41 std::vector<SymbolDisplayPart> CreateDisplayForETSParameterExpression(ir::AstNode *node);
42 QuickInfo GetQuickInfoAtPositionImpl(es2panda_Context *context, size_t position, std::string fileName);
43 std::string GetNameForTypeReference(const ir::TypeNode *typeReference);
44 std::string GetNameForTypeNode(const ir::TypeNode *typeAnnotation);
45 std::vector<SymbolDisplayPart> CreateDisplayForImportDeclaration(ir::AstNode *node);
46 ir::AstNode *GetEnumMemberByName(ir::AstNode *node, const util::StringView &name);
47 std::string ModifiersToString(ir::ModifierFlags flags);
48 std::string GetKindModifiers(ir::AstNode *node);
49 bool IsClass(ir::AstNode *node);
50 ir::AstNode *GetContainerNode(ir::AstNode *node);
51 
52 }  // namespace ark::es2panda::lsp
53 
54 #endif