| Age | Commit message (Collapse) | Author |
|
|
|
While debugging tests it’s annoying when ‘compilation-mode’ matches
‘dbg!’ output incorrectly. Currently, rust-mode’s regexps assign it as
an error and incorrectly include ‘[’. The proposed change adds a
regexp to match such things and assign them info level.
|
|
|
|
If we encounter a panic when executing Rust code in
`compilation-mode`, we now correctly highlight the location where the
panic occurred.
For example:
```
thread 'main' panicked at src/main.rs:2:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Here, `src/main.rs:2:5` is highlighted. The developer is then able to
execute `compile-goto-error` to jump to the correct spot in the code.
Co-authored-by: Brent Westbrook <brentrwestbrook@gmail.com>
Co-authored-by: zlef <zachlefevre@gmail.com>
|
|
- Change rust-insert-dbg to ...-sexp
- Handle the cases where forwarding is impossible
- Add tests
|
|
* rust-dbg-wrap-or-unwrap: Cut unnecessary conditional branches for region-active-p
* rust-dbg-wrap-or-unwrap: Do not using save-excursion anymore
* rust-dbg-wrap-or-unwrap: Use cond, allow more other cases.
* rust-dbg-wrap-or-unwrap: Introduce rust-insert-dbg-alone
* rust-dbg-wrap-or-unwrap: Adjust cursor position after insertion
* rust-dbg-wrap-or-unwrap: Add tests for empty line
* rust-dbg-wrap-or-unwrap: Test final position in empty line case
* rust-dbg-wrap-or-unwrap: Test final cursor position in existing wrap tests
|
|
Emacs 29 will signal an error in this case in batch mode, and in any case the
first test in the duplicate series will never run.
|
|
Establish more-controlled environment for fill-paragraph tests.
|
|
|
|
Define a macro `rust-test-with-standard-fill-settings` to bind all the
variables that affect `fill-paragraph`, and use it around all calls to
`fill-paragraph`.
Some tests based on `rust-test-fill-paragraph` were failing for me
because I set `sentence-end-double-space` to nil, so double spaces
after periods in the test input were getting collapsed into single
spaces.
|
|
Fixes #465.
When `rust-syntax-propertize` uses `rust-macro-scopes` to find
ranges of text that are macro arguments, it ends up inadvertently
poisoning the `syntax-ppss` cache by applying it to text that doesn't
have the necessary `syntax-table` properties applied yet - the very
job that `rust-syntax-propertize` is trying to do.
However, `rust-macro-scopes` does much more work than necessary.
Rather than producing a list of ranges of macro arguments, we can just
use the list of enclosing opening parens provided by syntax-ppss,
checking each paren to see if it seems to be a macro or `macro_rules`
call.
We have to keep syntax-ppss's cache accurate for other reasons anyway,
so we might as well just use its data, rather than introducing another
cache of our own - especially a problematic one (see #465).
* rust-mode.el (rust-in-macro): Consult `syntax-ppss`'s list of enclosing
parens, rather than using `rust-macro-scope`. Remove optional arguments, which
were only used by tests.
(rust-macro-scopes, rust-macro-scope): Delete. Now we just use `syntax-ppss`'s
internal cache.
(rust-syntax-propertize): Don't bind `rust-macro-scopes`.
(rust-looking-back-macro-rules): New function.
(rust-looking-back-macro): Support a space between macro name and `!`, by
consulting `rust-expression-introducers`.
(rust-expression-introducers): New constant. Use in `rust-looking-back-macro`
and `rust-is-in-expression-context`.
(rust-is-in-expression-context): Use `rust-expression-introducers`.
(rust-looking-back-ident): Don't use `looking-back`. We've already moved to the
correct spot for `looking-at`, within a `save-excursion`.
* rust-mode-tests.el: Update tests.
|
|
This test requires Cargo and fails if it’s not installed.
|
|
|
|
|
|
|
|
|
|
Customizing this face may improve code readability for some users.
By default nothing is set for backward compatibility.
|
|
|
|
As mentioned in (info "(emacs)Defining Faces") the name of a face
> should not end in "-face" (that would be redundant).
For historic reasons a few built-in faces actually do end with
"-face" and it so happens that our faces are closely related to
just those `font-lock' faces and that probably inspired our use
of the suffix. Even so, we should stop now.
|
|
This allows to jump to code references such as lines 82 and 132 in the
following snippet error message.
error[E0061]: this function takes 1 parameter but 2 parameters were supplied
--> file6.rs:132:34
|
82 | fn duration_ms_since(time: &Option<SystemTime>) -> u128 {
| ------------------------------------------------------- defined here
...
132 | self.total_time_ms = duration_ms_since(&self.program_start, 2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
‘compilation-face’ is defined in the ‘compile’ library, so we should ‘require’
that library.
|
|
- Migrate to lexical binding.
- Declare functions that are conditionally-defined.
- Migrate off the deprecated ‘cl’ library.
- Don’t use ‘setq’ to introduce global variables and constants.
- Avoid “unused lexical variable” warnings.
- Remove some unused variables.
- Stop using interactive-only commands.
|
|
rust-in-macro could cause significant performance problems resulting
in a very choppy user experience. Reimplement rust-in macro in a
somewhat simpler manner and in way which allows both allows
restriction to parts of the buffer and caching of buffer analysis.
Optimize rust-syntax-propertize to use this caching mechanism.
Fixes #208
Fixes #288
|
|
|
|
|
|
|
|
|
|
see `Key Binding Conventions' in the Emacs manual.
|
|
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
|
Fixes the following problem: consider code
fn foo(a: u32, b : u32) {}
Here, `b` was not highlighted as a variable, because the regex didn't
take into account possible space before the colon.
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
|
|
|
|
|
|
because emacs 24 doesn't know about font-lock-ensure
|
|
|
|
|
|
This preserves as default (t), the current indentation behavior of `->
ReturnType` when found on its own line: indenting as per the arguments
of the above function. When disabled (nil) by the user, however, this
will now just indent such a line one level from base-line (e.g. no
special treatment).
Includes a basic test.
|
|
|
|
Fixes #271
|
|
|
|
Improved font-locking for print macros
|
|
|
|
|
|
These went away pre Rust-1.0 and are valid identifiers. Went ahead and
removed them from the tests as well, replacing them with real types of
the same number of characters.
|
|
|