Skip to content

Commit 6115d92

Browse files
author
Derek Wyatt
committed
Enable spellcheck in comments -- ches
1 parent 76f5147 commit 6115d92

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

syntax/scala.vim

+10-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ endif
99

1010
scriptencoding utf-8
1111

12+
let b:current_syntax = "scala"
13+
1214
" Allows for embedding, see #59; main_syntax convention instead? Refactor TOP
15+
"
16+
" The @Spell here is a weird hack, it means *exclude* if the first group is
17+
" TOP. Otherwise we get spelling errors highlighted on code elements that
18+
" match scalaBlock, even with `syn spell notoplevel`.
1319
function! s:ContainedGroup()
1420
try
1521
silent syn list @scala
16-
return '@scala'
22+
return '@scala,@NoSpell'
1723
catch /E392/
18-
return 'TOP'
24+
return 'TOP,@Spell'
1925
endtry
2026
endfunction
2127

@@ -157,7 +163,7 @@ syn match scalaTypeAnnotationParameter /@\<[`_A-Za-z0-9$]\+\>/ contained
157163
hi link scalaTypeOperator Keyword
158164
hi link scalaTypeAnnotationParameter Function
159165

160-
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml keepend
166+
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml,@Spell keepend
161167
syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained
162168
syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained
163169
syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained
@@ -173,7 +179,7 @@ hi link scalaCommentCodeBlock String
173179
syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/
174180
hi link scalaAnnotation PreProc
175181

176-
syn match scalaTrailingComment "//.*$"
182+
syn match scalaTrailingComment "//.*$" contains=@Spell
177183
hi link scalaTrailingComment Comment
178184

179185
syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing

syntax/testfile.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def x(): Unit = {
4343

4444
class ScalaClass(i: Int = 12, b: Trait[A, Trait[B, C]]) extends B with SomeTrait[A, B[String], D] {
4545
/**
46-
* I forgot comments! [[scala.Option]]
46+
* I forgot comments! We spelcheck them. [[scala.Option]]
4747
*
4848
* {{{
4949
* scala> This is a REPL line
@@ -52,10 +52,10 @@ class ScalaClass(i: Int = 12, b: Trait[A, Trait[B, C]]) extends B with SomeTrait
5252
*
5353
* <li></li>
5454
*
55-
* @param parameter Explanation of the parameter.
55+
* @param parameter Explanation of the parameter. Speling.
5656
* @return
5757
*/
58-
val thing = "A String" // this is a trailing comment
58+
val thing = "A String" // this is a trailing comment, spelchecked too
5959
val thing = "A String with a \" in it"
6060
val intString = "A string with $stuff // and a comment in it"
6161
val intString = s"A string /* a comment and */ with $stuff and ${stuff} in it"
@@ -162,6 +162,7 @@ class ScalaClass(i: Int = 12, b: Trait[A, Trait[B, C]]) extends B with SomeTrait
162162
val something = s"""bar="foo""""
163163
val something = f"""bar="foo""""
164164
val something = """bar="foo""""
165+
val something = s"Interpolatin' fancy expressions ${bar map (_.toString)}"
165166

166167
def someFunc[A <: B, X =:= Y]
167168

0 commit comments

Comments
 (0)