Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure asterisk alignment in multiline comments to match scaladoc recommendation #129

Merged
merged 1 commit into from
Aug 2, 2016

Conversation

mjp4
Copy link
Contributor

@mjp4 mjp4 commented May 27, 2016

Adds an option g:scala_scaladoc_indent = 1 to enable comments using the official Scaladoc style.

/**
  * Scaladoc comment with g:scala_scaladoc_indent = 1
  */

/**
 * Doc comment with g:scala_scaladoc_indent = 0 or not set.  This is the current behaviour
 */

Referenced in #116

@@ -16,7 +16,11 @@ silent! setlocal formatoptions+=j

" Just like c.vim, but additionally doesn't wrap text onto /** line when
" formatting. Doesn't bungle bulleted lists when formatting.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
if exists('g:scala_scaladoc_indent') && g:scala_scaladoc_indent
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can clean up the conditionals with:

if get(g:, 'scala_scaladoc_indent', 0)

@ches
Copy link
Collaborator

ches commented Aug 2, 2016

Does this behave okay if you start the comment on the first line, the /** one? That's pretty common in projects that use this style. If formatting comments with gq behaves poorly in that case it may be hard to work around Vim's behavior for that, not sure.

Finally, please add the info to the vimdoc in doc/scala.txt, that's more import than the README IMO.

@mjp4
Copy link
Contributor Author

mjp4 commented Aug 2, 2016

It behaves fine with the comment on the first line.
I have made all the improvements you suggested and tested them.
I have combined all the changes into a single commit.

@derekwyatt derekwyatt merged commit a6a350f into derekwyatt:master Aug 2, 2016
@ches
Copy link
Collaborator

ches commented Aug 3, 2016

Thanks @mjp4, sorry about the delay in reviewing!

@mjp4
Copy link
Contributor Author

mjp4 commented Aug 3, 2016

Thanks :-)

ornicar added a commit to ornicar/vim-scala that referenced this pull request Jan 21, 2017
* 'master' of https://github.com/derekwyatt/vim-scala: (50 commits)
  Configure asterisk alignment in multiline comments to match scaladoc recommendation (derekwyatt#129)
  fix: Handle when there is only one or no "import" (derekwyatt#128)
  added "tparam"
  Empty backtick literals are invalid scala syntax (derekwyatt#127)
  Fix for issue derekwyatt#120
  removed @scalaHtml
  Added some test highlighting
  remove @scalaHtml from scalaMultilineComment
  Removed the link to the build status
  Make comments foldable
  Update instructions
  Fixes/cleanup of built-in Tagbar and ctags config
  More permissive shebang detection, highlight them
  I really prefer colouring the `${` and `}`
  syntax: Add scalaTodo
  syntax: Extract scalaCommentCodeBlockBrackets
  syntax: Extract scalaSquareBracketsBrackets
  syntax: Extract scalaInterpolationBrackets + scalaInterpolationBoundary
  syntax: Fix char escapes
  Use sbt.scala multi-filetype for sbt files
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants