- Enable folding of class, enum and interface declarations.
- Highlight constructor names with the Function highlight group, like
other special methods.
- Mark function definitions using special method names as errors.
- Highlight :type arguments.
fixes: vim/vim#14393#issuecomment-2042796198.
closes: vim/vim#13810818c641b6f
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Currently, the overriding object method definitions are
matched as vimFunctionError (:help builtin-object-methods,
v9.1.0148).
For example:
------------------------------------------------------------
vim9script
class Test
def string(): string
return "Test"
enddef
endclass
echo string(Test.new()) == Test.new().string()
------------------------------------------------------------
Instead, let's introduce a new syntax group vimMethodName
and make these methods its members. In order to emphasise
the link between the overriding methods and the overridden
functions for highlighting, vimMethodName is linked by
default to vimFuncName.
80aabaab66
Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
With the arrival of Vim9 classes, the syntax must allow for
_new_ constructors; multiple constructor definitions are
supported for a class, provided distinct suffix-names are
used. Currently, the defined constructors match either
vimCommand or vimFunctionError (for any newBar).
For example:
------------------------------------------------------------
vim9script
class Foo
def new()
enddef
def newBar()
enddef
endclass
------------------------------------------------------------
Since every constructor is required to bear a lower-cased
_new_ prefix name, it should suffice to distinguish them
from functions, and so there are no new highlight or syntax
groups introduced.
dfcef890cb
Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
- Move mantic to unsupported
- Reorder names to maintain alphabetic order
- Bump date to submit upstream
closes: vim/vim#159919dadfe7a52
Co-authored-by: James McCoy <jamessan@jamessan.com>
This commit makaes the following changes to the vim help syntax:
- fix excessive URL detection in help, because `file:{filename}` in
doc/options.txt is determined to be a URL.
- update highlighting N for :resize in help
- split Italian-specific syntax into separate help script
- highlight `Note` in parentheses in help
- update 'titlestring' behaviour in documentation for invalid '%' format
closes: vim/vim#158836c2fc377bf
Co-authored-by: Milly <milly.ca@gmail.com>
Problem: filetype: lf config files are not recognized
Solution: detect lfrc files as lf filetype, include a syntax
script for lf files (Andis Spriņķis).
References:
- https://github.com/gokcehan/lfcloses: vim/vim#158590f146b7925
Co-authored-by: Andis Spriņķis <spr.andis@protonmail.com>
The syntax script allowed for single backslash escapes like this
"string\""
But did not accommodate for the uncommon case:
"<key>\\"
Let's fix this by also skipping over double backslashes in the
skillString region.
closes: vim/vim#15832cb1d1dcc87
Co-authored-by: Simão Afonso @ Powertools Tech <simao.afonso@powertools-tech.com>
Problem: current command completion is a bit limited
Solution: Add the shellcmdline completion type and getmdcomplpat()
function (Ruslan Russkikh).
closes: vim/vim#158230407d621bb
Co-authored-by: Ruslan Russkikh <dvrussk@yandex.ru>
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: vim/vim#15740closes: vim/vim#1579660310a4b26
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Complement "g:java_ignore_javadoc" with "g:java_ignore_html"
and "g:java_ignore_markdown" to allow selectively disabling
the recognition of HTML and CommonMark respectively.
(Note that this is not a preview feature.)
======================== LIMITATION ========================
According to the syntactical details of JEP 467:
> Any leading whitespace and the three initial / characters
> are removed from each line.
>
> The lines are shifted left, by removing leading whitespace
> characters, until the non-blank line with the least
> leading whitespace has no remaining leading whitespace.
>
> Additional leading whitespace and any trailing whitespace
> in each line is preserved, because it may be significant.
the following example:
------------------------------------------------------------
/// A summary sentence.
/// A list:
/// - Item A.
/// - Item B.
///
/// Some code span, starting here `
/// 1 + 2 ` and ending at the previous \`.
------------------------------------------------------------
should be interpreted as if it were written thus:
------------------------------------------------------------
///A summary sentence.
/// A list:
/// - Item A.
/// - Item B.
///
/// Some code span, starting here `
/// 1 + 2 ` and ending at the previous \`.
------------------------------------------------------------
Since automatic line rewriting will not be pursued, parts of
such comments having significant whitespace may be ‘wrongly’
highlighted. For convenience, a &fex function is defined to
‘correct’ it: g:javaformat#RemoveCommonMarkdownWhitespace()
(:help ft-java-plugin).
References:
https://openjdk.org/jeps/467https://spec.commonmark.org/0.31.2closes: vim/vim#1574085f054aa3f
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Tim Pope <code@tpope.net>
Some gnu indent options take negative numbers (e.g. --indent-label).
Add matching for an optional single '-' before the number.
closes: vim/vim#15754ee20fc8062
Co-authored-by: John M Devin <john.m.devin@gmail.com>
Problem:
Headings in :help do not stand out visually.
Solution:
Define a non-standard `@markup.heading.1.delimiter` group and
special-case it in `highlight_group.c`.
FUTURE:
This is a cheap workaround until we have #25718 which will enable:
- fully driven by `vimdoc/highlights.scm` instead of using highlight
tricks (`guibg=bg guifg=bg guisp=fg`)
- better support of "cterm" ('notermguicolors')
Problem:
checkhealth report sections are not visually separated.
Solution:
Highlight with "reverse".
TODO: migrate checkhealth filetype to use treesitter.
TODO: default :help should also highlight headings more boldy!
Define "g:java_syntax_previews" and include number 476 in
its list to enable this recognition:
------------------------------------------------------------
let g:java_syntax_previews = [476]
------------------------------------------------------------
Reference:
https://openjdk.org/jeps/476closes: vim/vim#1570950423ab808
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Problem: Multiple timestamps in the same line were not highlighted
Solution: Adapt the syntax to support multiple timestamps
fixes: vim/vim#15703closes: vim/vim#15707597aadcf21
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
Define "g:java_syntax_previews" and include number 455 in
its list to enable this recognition:
------------------------------------------------------------
let g:java_syntax_previews = [455]
------------------------------------------------------------
Reference:
https://openjdk.org/jeps/455closes: vim/vim#1569823079450a8
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
- Allow function command modifiers.
- Match function bodies starting with empty lines.
Command modifiers reported by @Konfekt.
fixesvim/vim#15671closes: vim/vim#1567435699f1749
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Problem: filetype: salt files are not recognized
Solution: Detect '*.sls' files as filetype salt,
include a syntax script (Gregory Anders)
closes: vim/vim#1568989b9bb4ac8
Co-authored-by: Gregory Anders <greg@gpanders.com>
Stop assigning by default the NonText highlighting group for
javaConceptKind modifiers since its colour is hardly
distinguishable from a background colour for a range of
colour schemes.
fixesvim/vim#15237
related vim/vim#15238closes: vim/vim#156645e95c8f637
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Dexter Gaon-Shatford <dexter@gaonshatford.ca>
Match Vim9 boolean and null literals in expression arguments of :if,
:elseif, :while and :return.
closes: vim/vim#156844d427d4cab
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
By default spell checking is enabled for all text, but adding
`contains=@Spell` to syntax rules restricts spell checking to those
syntax rules. See `:help spell-syntax` for full details.
Variable names and headers are far more likely than comments to contain
spelling errors, so only enable spell checking in comments.
Introduced in https://github.com/xuhdev/syntax-dosini.vim/pull/8
cc @tobinjt
closes: vim/vim#15655c0982f9f79
Co-authored-by: John Tobin <johntobin@johntobin.ie>
- Match -addr and -keepscript attributes and generate -addr values.
- Match attribute errors where = is specified.
- Highlight attributes with Special like other Ex command options.
- Don't highlight user-specified completion function args.
- Match :delcommand -buffer attribute.
closes: vim/vim#155863c07eb0c67
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Recognize colon-delimited second part of Runas_Spec that specifies
permitted groups, e.g.:
alan ALL = (root, bin : operator, system) ALL
This implementation is sloppy because it accepts any amount of colons
delimiting further Runas_Lists, but for now that's better than bailing
out completely as soon as a colon is encountered (esp. given that the
default sudoers uses these colons, breaking highlighting OOTB).
Also, while at it, make Vim recognize all Tag_Spec items, not just
{,NO}PASSWD
closes: vim/vim#15607bd69b39514
Co-authored-by: Christian Brabandt <cb@256bit.org>
Match '(,'),'[,'],'{, and '} marks in Ex command ranges.
Thanks to Maxim Kim.
Fixesvim/vim#15332.
Closesvim/vim#15337.
d817609b87
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Improving syntax highlighting by allowing numbers, - and a $ as suffix
in user constants and by allowing hwConstants in If-Then statements
closes: vim/vim#1505987c01d9561
Co-authored-by: Tom Crecelius <holly@net-eclipse.net>
Introduce a new API variable "g:java_syntax_previews" whose
value must be a list of syntax preview feature numbers.
Enumerate the currently supported numbers in a table at the
end of the documentation entry for "ft-java-syntax".
Also, disable the recognition of String Templates. Despite
the withdrawal of this preview feature in its proposed form
from the upcoming JDK 23 release and the fact that the JDK
22 release is coming to EOL this September, an earlier
iteration of this preview feature was included in JDK 21
(LTS) whose EOL is projected to fall due in late 2028 and,
therefore, retain the current implementation.
Define "g:java_syntax_previews" and include number 430 in
its list to enable the recognition of String Templates:
------------------------------------------------------------
let g:java_syntax_previews = [430]
------------------------------------------------------------
References:
https://openjdk.org/jeps/430 (Preview)
https://openjdk.org/jeps/459 (Second Preview)
https://openjdk.org/jeps/465 (Third Preview)
https://mail.openjdk.org/pipermail/amber-spec-experts/2024-April/004106.htmlcloses: vim/vim#155798556e23ee9
Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Match :loadkeymap after Ex colons and bars.
Don't generate :loadkeymap as it is matched with a custom syntax group.
closes: vim/vim#155547866d54ecc
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
The end marker is not required to match the indent of :let when "trim"
is specified, it may also appear without leading whitespace as normal.
closes: vim/vim#155647884cc7418
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
* Improve heredoc handling
- Support "trim" for all the embedded scripts.
- Check the indent of "trim" for "let" and all the embedded scripts.
* Update missing part of vim.vim.base in the commit
d164f2a521f8e52e587727657fb1c19e9a25f32a.
* Update gen_syntax_vim.vim to catch up with 9.1.0685's source code.
closes: vim/vim#1554295e90781a4
Co-authored-by: Ken Takata <kentkt@csc.jp>