diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-10-25 10:42:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-25 10:42:56 -0700 |
| commit | 01ac5d8197658c21412acde16df7c39325f03e4d (patch) | |
| tree | 7034ebfe8cd8ab84275bc33288b8bb93c9325d71 /rust-mode.el | |
| parent | 1587839ba493b5ab98fb8415338172a9a22f224b (diff) | |
| parent | fba77143c009b7b11839c77259f3b1f7a9c88bb8 (diff) | |
| download | rust-mode-01ac5d8197658c21412acde16df7c39325f03e4d.tar.gz | |
Merge pull request #177 from mrBliss/handle-comments-method-chains
Handle comments when indenting method chains
Diffstat (limited to 'rust-mode.el')
| -rw-r--r-- | rust-mode.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rust-mode.el b/rust-mode.el index 2c97433..3f6e279 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -301,6 +301,17 @@ buffer." (when (looking-at (concat "\s*\." rust-re-ident)) (forward-line -1) (end-of-line) + ;; Keep going up (looking for a line that could contain a method chain) + ;; while we're in a comment or on a blank line. Stop when the paren + ;; level changes. + (let ((level (rust-paren-level))) + (while (and (or (rust-in-str-or-cmnt) + ;; Only whitespace (or nothing) from the beginning to + ;; the end of the line. + (looking-back "^\s*" (point-at-bol))) + (= (rust-paren-level) level)) + (forward-line -1) + (end-of-line))) (let ;; skip-dot-identifier is used to position the point at the |
