Skip to content

Commit ab232fe

Browse files
committed
Enable #filePath code completion (and fix a bug)
The meaning of EnableConcisePoundFile is going to shift slightly, so it makes sense to always include #filePath in completions. Also, @rintaro confirmed that this should be using KeywordKind::pound_filePath, not KeywordKind::pound_file.
1 parent 8dd08e7 commit ab232fe

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4060,10 +4060,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
40604060
CodeCompletionLiteralKind::StringLiteral);
40614061
addFromProto("#file", CodeCompletionKeywordKind::pound_file,
40624062
CodeCompletionLiteralKind::StringLiteral);
4063-
if (Ctx.LangOpts.EnableConcisePoundFile) {
4064-
addFromProto("#filePath", CodeCompletionKeywordKind::pound_file,
4065-
CodeCompletionLiteralKind::StringLiteral);
4066-
}
4063+
addFromProto("#filePath", CodeCompletionKeywordKind::pound_filePath,
4064+
CodeCompletionLiteralKind::StringLiteral);
40674065
addFromProto("#line", CodeCompletionKeywordKind::pound_line,
40684066
CodeCompletionLiteralKind::IntegerLiteral);
40694067
addFromProto("#column", CodeCompletionKeywordKind::pound_column,

test/IDE/complete_pound_expr.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,29 @@ func test1() {
1515
let _ = useSelector(##^POUND_EXPR_3^#)
1616
}
1717

18-
// POUND_EXPR_INTCONTEXT: Begin completions, 5 items
18+
// POUND_EXPR_INTCONTEXT: Begin completions, 6 items
1919
// POUND_EXPR_INTCONTEXT-DAG: Keyword[#function]/None: function[#String#]; name=function
2020
// POUND_EXPR_INTCONTEXT-DAG: Keyword[#file]/None: file[#String#]; name=file
21+
// POUND_EXPR_INTCONTEXT-DAG: Keyword[#filePath]/None: filePath[#String#]; name=filePath
2122
// POUND_EXPR_INTCONTEXT-DAG: Keyword[#line]/None/TypeRelation[Identical]: line[#Int#]; name=line
2223
// POUND_EXPR_INTCONTEXT-DAG: Keyword[#column]/None/TypeRelation[Identical]: column[#Int#]; name=column
2324
// POUND_EXPR_INTCONTEXT-DAG: Keyword[#dsohandle]/None: dsohandle[#UnsafeRawPointer#]; name=dsohandle
2425
// POUND_EXPR_INTCONTEXT: End completions
2526

26-
// POUND_EXPR_STRINGCONTEXT: Begin completions, 6 items
27+
// POUND_EXPR_STRINGCONTEXT: Begin completions, 7 items
2728
// POUND_EXPR_STRINGCONTEXT-DAG: Keyword[#function]/None/TypeRelation[Identical]: function[#String#];
2829
// POUND_EXPR_STRINGCONTEXT-DAG: Keyword[#file]/None/TypeRelation[Identical]: file[#String#];
30+
// POUND_EXPR_STRINGCONTEXT-DAG: Keyword[#filePath]/None/TypeRelation[Identical]: filePath[#String#];
2931
// POUND_EXPR_STRINGCONTEXT-DAG: Keyword[#line]/None: line[#Int#];
3032
// POUND_EXPR_STRINGCONTEXT-DAG: Keyword[#column]/None: column[#Int#];
3133
// POUND_EXPR_STRINGCONTEXT-DAG: Keyword[#dsohandle]/None: dsohandle[#UnsafeRawPointer#];
3234
// POUND_EXPR_STRINGCONTEXT-DAG: Keyword/None/TypeRelation[Identical]: keyPath({#@objc property sequence#})[#String#];
3335
// POUND_EXPR_STRINGCONTEXT: End completions
3436

35-
// POUND_EXPR_SELECTORCONTEXT: Begin completions, 6 items
37+
// POUND_EXPR_SELECTORCONTEXT: Begin completions, 7 items
3638
// POUND_EXPR_SELECTORCONTEXT-DAG: Keyword[#function]/None/TypeRelation[Identical]: function[#Selector#];
3739
// POUND_EXPR_SELECTORCONTEXT-DAG: Keyword[#file]/None/TypeRelation[Identical]: file[#Selector#];
40+
// POUND_EXPR_SELECTORCONTEXT-DAG: Keyword[#filePath]/None/TypeRelation[Identical]: filePath[#Selector#];
3841
// POUND_EXPR_SELECTORCONTEXT-DAG: Keyword[#line]/None: line[#Int#];
3942
// POUND_EXPR_SELECTORCONTEXT-DAG: Keyword[#column]/None: column[#Int#];
4043
// POUND_EXPR_SELECTORCONTEXT-DAG: Keyword[#dsohandle]/None: dsohandle[#UnsafeRawPointer#];

0 commit comments

Comments
 (0)