Spell check not limited to comments in .java files

View: New views
4 Messages — Rating Filter:   Alert me  

Spell check not limited to comments in .java files

by Stephen Talley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Using vim 7.2, spell checking is not limited to comments and strings in .java
source files as it should be.  Instead, all text in the file is spell checked.

The problem starts with $VIM/vim72/syntax/java.vim, which includes html.vim:

    syntax include @javaHtml <sfile>:p:h/html.vim

In $VIM/vim72/syntax/html.vim, syntax is turned on for the toplevel:

    syntax spell toplevel

That may make sense in an HTML file, but not in Java.  One solution is to amend
java.vim:

    syntax include @javaHtml <sfile>:p:h/html.vim
    syntax spell default

Whether that is the correct solution, I'll leave to the experts.  Note too this
likely affects other syntax files that include html.vim:

    papp.vim
    java.vim
    groovy.vim
    spyce.vim

Thanks,

Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Spell check not limited to comments in .java files

by Bram Moolenaar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Stephen Talley wrote:

> Using vim 7.2, spell checking is not limited to comments and strings in .java
> source files as it should be.  Instead, all text in the file is spell checked.
>
> The problem starts with $VIM/vim72/syntax/java.vim, which includes html.vim:
>
>     syntax include @javaHtml <sfile>:p:h/html.vim
>
> In $VIM/vim72/syntax/html.vim, syntax is turned on for the toplevel:
>
>     syntax spell toplevel
>
> That may make sense in an HTML file, but not in Java.  One solution is to amend
> java.vim:
>
>     syntax include @javaHtml <sfile>:p:h/html.vim
>     syntax spell default

This is already included in the current version of the file:
ftp://ftp.vim.org/pub/vim/runtime/syntax/java.vim

> Whether that is the correct solution, I'll leave to the experts.  Note
> too this likely affects other syntax files that include html.vim:
>
>     papp.vim
>     java.vim
>     groovy.vim
>     spyce.vim

I'll add the line to the other files.  That's a better guess than not
doing anything.

--
Mushrooms always grow in damp places and so they look like umbrellas.

 /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Spell check not limited to comments in .java files

by Dave Land :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Folks,

While we're on the topic of java.vim, I noticed two things that seemed  
to me to be bugs, but it is likely that I haven't considered the  
myriad consequences of the following:

1) On line 49 of ftp://ftp.vim.org/pub/vim/runtime/syntax/java.vim,  
"String" is not included in the list of javaTypes. I added it locally  
and haven't seen any ill effects, but wonder if this is wise.

2) On line 155 of that file, JSP is excluded from having its JavaDoc  
highlighted. I have locally removed "&& main_syntax != 'jsp'" from  
line 155. Again, no radical ill effects, but curious why JSP is  
excluded?

Dave


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Re: Spell check not limited to comments in .java files

by Matthew Visser :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I can only really provide insight for the first point you made:

On Wed, Nov 11, 2009 at 09:59:13AM -0800, Dave Land wrote:

>
> Folks,
>
> While we're on the topic of java.vim, I noticed two things that seemed  
> to me to be bugs, but it is likely that I haven't considered the  
> myriad consequences of the following:
>
> 1) On line 49 of ftp://ftp.vim.org/pub/vim/runtime/syntax/java.vim,  
> "String" is not included in the list of javaTypes. I added it locally  
> and haven't seen any ill effects, but wonder if this is wise.

I think that this is probably done intentionally, since String isn't
really a basic type of java, but an Object.  There is support for
highlighting object types with a different file, javaid.vim, as far as
I know, which can be found at:

     http://www.fleiner.com/vim/syntax_60/javaid.vim

To me, it doesn't make sense to highlight the String class the same
way as a basic type, but it may just be my personal taste. I know
other IDE's I've used don't highlight String the same as something
like an int or double.

HTH,

Matthew


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---