-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
Before anything, a minimal vimrc:
set nocompatible
" set runtimepath^=/path/to/zig.vim
syntax on
filetype plugin indent on
And my neovim version:
$ nvim --version
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.4/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Here we have a struct declaration, with one of the fields being of type <anonymous enum>
.
pub const St = struct {
anon_field: enum {
},
};
For some strange reason, this specific example doesn't indent properly.
If indenting the line with the },
in it (using ==
), it becomes:
pub const St = struct {
anon_field: enum {
},
};
That doesn't happen, though, if there is any non-empty line between the opening and closing brackets of the enum declaration:
pub const St = struct {
anon_field: enum {
some_field
}, // indents properly
};
Some other situations:
// if there is no trailing comma, it indents properly
pub const St = struct {
anon_field: enum {
some_field
}
};
// if there is any character other than a comma after the line, it also indents properly
pub const St = struct {
anon_field: enum {
}, // this comment prevents the indent problem
};
pub const St = struct {
anon_field: enum {
},
// (there's a trailing whitespace on the line above)
};
// empty lines do not solve the problem
pub const St = struct {
anon_field: enum {
},
};
// identifiers that are on the same line as the opening bracket do not solve the issue either.
pub const St = struct {
anon_field: enum { foo, bar
},
};
pub const St = struct {
anon_field: enum { foo, bar,
a // it solved with this one here, though
},
};
// it also happens with `struct` and any other type. The problem seems to be on the brackets themselves.
pub const St = struct {
anon_field: struct {
},
};
pub const St = struct {
anon_field: union(enum) {
},
};
pub const St = struct {
anon_field: {
},
};
Metadata
Metadata
Assignees
Labels
No labels