diff options
| author | Yong He <yonghe@outlook.com> | 2025-07-29 07:35:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-29 14:35:58 +0000 |
| commit | 855b1a262f3a769d44765e78f94e566d875b9286 (patch) | |
| tree | ea41db3717f55aa5032b1f04d71729a452ec68b2 /source/slang/slang-language-server-ast-lookup.cpp | |
| parent | ea6f8551ad38f2bcc32b542fd52ce17f3829cbeb (diff) | |
[Language Server]: Show signature help on generic parameters. (#7913)
* Show signature help on generic parameters.
* Fix.
* Update tests.
* slang-test: make vvl error go through stderr.
* update slang-rhi
* Update slang-rhi
Diffstat (limited to 'source/slang/slang-language-server-ast-lookup.cpp')
| -rw-r--r-- | source/slang/slang-language-server-ast-lookup.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/source/slang/slang-language-server-ast-lookup.cpp b/source/slang/slang-language-server-ast-lookup.cpp index 1f01baadc..aa3040f08 100644 --- a/source/slang/slang-language-server-ast-lookup.cpp +++ b/source/slang/slang-language-server-ast-lookup.cpp @@ -166,6 +166,26 @@ public: return dispatchIfNotNull(expr->right); } + bool visitAppExprCommon(AppExprBase* expr) + { + if (context->findType == ASTLookupType::Invoke && expr->argumentDelimeterLocs.getCount()) + { + String fileName; + Loc start = context->getLoc(expr->argumentDelimeterLocs.getFirst(), &fileName); + Loc end = context->getLoc(expr->argumentDelimeterLocs.getLast(), nullptr); + if (fileName.getUnownedSlice().endsWithCaseInsensitive(context->sourceFileName) && + start < context->cursorLoc && context->cursorLoc <= end) + { + ASTLookupResult result; + result.path = context->nodePath; + result.path.add(expr); + context->results.add(result); + return true; + } + } + return false; + } + bool visitGenericAppExpr(GenericAppExpr* genericAppExpr) { PushNode pushNodeRAII(context, genericAppExpr); @@ -174,6 +194,8 @@ public: for (auto arg : genericAppExpr->arguments) if (dispatchIfNotNull(arg)) return true; + if (visitAppExprCommon(genericAppExpr)) + return true; return false; } @@ -189,21 +211,8 @@ public: for (auto arg : expr->arguments) if (dispatchIfNotNull(arg)) return true; - if (context->findType == ASTLookupType::Invoke && expr->argumentDelimeterLocs.getCount()) - { - String fileName; - Loc start = context->getLoc(expr->argumentDelimeterLocs.getFirst(), &fileName); - Loc end = context->getLoc(expr->argumentDelimeterLocs.getLast(), nullptr); - if (fileName.getUnownedSlice().endsWithCaseInsensitive(context->sourceFileName) && - start < context->cursorLoc && context->cursorLoc <= end) - { - ASTLookupResult result; - result.path = context->nodePath; - result.path.add(expr); - context->results.add(result); - return true; - } - } + if (visitAppExprCommon(expr)) + return true; return false; } |
