-
Notifications
You must be signed in to change notification settings - Fork 34
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
Odd bug regarding types in member expressions. #350
Comments
This is odd indeed. I’m going to baselessly speculate that we’re parsing as |
Thanks for looking into it for us. It's not urgent. Just bringing it to your attention really. Thanks for all your hard work. Much appreciated. |
I asked a question regarding this on the swift forums and got a very helpful response, linking me to this function that does a lookahead to decide if it can parse it as a generic arguments list, it first parses the generic arguments list and does checks for the next token: extension Lexer.Lexeme {
var isGenericTypeDisambiguatingToken: Bool {
switch self.rawTokenKind {
case .rightParen,
.rightSquare,
.leftBrace,
.rightBrace,
.period,
.comma,
.semicolon,
.endOfFile,
.exclamationMark,
.postfixQuestionMark,
.colon:
return true
case .binaryOperator:
return self.tokenText == "&"
case .postfixOperator:
return false
case .leftParen, .leftSquare:
// These only apply to the generic type if they don't start a new line.
return !self.isAtStartOfLine
default:
return false
}
}
} |
There are some cases where the types (
MemoryLayout
andFloat
) are not highlighted as types in the following expression:In other (most) cases, the types are highlighted correctly. The simplest (and oddest) example I could find was the following:
In the first line, the types are not highlighted, while on the second line they are.
Note: I'm working with Helix (trying to update their Swift support), and came across this issue there. I'm assuming it's upstream, as their
highlights.scm
file is not very different from yours (despite being well over a year out of sync).The text was updated successfully, but these errors were encountered: