neovim/runtime
Christian Clason b7e5769132 vim-patch:c4d0c8c81245
runtime(java): Improve the recognition of the "indent" method declarations (vim/vim#14659)

There is a flaw in the current implementation that has been
exacerbated around v5.2.  It lies in the recognition of all
three indentation styles simultaneously: a tab, two space,
and eight space character(s).  With it, it is not uncommon
to misidentify various constructs as method declarations
when they belong to two-space indented members and other
blocks of a type and are offset at eight space characters or
a tab from the start of the line.

For example,

------------------------------------------------------------
class Test
{
  static String hello() { return "hello"; }

  public static void main(String[] args)
  {
    try {
      if (args.length > 0) {
        // FIXME: eight spaces.
        System.out.println(args[0]);
      } else {
        // FIXME: a tab.
	System.out.println(hello());
      }
    } catch (Exception e) {
      throw new Error(e);
    }
  }
}
------------------------------------------------------------

------------------------------------------------------------
:let g:java_highlight_functions = 'indent'
:doautocmd Syntax
------------------------------------------------------------

A better approach is to pick an only indentation style out
of all supported styles (so either two spaces _or_ eight
spaces _or_ a tab).  Note that tabs and spaces can still be
mixed, only the leading tab or the leading run of spaces
matters for the recognition.  And there is no reason to not
complement the set of valid styles with any number of spaces
from 1 to 8, inclusively.

Please proceed with the necessary change as follows:

- rename from "indent" to "indent2" for a 2-space run;
- rename from "indent" to "indent8" for an 8-space run;
- continue to have "indent" for a tab run;
- define an "indent" variable with a suffix number denoting
  the preferred amount of indentation for any other run of
  spaces [1-8].

As before, this alternative style of recognition of method
declarations still does not prescribe naming conventions and
still cannot recognise method declarations in nested types
that are conventionally indented.

The proposed changes also follow suit of "style" in stopping
the claiming of constructor and enum constant declarations.

c4d0c8c812

Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
2024-04-30 00:10:02 +02:00
..
autoload vim-patch:08d2401fbc6d 2024-04-04 10:29:58 +02:00
colors fix(treesitter): document more standard highlight groups 2024-03-19 09:41:16 +01:00
compiler vim-patch:79952b9c6774 2024-04-27 11:01:14 +02:00
doc vim-patch:c4d0c8c81245 2024-04-30 00:10:02 +02:00
ftplugin vim-patch:dc5c90554145 2024-04-30 00:10:02 +02:00
indent vim-patch:2e9b9e9a9ebf 2024-04-29 00:10:03 +02:00
keymap vim-patch:caee7956a21a 2023-11-05 21:56:56 +01:00
lua fix(lsp): redundant vim.snippet.jumpable #28560 2024-04-29 13:45:53 -07:00
macros vim-patch:79230f027a25 2024-02-16 08:57:45 +01:00
pack/dist/opt vim-patch:d3c0ff5d5a90 2024-03-24 10:32:07 +01:00
plugin feat(defaults): add :Inspect to right-click menu (#28181) 2024-04-05 18:08:54 +08:00
queries fix(treesitter): update parsers and queries 2024-04-05 18:36:17 +02:00
spell
syntax vim-patch:c4d0c8c81245 2024-04-30 00:10:02 +02:00
tools
tutor docs: fix typos (#27868) 2024-03-28 09:32:32 +08:00
CMakeLists.txt build: various fixes 2024-02-01 12:06:55 +01:00
delmenu.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
filetype.lua fix(filetype): use unexpanded file name (#27931) 2024-03-23 11:46:23 +08:00
ftoff.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
ftplugin.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
ftplugof.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
indent.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
indoff.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
macmap.vim
makemenu.vim vim-patch:9.1.0013: Modula2 filetype support lacking (#27020) 2024-01-16 17:45:57 +00:00
menu.vim vim-patch:e059fae10044 2023-08-24 11:33:06 +09:00
mswin.vim vim-patch:45da32964d6e 2024-03-14 15:04:31 +08:00
neovim.ico
nvim.appdata.xml docs: add wiki FAQ to the runtime documentation (#26539) 2023-12-13 17:31:39 +01:00
nvim.desktop
nvim.png
optwin.vim vim-patch:9.1.0147: Cannot keep a buffer focused in a window 2024-03-11 11:38:13 +08:00
synmenu.vim vim-patch:9.1.0013: Modula2 filetype support lacking (#27020) 2024-01-16 17:45:57 +00:00