dominikh / go-mode.el

Emacs mode for the Go programming language
BSD 3-Clause "New" or "Revised" License
1.38k stars 211 forks source link

Support basic indenting in multiline comments. #370

Closed muirdm closed 3 years ago

muirdm commented 4 years ago

This commit changes a few things to get indenting working in multiline comments:

  1. Make go-indentation-at-point return something when inside multiline comments. It basically guesses an indent based on the previous line or start of comment, along with a special case to line up all the "*" if you are making comment art. I didn't think it was worth it to support all of gofmt's multiline comment behavior.

  2. Don't ignore comments in go-mode-indent-line.

  3. Tweak go-mode-indent-line to not uses tabs when indenting beyond the "/*" in multiline comments. If you use tabs, gofmt ends up changing things around in unexpected ways.

  4. Tweak our electric indent function to trigger completion after newline within comments, and after typing the closing "*/".

Fixes #369.