]> git.ipfire.org Git - thirdparty/vim.git/commit
runtime(java): Manage circularity for every :syn-included syntax file
authorAliaksei Budavei <0x000c70@gmail.com>
Fri, 4 Oct 2024 18:25:05 +0000 (20:25 +0200)
committerChristian Brabandt <cb@256bit.org>
Fri, 4 Oct 2024 18:25:05 +0000 (20:25 +0200)
commit60310a4b2630a4d3bb0b6da9bc03061ecfbac9ee
treec3b19397121bcd7976edcda63eac5cd7e0f9c206
parent075ab5ab3b8abc55baddce7105e22b6fa1b2e032
runtime(java): Manage circularity for every :syn-included syntax file

With "g:markdown_fenced_languages" defined and "java" added
to its list, a circular dependency between the Markdown and
Java syntax files will be made.  To break it, no Markdown
documentation comments will be recognised in fenced blocks
in Markdown files; in order to view Java source files,
"java" must be removed from "g:markdown_fenced_languages",
and this task can be automated as follows.

1) Add to "~/.after/ftplugin/java.vim":
------------------------------------------------------------
if exists("g:markdown_fenced_languages") &&
\ !(exists("g:java_ignore_javadoc") ||
\ exists("g:java_ignore_markdown"))
    let s:idx = index(g:markdown_fenced_languages, 'java')
    if s:idx > -1
call remove(g:markdown_fenced_languages, s:idx)
    endif
    unlet s:idx
endif
------------------------------------------------------------

2) Optionally add to "~/.after/ftplugin/markdown.vim":
------------------------------------------------------------
if exists("g:markdown_fenced_languages") &&
\ index(g:markdown_fenced_languages, 'java') < 0
    call add(g:markdown_fenced_languages, 'java')
endif
------------------------------------------------------------

(Make sure that the above snippets appear in the files under
the "ftplugin" NOT "syntax" directory.)

Finally, unless the new version of the syntax file is made
available from "$VIMRUNTIME" (and from "~/.vim/syntax" if
necessary), OTHER discoverable file versions will be used
whose behaviour may interfere with this fix.

related: #15740
closes: #15796

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/java.vim
runtime/syntax/testdir/dumps/markdown_circularity_00.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/markdown_circularity_01.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/markdown_circularity_02.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/markdown_circularity_03.dump [new file with mode: 0644]
runtime/syntax/testdir/input/markdown_circularity.markdown [new file with mode: 0644]
runtime/syntax/testdir/input/setup/markdown_circularity.vim [new file with mode: 0644]