-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SymbolGraph][CursorInfo] Add option to SourceKit's CursorInfo request to include the SymbolGraph JSON #34934
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
Conversation
@swift-ci Please Build Toolchain macOS Platform |
macOS Toolchain Install command |
@swift-ci Please Build Toolchain macOS Platform |
macOS Toolchain Install command |
03b4b5d
to
f955085
Compare
@swift-ci please test |
@swift-ci Please Build Toolchain macOS Platform |
Build failed |
Build failed |
5048823
to
1b21814
Compare
lib/SymbolGraphGen/SymbolGraph.cpp
Outdated
StringRef ModuleName = M.getNameStr(); | ||
SmallVector<Identifier, 4> Bystanders; | ||
|
||
// If the decl is from a cross-import overlay module, report the overlay's | ||
// declaring module as the owning module. | ||
if (auto *Declaring = M.getDeclaringModuleIfCrossImportOverlay()) { | ||
ModuleName = Declaring->getNameStr(); | ||
M.getRequiredBystandersIfCrossImportOverlay(Declaring, Bystanders); | ||
} | ||
|
||
OS.attribute("name", ModuleName); | ||
if (!Bystanders.empty()) { | ||
OS.attributeArray("bystanders", [&](){ | ||
for (auto &Id: Bystanders) | ||
OS.value(Id.str()); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part will go away once #34922 lands.
@swift-ci please test |
@swift-ci Please Build Toolchain macOS Platform |
Build failed |
macOS Toolchain Install command |
1b21814
to
146fa18
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test OS X Platform |
@swift-ci please test Linux Platform |
Build failed |
Build failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symbol graph stuff looks good! One little nit in the new entry point, otherwise i think this is nice.
146fa18
to
ba47a58
Compare
…t to include the SymbolGraph JSON Adds a new 'key.retrieve_symbol_graph' option to the request. When set to 1 it includes the JSON for a SymbolGraph containing a single node for the symbol at the requested position. This also extends the SymbolGraph library with a new entry point to get a graph for a single symbol, and to additionally support type substitution to match the existing CursorInfo behavior (e.g. so that when invoked on `first` in `Array<Int>().first`, the type is given as `Int?` rather than `Element?`). Resolves rdar://problem/70551509
…symbol_graph_objc.swift It requires objc interop.
…cl entrypoint. Change it to use EXIT_SUCCESS/FAILURE rather than a bool to match emitSymbolGraphForModule.
ba47a58
to
968504d
Compare
@swift-ci please test |
@akyrtzi I'm going to go ahead and merge this. If you have time to take a look still I'll address any comments you have in a follow-up PR. |
@swift-ci Please Build Toolchain macOS Platform |
Adds a new
key.retrieve_symbol_graph
option to the request. When set to 1 the JSON for a SymbolGraph containing a single node corresponding to the symbol at the cursor position will be included in the response underkey.symbol_graph
.This extends the SymbolGraph with a new entry point to get a graph for a single symbol, and to additionally support type substitution to match the existing CursorInfo behavior (e.g. so that when invoked on
first
inArray<Int>().first
, the type is reported asInt?
rather thanElement?
).Resolves rdar://problem/70551509