Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions lib/IDE/SourceEntityWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,11 +868,8 @@ bool SemaAnnotator::passCallAsFunctionReference(ValueDecl *D, SourceLoc Loc,

bool SemaAnnotator::
passReference(ValueDecl *D, Type Ty, DeclNameLoc Loc, ReferenceMetaData Data) {
SourceManager &SM = D->getASTContext().SourceMgr;
SourceLoc BaseStart = Loc.getBaseNameLoc(), BaseEnd = BaseStart;
if (BaseStart.isValid() && SM.extractText({BaseStart, 1}) == "`")
BaseEnd = Lexer::getLocForEndOfToken(SM, BaseStart.getAdvancedLoc(1));
return passReference(D, Ty, BaseStart, {BaseStart, BaseEnd}, Data);
SourceLoc BaseLoc = Loc.getBaseNameLoc();
return passReference(D, Ty, BaseLoc, BaseLoc, Data);
}

bool SemaAnnotator::
Expand Down
33 changes: 33 additions & 0 deletions test/SourceKit/SemanticTokens/raw_identifiers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %sourcekitd-test -req=semantic-tokens %t/main.swift -- %t/main.swift > %t/result.json
// RUN: diff -u %t/tokens.json %t/result.json

//--- main.swift
func `foo`(x: Int) {}
`foo`(x: 0)

func `foo bar baz`() {}
`foo bar baz`()

//--- tokens.json
{
key.semantic_tokens: [
{
key.kind: source.lang.swift.ref.struct,
key.offset: 14,
key.length: 3,
key.is_system: 1
},
{
key.kind: source.lang.swift.ref.function.free,
key.offset: 22,
key.length: 5
},
{
key.kind: source.lang.swift.ref.function.free,
key.offset: 59,
key.length: 13
}
]
}