Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Add "size" (used in array literals) to the list of highlighted keywords #1391

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion src/VSCodeExtension/syntaxes/qsharp.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
{
"name": "keyword.other.qsharp",
"match": "\\b(new|not|and|or|w\/)\\b"
"match": "\\b(new|not|and|or|w\/|size)\\b"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tricky thing about size is that it's not a true keyword like not. It acts like a keyword when it occurs in a specific part of an array literal, but it's still a valid identifier:

let size = 123;
let xs = [size, size = 2]; // first size is a variable, second size is a "keyword"

So I am not sure if we want all instances of size highlighted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, let me see if I can make something like "a comma, optional whitespace, size, optional whitespace, equality sign" work without also highlighting the comma and the equality...

},
{
"comment": "C# reserved words which can't be used in Q#, A-D",
Expand Down