mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] The initial implementation of range-info request.
Like cursor-info, range info (""source.request.cursorinfo"") answers some
questions clients have for a code snippet under selection, for instance, the type of a selected
expression. This commit implements this new quest kind and provides two
simple information about the selected code: (1) the kind of the
snippet, currently limited to single-statement and expression; and (2)
the type of the selected expression. Gradually, we will enrich the
response to provide more insight into the selected code snippet.
This commit is contained in:
@@ -153,6 +153,9 @@ static UIdent KindStructureElemCondExpr("source.lang.swift.structure.elem.condit
|
||||
static UIdent KindStructureElemPattern("source.lang.swift.structure.elem.pattern");
|
||||
static UIdent KindStructureElemTypeRef("source.lang.swift.structure.elem.typeref");
|
||||
|
||||
static UIdent KindRangeSingleStatement("source.lang.swift.range.singlestatement");
|
||||
static UIdent KindRangeExpression("source.lang.swift.range.expression");
|
||||
static UIdent KindRangeInvalid("source.lang.swift.range.invalid");
|
||||
|
||||
std::unique_ptr<LangSupport>
|
||||
SourceKit::createSwiftLangSupport(SourceKit::Context &SKCtx) {
|
||||
@@ -530,6 +533,14 @@ UIdent SwiftLangSupport::getUIDForSyntaxStructureElementKind(
|
||||
case SyntaxStructureElementKind::TypeRef: return KindStructureElemTypeRef;
|
||||
}
|
||||
}
|
||||
SourceKit::UIdent SwiftLangSupport::
|
||||
getUIDForRangeKind(swift::ide::RangeKind Kind) {
|
||||
switch (Kind) {
|
||||
case swift::ide::RangeKind::Expression: return KindRangeExpression;
|
||||
case swift::ide::RangeKind::SingleStatement: return KindRangeSingleStatement;
|
||||
case swift::ide::RangeKind::Invalid: return KindRangeInvalid;
|
||||
}
|
||||
}
|
||||
|
||||
UIdent SwiftLangSupport::getUIDForSymbol(SymbolKind kind, SymbolSubKindSet subKinds,
|
||||
bool isRef) {
|
||||
|
||||
Reference in New Issue
Block a user