buf_ensure_loaded already checks `(buf->b_ml.ml_mfp != NULL)`. #25823
TODO:
- #10070#13201 All buffer-related API functions except
`nvim_buf_is_loaded` (and `nvim_buf_is_valid`?) should always call
`buf_ensure_loaded`. Because the _common case_ is that plugins expect
the buffer to "just work"—and for the uncomon, performance-sensitive
case, the script can check `nvim_buf_is_loaded` to avoid implicitly
loading a buffer.
- Update documentation to clarify the above semantics.
Since some point INCLUDE_DEPRECATED stopped working as it is usually
turned off when generating an actual vimdoc. This commit fixes this
hidden feature back again (used for devel purposes only).
Problem: main() has too much logic implemented there, too difficult to
read.
Solution: Do more OOP, introduce `Section` dataclass that stores
information about a "section", with documentation and concrete examples
about what each field and variable would mean. Extract all the lines for
rendering a section into `section.render()` pulled out of `main()`.
Problem:
For function definitions to be included in the vimdoc (formatted) and
to be exported as mpack data (unformatted), we had two internal
representations of the same function/API metadata in duplicate;
one is FunctionDoc (which was previously a dict), and the other is
doxygen XML DOM from which vimdoc (functions sections) was generated.
Solution:
We should have a single path and unified data representation
(i.e. FunctionDoc) that contains all the metadata and information about
function APIs, from which both of mpack export and vimdoc are generated.
I.e., vimdocs are no longer generated directly from doxygen XML nodes,
but generated via:
(XML DOM Nodes) ------------> FunctionDoc ------> mpack (unformatted)
Recursive Internal |
Formatting Metadata +---> vimdoc (formatted)
This refactoring eliminates the hacky and ugly use of `fmt_vimhelp` in
`fmt_node_as_vimhelp()` and all other helper functions! This way,
`fmt_node_as_vimhelp()` can simplified as it no longer needs to handle
generating of function docs, which needs to be done only in the topmost
level of recursion.
runtime(dist/ft): improve filetype detection for *.v (V/Verilog/Coq)
Patch provided by Dan Alt
closes: vim/vim#1379310b4f75d4c
Co-authored-by: Christian Brabandt <cb@256bit.org>
runtime(sh): Update sh syntax and add local keyword for bash (vim/vim#13806)
add `local` in shStatement
b16fc98055
Co-authored-by: Lucien Grondin <grondilu@yahoo.fr>
feat(diagnostic): add `vim.diagnostic.count()`
Problem: Getting diagnostic count based on the output of
`vim.diagnostic.get()` might become costly as number of diagnostic
entries grows. This is because it returns a copy of diagnostic cache
entries (so as to not allow users to change them in place).
Getting information about diagnostic count is frequently used in
statusline, so it is important to be as fast as reasonbly possible.
Solution: Add `vim.diagnostic.count()` which computes severity
counts without making copies.
Problem: Commits backport-merged to release branches are cherry-picked
from the original commits in the PR from a fork repository, NOT the
actual commit that are merged to neovim/neovim (HEAD). Therefore the
commit reference in the commit message `cherry picked from commit ...`
usually refers to a commit that does NOT exist in the repository,
given that our preferred way of merging PR (rebasing, squashing, etc.)
would rewrite commits.
Solution: Turn on new feature 'detect_merge_method' of backport-action
workflow.
Adding a file to `OUTPUT` in `add_custom_command` marks that file as
`GENERATED` in cmake, and will thus be removed when running the `clean`
target. As cmake doesn't have a good way to mark that certain files
should not be removed, we instead "lie" to it by omitting the files we
want to keep from `OUTPUT`. This hack only works as long as there aren't
any other files that depend on the generated files we want to keep,
which currently seems to be the case. If this assumption changes in the
future, then we need to separate the parts that are generated and the
parts that are not as to prevent an infinite dependency chain.
Problem: `functional/vimscript/api_functions_spec` skips a test if the
runtime files are not generated, but this check was broken in a
refactor.
Solution: Since runtime files are now generated for all test targets, do
not skip this test.
- Use `#pragma once` for `cmake.config/config.h.in`
- Remove unused variable `CACHED_GENERATED_DIR`
- Reorganize and sort variables
- Introduce `STYLUA_DIRS` variable to ensure the `formatlua` and
`lintlua-stylua` operates on the same files.
- Adjust variable scope to avoid using hacky directory properties.
- Add more necessary runtime files as test dependencies
Problem: Wrong display when 'breakindentopt' contains "sbr" and
'showbreak' and 'nobreakindent' are set.
Solution: Always reset wlv->need_showbreak regardless of the values of
'breakindent' and 'showbreak', as they aren't checked when
setting wlv->need_showbreak (zeertzjq)
closes: vim/vim#137857e4f62a257
There is no reason for this file to be in project root, which is crowded
as is. This also fits nicely part of the ongoing work towards gathering
as much of the documentation as possible into one place.