Commit Graph
10 Commits
Author SHA1 Message Date
Richard Smith b8373334c6 Fix highlighting of default in textmate grammar. (#4038)
This is a modifier if it appears before an introducer and a control flow
keyword if it appears before `=>`. Use introducer highlighting if it's
neither.
2024-06-07 00:22:22 +00:00
Richard Smith 202aae453f 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.
2024-06-06 23:27:33 +00:00
5c5a687534 Syntax highlighter in VScode for carbon programming language (#3953)
I have made the necessary changes to
https://github.com/carbon-language/carbon-lang/tree/trunk/utils/vscode
for the VScode syntax highlighter to work:

- [x] Changes have been tested and found to be working.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
2024-05-21 00:42:14 +00:00
Karthik Prakash af6436c20c Add filetype highlighting to block string literals (#3642)
This PR adds filetype highlighting support to block string literals in
the TextMate grammar.

After adding the regex in the `begin` of the block string literal,
`beginCaptures` is used to access the first capturing group of the regex
(which captures the filetype) and apply the `constant.character.escape`
rule.


![image](https://github.com/carbon-language/carbon-lang/assets/116057817/edabc820-ed0f-4f5f-a180-f3ac90045b0a)

Closes #3641
2024-01-24 18:56:25 +00:00
czapiga ef842736f0 Fix block string literals highlighting (#3635)
Replace block string literals quotes.

Highlighting after change:

![image](https://github.com/carbon-language/carbon-lang/assets/24532774/4c55c021-b8ce-4933-9742-81a8eee6ffe1)


Closes #3634
2024-01-24 09:44:18 +00:00
czapiga 507e47d732 Fix syntax highlighting in VSCode (#3630). (#3631)
Add missing escape backslash to `string_escapes` matching string.

Closes #3630

VSCode highlighting working after change:

![image](https://github.com/carbon-language/carbon-lang/assets/24532774/92be2aa3-5f12-4430-9b9e-169edfa1da4a)
2024-01-20 23:16:30 +00:00
Manmeet Singh 1646ba1182 update keywords in textmate syntax (#2953)
keywords were taken from docs/design/lexical_conventions/words.md
2023-06-28 15:24:04 -07:00
Richard Smith 4daaa4866f Rename Type -> type, per #2360. (#2507)
Also make minor updates to the skeletal design in
docs/design/name_lookup.md following #2113, as there are no longer any prelude names that are made available to unqualified name lookup by default.

Add `type` to the keyword list in
docs/design/lexical_conventions/words.md, following #2360.
2023-01-04 14:22:30 -08:00
Jon Ross-Perkins 25d824ef15 Pre commit update (#2098)
codespell now sees "falsy" as a mis-spelling of either "false" or "falsely"; adding it since I think this it's occasionally used this way in programming. e.g., https://developer.mozilla.org/en-US/docs/Glossary/Falsy

Adjusts to use the new check-copyright support for lines starting with a dash.
2022-08-25 08:56:46 -07:00
Mats Larsen 8ba4916ab4 Implement minimal textmate language definition (#1595)
TextMate is the go-to definition language for syntax highlighting for editors lack dedicated language support for a given programming language. This patch contains a very minimal, yet functional TextMate bundle definition for Carbon.

This allows Carbon users to import the TextMate bundle into their editors to get basic syntax highlighting for Carbon code until we have a more solid specification for the language (that's when the fun with dedicated plugins/extensions begins!).

**Support**
- String literals with escape codes (currently using C highlighting rules)
- Numeric literals in decimal, hexadecimal and binary (lacks _ separator support though)
- Single and multi-line comments
- Highlighting of all? (let me know if some are missing) keywords in the language

Here is an image of the highlighting in action in IntelliJ Dracula mode
![image](https://user-images.githubusercontent.com/42585241/180587912-23b5ae3e-2bdb-49a1-83e8-24e6e0b7cfb5.png)
2022-07-28 11:32:41 -07:00