mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch:478668013f06
runtime(rust): fix rust indent (vim/vim#12542)
478668013f
Co-authored-by: Raphael <glephunter@gmail.com>
			
			
This commit is contained in:
		| @@ -132,6 +132,22 @@ function GetRustIndent(lnum) | |||||||
| 		return indent(prevlinenum) + 6 | 		return indent(prevlinenum) + 6 | ||||||
| 	endif | 	endif | ||||||
|  |  | ||||||
|  | 	"match newline after struct with generic bound like | ||||||
|  | 	"struct SomeThing<T> | ||||||
|  | 	"| <-- newline indent should same as prevline | ||||||
|  | 	if prevline[len(prevline) - 1] == ">" | ||||||
|  | 				\ && prevline =~# "\s*struct.*>$" | ||||||
|  | 		return indent(prevlinenum) | ||||||
|  | 	endif | ||||||
|  |  | ||||||
|  | 	"match newline after where like: | ||||||
|  | 	"struct SomeThing<T> | ||||||
|  | 	"where | ||||||
|  | 	"     T: Display, | ||||||
|  | 	if prevline =~# '^\s*where$' | ||||||
|  | 		return indent(prevlinenum) + 4 | ||||||
|  | 	endif | ||||||
|  |  | ||||||
| 	if prevline[len(prevline) - 1] == "," | 	if prevline[len(prevline) - 1] == "," | ||||||
| 				\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' | 				\ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' | ||||||
| 				\ && prevline !~ '^\s*fn\s' | 				\ && prevline !~ '^\s*fn\s' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Christian Clason
					Christian Clason