" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
" Former Maintainer: Claudio Fleiner <claudio@fleiner.com>
" Repository: https://github.com/zzzyxwvut/java-vim.git
-" Last Change: 2024 Sep 28
+" Last Change: 2024 Oct 03
-" Please check :help java.vim for comments on some of the options available.
+" Please check ":help java.vim" for comments on some of the options
+" available.
-" quit when a syntax file was already loaded
-if !exists("g:main_syntax")
- if exists("b:current_syntax")
- finish
+" Do not aggregate syntax items from circular inclusion.
+if exists("b:current_syntax")
+ finish
+endif
+
+if exists("g:main_syntax")
+ " Reject attendant circularity for every :syn-included syntax file,
+ " but ACCEPT FAILURE when "g:main_syntax" is set to "java".
+ if g:main_syntax == 'html'
+ if !exists("g:java_ignore_html")
+ let g:java_ignore_html = 1
+ let s:clear_java_ignore_html = 1
+ endif
+ elseif g:main_syntax == 'markdown'
+ if !exists("g:java_ignore_markdown")
+ let g:java_ignore_markdown = 1
+ let s:clear_java_ignore_markdown = 1
+ endif
endif
- " we define it here so that included files can test for it
+else
+ " Allow syntax files that include this file test for its inclusion.
let g:main_syntax = 'java'
endif
" Include HTML syntax coloring for Javadoc comments.
if s:with_html
- syntax include @javaHtml syntax/html.vim
- unlet b:current_syntax
+ try
+ syntax include @javaHtml syntax/html.vim
+ finally
+ unlet! b:current_syntax
+ endtry
endif
" Include Markdown syntax coloring (v7.2.437) for Javadoc comments.
if s:with_markdown
try
syntax include @javaMarkdown syntax/markdown.vim
- unlet b:current_syntax
let s:ff.WithMarkdown = s:ff.LeftConstant
catch /\<E48[45]:/
call s:ReportOnce(v:exception)
hi clear markdownCodeBlock
hi clear markdownCodeDelimiter
hi clear markdownLinkDelimiter
+ finally
+ unlet! b:current_syntax
endtry
endif
unlet g:main_syntax
endif
+if exists("s:clear_java_ignore_html")
+ unlet! s:clear_java_ignore_html g:java_ignore_html
+endif
+
+if exists("s:clear_java_ignore_markdown")
+ unlet! s:clear_java_ignore_markdown g:java_ignore_markdown
+endif
+
let b:spell_options = "contained"
let &cpo = s:cpo_save
unlet s:cpo_save s:ff s:with_html s:with_markdown
--- /dev/null
+>N+0&#ffffff0|o| |c|o|d|e| |i|s| |r|e|c|o|g|n|i|s|e|d| |i|n| |H|T|M|L| |s|n|i|p@1|e|t|s|.| @35
+@75
+|~+0#e000e06&@2|h|t|m|l| +0#0000000&@67
+|<+0#00e0e07&|p+0#af5f00255&|r|e|>+0#00e0e07&|<|c+0#af5f00255&|o|d|e|>+0#00e0e07&| +0#0000000&@63
+|/|*@1| |H|T|M|L| |s|y|n|t|a|x| |c|i|r|c|u|l|a|r|i|t|y| |t|e|s|t|s|.| |*|/| @37
+|c|l|a|s@1| |H|T|M|L|S|y|n|t|a|x|C|i|r|c|u|l|a|r|i|t|y|T|e|s|t|s| @42
+|{| @73
+@4|/@2| |@|h|i|d@1|e|n| @59
+@4|/@2| @67
+@4|/@2| |@|p|a|r|a|m| |a|r|g|s| |o|p|t|i|o|n|a|l| |c|o|m@1|a|n|d|-|l|i|n|e| |a|r|g|u|m|e|n|t|s| @23
+@4|p|u|b|l|i|c| |s|t|a|t|i|c| |v|o|i|d| |m|a|i|n|(|S|t|r|i|n|g|[|]| |a|r|g|s|)| @32
+@4|{| @69
+@8|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|"@2| @44
+@12|`@2|j|a|v|a| @55
+@12|c|l|a|s@1| |S|y|n|t|a|x|C|i|r|c|u|l|a|r|i|t|y|T|e|s|t|s| @34
+@12|{| @61
+@16|p|u|b|l|i|c| |s|t|a|t|i|c| |v|o|i|d| |m|a|i|n|(|S|t|r|i|n|g|[|]| |a|r|g|s|)| @20
+@16|{| @57
+@20|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|"|.|"|)|;| @30
+@57|1|,|1| @10|T|o|p|
--- /dev/null
+| +0&#ffffff0@11|`@2|j|a|v|a| @55
+@12|c|l|a|s@1| |S|y|n|t|a|x|C|i|r|c|u|l|a|r|i|t|y|T|e|s|t|s| @34
+@12|{| @61
+@16|p|u|b|l|i|c| |s|t|a|t|i|c| |v|o|i|d| |m|a|i|n|(|S|t|r|i|n|g|[|]| |a|r|g|s|)| @20
+@16|{| @57
+@20>S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|"|.|"|)|;| @30
+@16|}| @57
+@12|}| @61
+@12|`@2| @59
+@8|"@2|)|;| @61
+@4|}| @69
+|}| @73
+|<+0#00e0e07&|/|c+0#af5f00255&|o|d|e|>+0#00e0e07&|<|/|p+0#af5f00255&|r|e|>+0#00e0e07&| +0#0000000&@61
+|~+0#e000e06&@2| +0#0000000&@71
+@75
+@75
+|M|a|r|k|d|o|w|n| |d|o|c|u|m|e|n|t|a|t|i|o|n| |c|o|m@1|e|n|t|s| |a|r|e| |n|o|t| |r|e|c|o|g|n|i|s|e|d| |i|n| |J|a|v|a| |s|n|i|p@1|e|t|s|.| @6
+@75
+|`+0#e000e06&@2|j|a|v|a| +0#0000000&@67
+@57|1|9|,|2|1| @8|3|7|%|
--- /dev/null
+|`+0#e000e06#ffffff0@2|j|a|v|a| +0#0000000&@67
+|/+0#0000e05&|*@1| +0#e000e06&|J|a|v|a| |s|y|n|t|a|x| |c|i|r|c|u|l|a|r|i|t|y| |t|e|s|t|s|.| +0#0000e05&|*|/| +0#0000000&@37
+|c+0#00e0003&|l|a|s@1| +0#0000000&|J|a|v|a|S|y|n|t|a|x|C|i|r|c|u|l|a|r|i|t|y|T|e|s|t|s| @42
+|{| @73
+@4|/+0#0000e05&@2| |@|h|i|d@1|e|n| +0#0000000&@59
+@4>/+0#0000e05&@2| +0#0000000&@67
+@4|/+0#0000e05&@2| |@|p|a|r|a|m| |a|r|g|s| |o|p|t|i|o|n|a|l| |c|o|m@1|a|n|d|-|l|i|n|e| |a|r|g|u|m|e|n|t|s| +0#0000000&@23
+@4|p+0#00e0003&|u|b|l|i|c| +0#0000000&|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&|m|a|i|n|(|S+0#e000002&|t|r|i|n|g|[+0#0000000&|]| |a|r|g|s|)| @32
+@4|{| @69
+@8|S+0#e000e06&|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|"@2| +0#0000000&@44
+| +0#e000002&@11|<|p|r|e|>|<|c|o|d|e|>| +0#0000000&@51
+| +0#e000002&@11|c|l|a|s@1| |S|y|n|t|a|x|C|i|r|c|u|l|a|r|i|t|y|T|e|s|t|s| +0#0000000&@34
+| +0#e000002&@11|{| +0#0000000&@61
+| +0#e000002&@15|p|u|b|l|i|c| |s|t|a|t|i|c| |v|o|i|d| |m|a|i|n|(|S|t|r|i|n|g|[|]| |a|r|g|s|)| +0#0000000&@20
+| +0#e000002&@15|{| +0#0000000&@57
+| +0#e000002&@19|S|y|s|t|e|m|.|o|u|t|.|p|r|i|n|t|l|n|(|"|.|"|)|;| +0#0000000&@30
+| +0#e000002&@15|}| +0#0000000&@57
+| +0#e000002&@11|}| +0#0000000&@61
+| +0#e000002&@11|<|/|c|o|d|e|>|<|/|p|r|e|>| +0#0000000&@49
+@57|3|7|,|5| @9|8@1|%|
--- /dev/null
+| +0#e000002#ffffff0@11|<|/|c|o|d|e|>|<|/|p|r|e|>| +0#0000000&@49
+| +0#e000002&@7|"+0#e000e06&@2|)|;+0#0000000&| @61
+@4|}| @69
+|}| @73
+>`+0#e000e06&@2| +0#0000000&@71
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|5|4|,|1| @9|B|o|t|
--- /dev/null
+No code is recognised in HTML snippets.
+
+~~~html
+<pre><code>
+/** HTML syntax circularity tests. */
+class HTMLSyntaxCircularityTests
+{
+ /// @hidden
+ ///
+ /// @param args optional command-line arguments
+ public static void main(String[] args)
+ {
+ System.out.println("""
+ ```java
+ class SyntaxCircularityTests
+ {
+ public static void main(String[] args)
+ {
+ System.out.println(".");
+ }
+ }
+ ```
+ """);
+ }
+}
+</code></pre>
+~~~
+
+
+Markdown documentation comments are not recognised in Java snippets.
+
+```java
+/** Java syntax circularity tests. */
+class JavaSyntaxCircularityTests
+{
+ /// @hidden
+ ///
+ /// @param args optional command-line arguments
+ public static void main(String[] args)
+ {
+ System.out.println("""
+ <pre><code>
+ class SyntaxCircularityTests
+ {
+ public static void main(String[] args)
+ {
+ System.out.println(".");
+ }
+ }
+ </code></pre>
+ """);
+ }
+}
+```
--- /dev/null
+unlet! g:java_ignore_javadoc g:java_ignore_markdown
+let g:java_highlight_debug = 1
+let g:java_highlight_java_lang = 1
+let g:markdown_fenced_languages = ['html', 'java']