mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:44:41 +01:00
Get the VS Code extension working again. (#4037)
VSCode's JSON parser no longer accepts comments in at least textmate grammars, so remove the comments. It's unclear whether VSCode changed here or whether this hasn't worked since the comments were added. Clean up the textmate grammar: refactor, add some missing operators and keywords, classify keywords as introducer / modifier as appropriate, fix comment grammar to require space after `//`, and generalize recognition of iN, fN, uN to recognize all such type literals. Be more cautious in language server -- I was seeing frequent crashes for `IdentifierName` parse nodes whose token was not actually an identifier, presumably due to error recovery.
This commit is contained in:
@@ -83,8 +83,10 @@ static auto GetIdentifierName(const SharedValueStores& value_stores,
|
||||
-> std::optional<llvm::StringRef> {
|
||||
for (auto ch : p.children(node)) {
|
||||
if (p.node_kind(ch) == Parse::NodeKind::IdentifierName) {
|
||||
return value_stores.identifiers().Get(
|
||||
tokens.GetIdentifier(p.node_token(ch)));
|
||||
auto token = p.node_token(ch);
|
||||
if (tokens.GetKind(token) == Lex::TokenKind::Identifier) {
|
||||
return value_stores.identifiers().Get(tokens.GetIdentifier(token));
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user