Commit Graph
19 Commits
Author SHA1 Message Date
maan2003 ff5fab8eb8 Editor support Documentation (#3132)
depends on #3129 

cc @josh11b for review
2023-08-23 05:07:48 +00:00
maan2003 7f4cf794cf neovim: add treesitter and lsp config (#3129)
see utils/nvim/README.md
2023-08-22 22:05:46 +00:00
Jon Ross-Perkins 605763d62d Add lint fixes to the buildifier setup. (#3109)
The main motivation for this is to get python loads in using the
`native-py` lint fix. However, enabling that made me wonder, maybe we
should fix in general?

`native-cc` is delayed, but not wholly cancelled (and `native-py`
picking up might indicate `native-cc` won't be too far behind). There's
also some automated fixes for `.append` and dict sorting -- this felt
okay to me, maybe not something to eagerly add but probably not worth
stopping buildifier from fixing (I've noticed the warnings in the past
and had been ignoring them).

Running everything does mean that load orders are sorted automatically
now, which I think is a positive. Most generally, I think these fixes
aren't _harmful_, and having them done automatically seems beneficial:
my biggest concern about `native-py` and `native-cc` was actually that
regressions wouldn't be caught, but this addresses that issue
automatically.
2023-08-22 21:01:42 +00:00
maan2003 7c891fdacd Language Server (#3112)
Add a language server for carbon as part of GSoC.

This currently does code outline using toolchain parser.

See development steps in utils/vscode/README.md for running and using
language server.
2023-08-21 18:39:31 +00:00
mx42 fe49b1b2a6 treesitter: add more highlight rules (#3036)
follow up to #2902
2023-07-28 19:15:53 +00:00
mx42 56a011f356 treesitter: implement strings completely (#3007)
follow up to #2902
2023-07-27 20:34:17 +00:00
mx42 1d2853ef08 Treesitter: fix where clause (#2998)
follow up to #2902
2023-07-21 00:00:33 +00:00
mx42 de614f37e9 Add basic VS Code extension using textmate syntax (#2969) 2023-07-19 03:30:41 +00:00
mx42andjosh11b 1cab6920f2 Treesitter parser (#2902)
A push towards better editor support.
See utils/treesitter/README.md

---------

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
2023-07-13 18:28:28 +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
josh11b 9c8fd6864e Implement rename me -> self (#2444)
Implements change proposed in #1382

Replaces #1624
2022-12-06 20:17:00 -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
pseyfert c9855c4e01 Update syntax files for vim (#2039)
Set comments and commentstring.

These variables are documented e.g. [here](https://vimhelp.org/options.txt.html#%27comments%27).

For comparison other language plugins also set these two variables [vim-go](https://github.com/fatih/vim-go/blob/master/ftplugin/go.vim#L22) or [vim-toml](https://github.com/cespare/vim-toml/blob/main/ftplugin/toml.vim#L18).

I used these variables through the [tcomment](https://github.com/tomtom/tcomment_vim) plugin. e.g. gcc toggles whether the current line is commented in or out. Also standard vim folding (mark a section and hit zf appears affected by these settings).
2022-08-15 15:06:01 -07:00
Chandler Carruth a4a3cf0136 Create a sync-repos action. (#1863)
This will allow us to automatically create and maintain specific repos
based on the main repository here, pulling key files like the license
and other infrastructure and pushing them systematically to a narrow
repo. Things like editor plugins that are best packaged and installed
from a separate repos can still be developed in a central place, even
potentially sharing common things like grammars where useful.

Currently this will maintain a Vim plugin repository out of the
`utils/vim` directory, but can be easily expanded for other systems.
2022-08-06 15:42:41 -07:00
x2wandJon Ross-Perkins 52f80c25ab Add syntax highlighting for vim and neovim (#1740)
PR to add a vim syntax file to support syntax highlighting for .carbon files. Since the Carbon language specification is still in progress, a single syntax file is easier to maintain and adapt to design changes in Carbon. After the language syntax has matured and stabilized, advanced tooling such as Treesitter and Language Servers can take over the syntax highlighting in neovim.

### Highlighting Support
- comments and preprocessors (RUN, CHECK, etc)
- string and numeric literals
- primitive type names, classes, aliases
- control flow constructs
- identifier names
- package and library declarations
- most keywords mentioned in `docs/design/README.md`

### With a Dark Colorscheme:
![carbon01](https://user-images.githubusercontent.com/78875280/181017032-e2c140c8-e98a-46d3-8f94-b8dc0f28ce49.png)

This image is longer than I thought, so I'm not posting what it looks like in a light colorscheme, but it should look fine as long as vim highlight-groups are properly defined.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-07-31 08:32:00 -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
ooxi fc0d7a84db Fix link rendering for correct display in GitHub (#1666)
Unfortunately, GitHub does not render `[file]` as a link to `file`. Instead, `[file](file)` is required.

This patch fixes the rendering of [utils/highlightjs](https://github.com/carbon-language/carbon-lang/tree/trunk/utils/highlightjs)
2022-07-24 14:56:54 -07:00
Mats Larsen 5d1ef8bb44 move highlightjs code into utils directory (#1472)
Following a short discussion on Discord about where to locate developer tools, I suggest we collect developer utils inside a `/utils` directory at the repository root.

The idea behind this directory is taken from LLVM's utils directories in the various LLVM subprojects which host tooling such as Vim and VSCode extensions, utility scripts, and other useful bits for developers developing or using LLVM.

This patch moves the highlightjs code into said utils directory.

Let me know if there's anything else that's missing 😄

cc @jonmeow
2022-07-20 15:15:23 -04:00