Commit Graph

227 Commits

Author SHA1 Message Date
Brendan Zabarauskas
ceea85a148 Remove ApproxEq and assert_approx_eq!
This trait seems to stray too far from the mandate of a standard library as implementations may vary between use cases.
2014-01-09 15:41:46 +11:00
Dmitry Vasiliev
d2e3133877 Add @Spell clusters to Vim syntax file
Add @Spell clusters to Vim syntax highlighting file to do spell checking
only inside comments and strings
2014-01-04 15:18:18 +01:00
Alexandros Tasos
32c480d63d Renamed ClonableIterator to CloneableIterator 2013-12-27 16:10:11 +02:00
Chris Morgan
b76997f3a9 Rename To{Str,Bytes}Consume traits to Into*.
That is:

- `ToStrConsume` → `IntoStr`;
- `ToBytesConsume` → `IntoBytes`.
2013-12-15 01:04:22 +11:00
Chris Morgan
f39c883598 Vim keyword highlighting improvements.
- Removed the `log` keyword;
- Removed keyword duplicates;
- Highlighted `const` as `Error` rather than `StorageClass`; and
- Highlighted all the reserved keywords as `Error` rather than as
  `Keyword`.

(As usual, these highlightings can be overridden if desired.)
2013-12-10 14:28:27 +11:00
Chris Morgan
3a4d7ff2b9 Fix up float highlighting in Vim.
This fixes a regression introduced in #10793.

Having a colorscheme which highlights Float the same as Number (I
believe most do), I hadn't noticed that having the special case of "5."
floats (which was one of the added features in #10793) last made it take
precedence, and so it was left to @thestinger to notice it.

The regression meant that in `5.0`, the `5.` was a `rustFloat` (linked
by default to `Float`) and the `0` was a `rustDecNumber` (linked by
default to `Number`), and for `5.0f32` the `5.` was a `rustFloat` and
the `0f32` was a second `rustFloat` (and thus appeared correctly, though
for the wrong reason).
2013-12-10 14:17:26 +11:00
Chris Morgan
c9eed5742e Improve various Vim syntax highlighting things.
- Implement comment nesting (the implementation is quite ugly at present
  and is not quite correct; note the big comment in that area).

- Highlight invalid escape sequences as errors.

- Fix up various inconsistencies and incorrectnesses in number
  highlighting.

- Update prelude items (``std::io::{Buffer, Writer, Reader, Seek}``).

- Highlight the ``proc`` keyword.

- Remove %-formatting sequence highlighting (a relic of old formatting).

- Don't highlight TODO in strings (it's unconventional).
2013-12-04 12:41:56 +11:00
Corey Richardson
b50b162884 Be more strict about doc comments
Previously, `//// foo` and `/*** foo ***/` were accepted as doc comments. This
changes that, so that only `/// foo` and `/** foo ***/` are accepted. This
confuses many newcomers and it seems weird.

Also update the manual for these changes, and modernify the EBNF for comments.

Closes #10638
2013-11-27 18:00:50 -05:00
Matt Carberry
66abb92a47 Grammar error and vim syntax highlighting mistake fixed. 2013-11-02 21:34:29 -07:00
Matt Carberry
519b86b8a8 Added octal literal support. 2013-11-02 21:26:29 -07:00
Chris Morgan
1ad8dbe42e Fix Vim indent for wrapped function arguments. 2013-10-30 00:27:15 +11:00
Chris Morgan
c20186bde5 Update prelude items in Vim syntax file. 2013-10-30 00:26:25 +11:00
Chris Morgan
f3796616de Highlight \0 in strings and chars in Vim. 2013-10-19 00:56:41 +11:00
Chris Morgan
0ae9e476af Update prelude items in Vim syntax. 2013-10-19 00:55:52 +11:00
Benjamin Herr
18099fe085 add vim syntax highlighting support for raw string literals 2013-10-08 01:44:05 +02:00
Brian Anderson
c1d64297f0 Add 'continue' keyword to emacs, vim, gedit, kate 2013-09-26 15:04:43 -07:00
Birunthan Mohanathas
2ab278f130 Reserve the alignof, offsetof, and sizeof keywords
Closes #9333.
2013-09-22 10:47:36 +03:00
Scott Lawrence
72633a2af2 Remove 'copy' from syntax files, as it's no longer a keyword 2013-09-22 00:29:45 -04:00
Chris Morgan
9f6180413d Silence fo+=j error for users of Vim < 7.3.541. 2013-09-04 13:33:40 +10:00
Chris Morgan
2bc408f3e3 Update highlighting for prelude changes. 2013-09-04 02:38:41 +10:00
Chris Morgan
c4b180aa9c Highlight everything in the prelude in Vim.
This is a rather more extensive change than the last, but *ever* so much
easier to maintain reasonably, as there's then something to track
directly.
2013-09-04 02:34:23 +10:00
Chris Morgan
afbf908ff4 Update a handful of keywords highlighted in Vim.
I added a few and removed a few and corrected a couple, all with
reference to the prelude. It ends up a slightly arbitrary decision
precisely what ends up in and what doesn't, unfortunately.
2013-09-04 02:34:23 +10:00
Chris Morgan
15f05dc581 Modernise some Vim syntax highlighting.
- Remove highlighting of ``L"..."`` (obsolete syntax)
- Remove backslash at end of line being a line continuation always
  (obsolete syntax; this only affects comments, actually)
- Add highlighting for backslash at end of line and leading whitespace
  on the following line inside a string (a genuine line continuation)
2013-09-04 02:34:22 +10:00
Ben Blum
e9f6f3f2cc Parse and reserve typeof keyword. #3228 2013-08-23 17:24:14 -04:00
Chris Morgan
ceb651671a Vim highlighting: remove foreach keyword 2013-08-03 15:56:18 +10:00
Chris Morgan
44cb1c3adb Highlight sigils and operators in Vim.
Sigil highlighting isn't perfect (especially how it handles ``&``) but
after having used it for a week I feel it to be considerably nicer than
nothing. As usual, if you don't like it, you can turn it off easily by
overriding the default highlighting.

Generics are not handled specially; this means that for something like
``S<T>``, the ``<`` and ``>`` are highlighted as operators. For myself,
I like this, and there is no way to make it properly context aware
without expanding the syntax matching enormously.

Also, special characters are highlighted properly in strings/chars, e.g.
``"\x00"`` or ``'\Ufedcba98'`` appropriately.
2013-08-03 14:36:27 +10:00
bors
929b75e220 auto merge of #7747 : chris-morgan/rust/vim-compiler-rustc, r=huonw
Note that this is not actually *used* by default; it is a matter of
configuration still, because you might want to:

- Compile all .rs files with `rustc %` (where each can be built itself)

- Compile all .rs files with `rustc some-file.rs` (where you are editing
  part of a crate)

- Compile with a different tool, such as `make`. (In this case you might
  put a `~/.vim/after/compiler/rustc.vim` to match such cases, set
  makeprg and extend errorformat as appropriate. That should probably go
  in a different compiler mode, e.g. make-rustc.)

To try using it, `:compiler rustc`. Then, `:make` on a file you would
run `rustc` on will work its magic, invoking rustc. To automate this,
you could have something like `autocmd FileType rust compiler rustc` in
your Vim config.
2013-07-18 05:07:39 -07:00
Chris Morgan
917d720f48 rustc compiler config for Vim.
Note that this is not actually *used* by default; it is a matter of
configuration still, because you might want to:

- Compile all .rs files with `rustc %` (where each can be built itself)

- Compile all .rs files with `rustc some-file.rs` (where you are editing
  part of a crate)

- Compile with a different tool, such as `make`. (In this case you might
  put a `~/.vim/after/compiler/rustc.vim` to match such cases, set
  makeprg and extend errorformat as appropriate. That should probably go
  in a different compiler mode, e.g. make-rustc.)

To try using it, `:compiler rustc`. Then, `:make` on a file you would
run `rustc` on will work its magic, invoking rustc. To automate this,
you could have something like `autocmd FileType rust compiler rustc` in
your Vim config.
2013-07-12 23:51:03 +10:00
Chris Morgan
4f67ed535b Fix problem with switching between Rust buffers.
This was also causing trouble if one didn't have delimitMate installed.
2013-07-12 16:18:48 +10:00
Chris Morgan
184fa42d33 Vim syntax: support lifetimes with delimitMate.
When it's a lifetime, a single quotation mark shouldn't have a matching
single quotation mark inserted after it, as delimitMate does by default.

Note that this is not without problems; a char literal coming after an
odd number of lifetime markers will have its quotation marks behave a
little strangely. That, however, is not my fault, but delimitMate's:
https://github.com/Raimondi/delimitMate/issues/135
2013-07-12 15:30:51 +10:00
Chris Morgan
6e75f2de9c Fix Vim indentation for inline closures. 2013-07-11 14:38:32 -04:00
Chris Morgan
1d08ceb043 Fix comment indenting properly for Vim files.
Indentation now works correctly on subsequent lines of a multi-line
comment, whether there are leaders (` * `) or not. (Formerly it was
incorrectly doing a two-space indent if there was no leader.)

By default, this no longer puts a ` * ` leader on `/*!` comments, as
that appears to be the current convention in the Rust source code, but
that can easily be re-enabled if desired:

    let g:rust_bang_comment_leader = 1
2013-07-11 14:38:24 -04:00
Chris Morgan
121ae82be0 Do indentation properly in Vim.
The cases that this improves are clearly documented inside the
committed file, so this commit message is comparatively brief.
2013-07-10 01:33:30 +10:00
Chris Morgan
cf65870962 Add a Vim filetype plugin with useful tweaks.
This improves things like doc comment handling when you press Enter and
making using `gf` or `<C-W>f` work on a `use x;` statement in the
current directory.
2013-07-10 01:30:32 +10:00
Chris Morgan
3fa4cef876 A few slight tweaks to the Vim syntax file.
- Add fold support (NOT turned on by default)
- Highlight `::` by default
- Support the common `NOTE` as an important note
- Highlight `assert!` and `fail!` differently
- Don't highlight `deriving(...)` except in `#[...]`
2013-07-10 01:27:35 +10:00
Seo Sanghyeon
20458899d5 vim: Highlight 0i as number 2013-07-05 13:03:15 +09:00
bors
2b3569a1b3 auto merge of #7374 : Jeaye/rust/func_highlight, r=cmr
This allows for highlighting of function calls
for free floating, member, and static functions.
2013-06-30 04:40:37 -07:00
bors
a28f9ba526 auto merge of #7361 : brson/rust/incoming, r=brson 2013-06-27 01:04:33 -07:00
Luqman Aden
ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Jeaye
41f11d6428 rust.vim: Links previously unused rustFuncCall
This allows for highlighting of function calls
for free floating, member, and static functions.
2013-06-24 23:35:16 -07:00
Tuncer Ayaz
0a74ffcf04 vim/syntax/rust.vim: fix date header
The last change was made in 2013 not 2012.
2013-06-24 18:35:43 +02:00
Ben Blum
fcf361745f Add rules for assert, fail, and deriving to vim syntax file. Also highlight the mod path in "use module;" properly. 2013-06-23 13:53:39 -04:00
Ben Blum
32cd9b3274 Highlight Sized in vim and kate 2013-05-30 21:41:41 -04:00
Rob Hoelz
2505416408 Remove colorcolumn setting 2013-05-28 16:06:15 +02:00
Daniel Micay
298a72602b vim: be is still a reserved keyword 2013-05-15 00:03:55 -04:00
Daniel Micay
d65a136cb0 vim: no more drop blocks 2013-05-15 00:01:58 -04:00
Daniel Micay
17a68d1e8d vim: swap operator is gone 2013-05-14 23:59:55 -04:00
James Miller
80b2926357 General fixes for vim
Makes colorcolumn setlocal instead of set.
Makes conceal opt-in.
Removes the seem-to-be obsolete old keywords/types
2013-05-08 11:16:27 +12:00
James Miller
0addefa68a Improved vim indent file for rust 2013-05-08 11:16:27 +12:00
Brendan Zabarauskas
01eb5e8ad3 Rename Div operator trait to Quot and Modulo operator trait to Rem 2013-04-22 01:58:53 +10:00
klutzy
7a1394d58f vim: syntax highlight for inner doc comment 2013-04-10 04:25:48 +09:00
klutzy
fc26911b49 vim: fix comment highlighting bug
Previous commit had a bug that a line which ends with "//" or "/*"
is not correctly highlighted.
2013-04-07 14:30:50 +09:00
klutzy
7c2a8c4ac2 vim: add rustCommentDoc 2013-04-07 04:32:05 +09:00
klutzy
38fe5aa070 vim: disable nested comment
Since comment nesting does not work from 0.4.
2013-04-07 04:25:54 +09:00
Daniel Micay
47011e3b71 vim: use Operator group for 'as' 2013-03-30 18:19:47 -04:00
Daniel Micay
6442b1c0e7 vim: separate the conditional keywords 2013-03-30 18:17:13 -04:00
Daniel Micay
b0f66c4732 vim: mark Todo as contained and rm unsafe from it
It's nice to make unsafe stand out, but this way isn't correct because it
highlights it in comments.
2013-03-30 18:17:13 -04:00
Daniel Micay
7142cdef1e vim: highlight ref + static as storage specifiers
lifetimes and globals are now the only two places static is used, and
'static isn't matched by this
2013-03-30 18:16:53 -04:00
Daniel Micay
0224eb3d32 vim: assert and pure keywords were removed 2013-03-30 17:54:24 -04:00
Luqman Aden
7352d919f6 Update rust.vim
Column limit 78 -> 100.
2013-03-18 17:19:40 -07:00
Ben Striegel
e29b7eedf9 vim improvements
1. Highlight new lifetime syntax
2. Visually distinguish `unsafe` keyword
3. Add a new file that highlights column 78, to warn when lines get too long
2013-02-19 23:07:09 -05:00
Daniel Micay
5c75f210ba vim: move keyword is gone 2013-02-16 03:17:26 -05:00
Daniel Micay
dffc3f82b2 vim: 'fail' is no longer a keyword 2013-02-01 19:32:03 -05:00
Daniel Micay
6052d67474 vim: pub is just a plain old token keyword 2013-02-01 14:21:32 -05:00
Daniel Micay
00201c969d vim: use StorageClass for mut and const 2013-02-01 14:21:32 -05:00
Daniel Micay
1c3cca8a57 vim: 'be' is a reserved keyword 2013-02-01 14:21:32 -05:00
Daniel Micay
5b47c551b9 vim: unsafe:: namespaces were renamed to raw:: 2013-02-01 14:21:32 -05:00
Daniel Micay
405b868ae7 vim: add Self type 2013-02-01 14:21:25 -05:00
Daniel Micay
0c1a345d01 vim: export is no longer a keyword 2013-02-01 13:20:03 -05:00
Daniel Micay
2cf2d6aa92 add Drop trait to vim syntax highlighting 2012-12-25 01:20:27 -05:00
Daniel Micay
a45e41faaa update after/syntax/rust.vim for removal of <- 2012-12-21 21:37:32 -05:00
Daniel Micay
c7f7be83f5 update syntax/rust.vim for keyword changes 2012-12-14 17:13:11 -05:00
Ben Blum
8baed1f25f vim - Update bblum's email address and highlight trait names 2012-09-23 23:24:25 -04:00
Patrick Walton
2ba632a683 vim: Turn "pub" into a big asterisk for those who dislike the look of it.
This is not the default and must be turned on.
2012-09-05 18:59:01 -07:00
Ben Blum
cf1d2a7fef vim - camel-case the non builtin types 2012-08-26 20:45:04 -04:00
Ben Blum
f7f909a8cf vim - fix indent rules, hilight format strings, some keywords 2012-08-23 21:09:57 -04:00
Patrick Walton
be4f9753e4 vim: "ref" and "static" are now keywords; highlight them as such 2012-08-16 15:44:07 -07:00
Ben Blum
ef32a99f26 vim: hilight 'self' as a constant instead of a keyword 2012-08-09 20:29:34 -04:00
Patrick Walton
1beb1f491f etc: Add pub and priv to vim 2012-08-08 17:32:49 -07:00
Ben Blum
a98407ee34 vim: don't hilight "any" 2012-08-03 18:46:48 -04:00
Patrick Walton
0646890f63 vim: Don't link conceals to operators if we're concealing mod paths, because that makes mod paths show up as operators. 2012-08-02 11:48:33 -07:00
Erick Tryzelaar
213291e0c1 vim: Add a concealer for <->
This may break indentation though. However, without it, vim
sees "<->" and interprets it as a "<", folloed by "->", which
it conceals as a right arrow, so I'm not sure which is worse.
2012-08-01 13:17:01 -07:00
Erick Tryzelaar
37d7c9d1c3 vim: Move conceal code into vim/after/syntax.
This makes concealment opt-in.
2012-08-01 13:17:01 -07:00
Patrick Walton
43c9cd5298 vim: Add new keywords 2012-07-31 17:34:37 -07:00
Patrick Walton
c88933d714 rustc: Implement unary move. Closes #917. 2012-07-31 17:33:20 -07:00
Patrick Walton
2cfe8fb357 rustc: Check self types in method lookup; allow required trait methods to have self types; write self types into metadata 2012-07-31 16:35:11 -07:00
Lindsey Kuper
a413d4e502 Remove "iface" from vim and emacs modes. 2012-07-31 11:52:16 -07:00
Patrick Walton
09e893ba2e vim: Switch to a dot that shows up in the middle on Linux for module separator 2012-07-30 19:37:20 -07:00
Patrick Walton
d665ae956a vim: Add some optional beautification of ::, ->, and => 2012-07-30 16:33:24 -07:00
Ben Blum
b50279ba94 vim: hilight old style #macros 2012-07-26 21:20:02 -04:00
Patrick Walton
1df5c52791 vim: Highlight "struct" 2012-07-24 21:09:42 -07:00
Ben Blum
829186cb79 vim: 'owned' keyword 2012-07-18 19:55:18 -04:00
Ben Blum
bb5e2ba60a vim: hilight macro!s 2012-07-17 21:54:31 -04:00
Ben Blum
06c42b77d3 vim rustFuncCall contains rustAssert 2012-07-17 20:03:14 -04:00
Ben Blum
ebb33f2c28 vim: swap 'cont' for 'again' 2012-07-14 01:30:51 -04:00
Ben Blum
2ffa9b6bd9 vim: add optional rustFuncCall (default disabled) 2012-07-11 12:07:06 -04:00
Ben Blum
f9cb04f6fa vim: hilight option, either, libc types+constants 2012-07-06 22:30:50 -04:00
Ben Blum
efb3227fb3 vim: add 'new' keyword 2012-07-03 18:39:58 -04:00
Ben Blum
67b9d82847 vim syntax: add drop & rustString contains rustTodo 2012-07-02 18:00:43 -04:00
Ben Blum
510af4dadb vim syntax: don't hilight foo::<T>() like a module 2012-07-02 16:03:44 -04:00
Ben Blum
dc93814bf9 minor updates to vim config files 2012-07-02 15:48:59 -04:00
Erick Tryzelaar
c74b3fd634 Treat "do" as a keyword in vim 2012-07-02 09:06:30 -07:00
Ben Striegel
ba6f71f1b8 Properly highlight nested comments in vim
Prior to this commit, every block comment /* */ required two closing tags for
every opening tag in order to terminate the highlighting. Setting and testing
for a variable was the culprit, though I'm not certain why, but they appear to
just be boilerplate lines from whatever pcwalton based this file upon. I've
looked at other officially-distributed vim highlighting files and none seem to
do the test that this commit removes, so I'm fairly certain it didn't provide
anything vital. And now comment highlighting works!
2012-06-30 14:17:17 -07:00
Ben Blum
d7823de5e2 update rust.vim to hilight foo::bar and more 2012-06-28 21:11:54 -04:00
Ben Blum
571d866c0d Update vim mode for asserts and #[attributes] 2012-06-28 18:11:54 -04:00
Graydon Hoare
d3c6119a7a More keyword paring and migration in runtime, docs, code modes. 2012-06-27 13:30:49 -07:00
Paul Stansifer
a16cb376ac Update reserved words for syntax highlighters (vim is still behind, though) 2012-05-23 16:23:11 -07:00
Tycho Sci
16848becaa vim: Fix syntax of number literals
To follow [3.5.2.2 Number literals] in the reference manual.
2012-05-05 11:43:07 +09:00
Tycho Sci
bbf73bdfc6 vim: Link rustTodo to Todo for highlighting 2012-05-05 10:20:27 +09:00
Tycho Sci
1e44e04a9d vim: Update syntax for number/float literals 2012-05-03 17:12:46 +09:00
Tycho Sci
94b0edc606 vim: Highlight Todo in comments 2012-05-03 17:02:41 +09:00
Tycho Sci
55de232426 vim: Highlight identifiers 2012-05-03 17:01:33 +09:00
Jacob Parker
f5c91d10dd Fixed vim highlighting for \' (and other) escapes in char literals 2012-03-25 16:26:48 -04:00
Erick Tryzelaar
da91b60343 Add loop to the vim keyword list. 2012-03-16 17:05:29 +01:00
Erick Tryzelaar
b9948baf78 vim: add "to" as a keyword. 2012-02-28 18:00:50 -08:00
Erick Tryzelaar
4a3d551b85 vim: fix indenting enums and macros
Now vim indenting goes from:

fn main() {
    enum t {
a: int,
   b: int
    }
#error("hello world");
}

to:

fn main() {
    enum t {
        a: int,
        b: int
    }
    #error("hello world");
}
2012-02-19 13:08:32 -08:00
Erick Tryzelaar
1a7aa20eab vim: block is no longer a keyword. 2012-02-05 19:42:56 -08:00
tim
1290e4181c Added a src/etc/vim/ftdetect directory and file.
Previously, in order to get vim's syntax highlighting,  you needed
to manually `:setf rust` on every file. Now vim will recognize *.rs
files as rust. This is a little nicer.
2012-01-21 15:02:17 -06:00
Matt Brubeck
155601eefe Update the keyword lists in rust.md and syntax.vim
Add new keywords "enum" and "of", and remove old keywords "auth", "chan",
"log_err", "tag", and "task".

Also add reserved words to the syntax file, to help Vim users avoid using them
as identifiers.
2012-01-20 16:08:51 -08:00
Grahame Bowland
2b5bd7cd6d Update vim syntax with new keywords 2012-01-14 23:11:33 +08:00
Erick Tryzelaar
f9df32adac vim comment highlighting can contain comments. 2011-12-19 07:27:17 -08:00
Matt Brubeck
0bf10d84e2 Update keyword list in vim/syntax/rust.vim
Removed: iter, each, put, macro, meta, syntax, port, spawn
Added: block, copy
2011-10-29 20:50:17 -07:00
Patrick Walton
3be6cf7ab2 vim: Add pure to the list of keywords 2011-09-29 18:18:37 -07:00
Patrick Walton
5fac684af8 vim: const is a keyword 2011-09-28 12:40:34 -07:00
Patrick Walton
e76efbc43a etc: Add "lambda" and "inline" to the vim mode 2011-08-05 14:01:45 -07:00
Patrick Walton
684df97ef0 etc: Update the Vim syntax mode with new keywords 2011-08-05 09:25:27 -07:00
Erick Tryzelaar
4d0cbd4310 Move vim syntax file, add indent file. 2011-05-17 20:35:46 -07:00