-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[IDE] [Signature Help] Add basic signature help request to SourceKit #83378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hamishknight
merged 23 commits into
swiftlang:main
from
a7medev:feat/signature-help-basic
Sep 4, 2025
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7a4a974
[IDE] Add basic signature help request support
a7medev 0e0c2ec
[Test] Add signature help to sourcekitd-test
a7medev 1ce8e59
[IDE] Show signatures without a declaration
a7medev cdad5ff
[Test] Add basic signature help label tests
a7medev f9280f2
NFC: Apply clang-format to signature help changes
a7medev a15f45a
[IDE] Resolve function type for curried function calls in ArgumentTyp…
a7medev c986188
[IDE] Return whether a func is implicitly curried instance method in …
a7medev e21f4aa
[IDE] Customize CodeCompletionStringBuilder for signature help
a7medev 76918ee
[IDE] Use CodeCompletionStringBuilder in signature help
a7medev cd96add
[Test] Split signature help tests for currying
a7medev 026e696
[IDE] NFC: Extract createSignatureLabel function & remove unused incl…
a7medev d00565b
[IDE] Output all parameters in signature help
a7medev 86b3118
[IDE] Use FunctionRefInfo::ApplyLevel for curried functions in Argume…
a7medev 07d4f23
[IDE] NFC: Forward declare Signature in ArgumentCompletion.h
a7medev 154ca9d
[IDE] Use raw documentation in signature help
a7medev 6945dc1
[IDE] Use editor documents infrastructure for signature help
a7medev 5f42c37
[IDE] Signature help: Keep strings in Allocator instead of SmallString
a7medev b2a61d3
[IDE] Use keys.signatures instead of keys.members for signature help
a7medev 5297c23
[Test] Add signature help doc comment test
a7medev bd2fdc0
[Test] Change signature help tests to use split-file
a7medev aabab5b
[IDE] Misc enhancements to signature help
a7medev 6315e9a
[IDE] NFC: Wrap if-else in curly braces
a7medev e248a22
[Test] Avoid diff -B in signature help tests for Windows support
a7medev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| //===--- SignatureHelp.h --- ------------------------------------*- C++ -*-===// | ||
| // | ||
| // This source file is part of the Swift.org open source project | ||
| // | ||
| // Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
| // Licensed under Apache License v2.0 with Runtime Library Exception | ||
| // | ||
| // See https://swift.org/LICENSE.txt for license information | ||
| // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef SWIFT_IDE_SIGNATURE_HELP_H | ||
| #define SWIFT_IDE_SIGNATURE_HELP_H | ||
|
|
||
| #include "swift/AST/Type.h" | ||
| #include "swift/Basic/LLVM.h" | ||
| #include "swift/IDE/TypeCheckCompletionCallback.h" | ||
|
|
||
| namespace swift { | ||
| class IDEInspectionCallbacksFactory; | ||
|
|
||
| namespace ide { | ||
|
|
||
| struct Signature { | ||
| /// True if this is a subscript rather than a function call. | ||
| bool IsSubscript; | ||
|
|
||
| /// True if the function is an implicitly curried instance method. | ||
| bool IsImplicitlyCurried; | ||
|
|
||
| /// True if the call is the second apply of a double-applied function. | ||
| bool IsSecondApply; | ||
|
|
||
| /// The FuncDecl or SubscriptDecl associated with the call. | ||
| ValueDecl *FuncD; | ||
|
|
||
| /// The type of the function being called. | ||
| AnyFunctionType *FuncTy; | ||
|
|
||
| /// The base type of the call/subscript (null for free functions). | ||
| Type BaseType; | ||
|
|
||
| /// The index of the parameter corresponding to the completion argument. | ||
| std::optional<unsigned> ParamIdx; | ||
| }; | ||
|
|
||
| struct SignatureHelpResult { | ||
| /// The decl context of the parsed expression. | ||
| DeclContext *DC; | ||
|
|
||
| /// Suggested signatures. | ||
| SmallVector<Signature, 2> Signatures; | ||
|
|
||
| SignatureHelpResult(DeclContext *DC) : DC(DC) {} | ||
| }; | ||
|
|
||
| /// An abstract base class for consumers of signatures results. | ||
| class SignatureHelpConsumer { | ||
| public: | ||
| virtual ~SignatureHelpConsumer() {} | ||
| virtual void handleResult(const SignatureHelpResult &result) = 0; | ||
| }; | ||
|
|
||
| /// Create a factory for code completion callbacks. | ||
| IDEInspectionCallbacksFactory * | ||
| makeSignatureHelpCallbacksFactory(SignatureHelpConsumer &Consumer); | ||
|
|
||
| } // namespace ide | ||
| } // namespace swift | ||
|
|
||
| #endif // SWIFT_IDE_SIGNATURE_HELP_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.