## Overview
- Move vim.lsp.diagnostic to vim.diagnostic
- Refactor client ids to diagnostic namespaces
- Update tests
- Write/update documentation and function signatures
Currently, non-LSP diagnostics in Neovim must hook into the LSP subsystem. This
is what e.g. null-ls and nvim-lint do. This is necessary because none of the
diagnostic API is exposed separately from the LSP subsystem.
This commit addresses this by generalizing the diagnostic subsystem beyond the
scope of LSP. The `vim.lsp.diagnostic` module is now simply a specific
diagnostic producer and primarily maintains the interface between LSP clients
and the broader diagnostic API.
The current diagnostic API uses "client ids" which only makes sense in the
context of LSP. We replace "client ids" with standard API namespaces generated
from `nvim_create_namespace`.
This PR is *mostly* backward compatible (so long as plugins are only using the
publicly documented API): LSP diagnostics will continue to work as usual, as
will pseudo-LSP clients like null-ls and nvim-lint. However, the latter can now
use the new interface, which looks something like this:
```lua
-- The namespace *must* be given a name. Anonymous namespaces will not work with diagnostics
local ns = vim.api.nvim_create_namespace("foo")
-- Generate diagnostics
local diagnostics = generate_diagnostics()
-- Set diagnostics for the current buffer
vim.diagnostic.set(ns, diagnostics, bufnr)
```
Some public facing API utility methods were removed and internalized directly in `vim.diagnostic`:
* `vim.lsp.util.diagnostics_to_items`
## API Design
`vim.diagnostic` contains most of the same API as `vim.lsp.diagnostic` with
`client_id` simply replaced with `namespace`, with some differences:
* Generally speaking, functions that modify or add diagnostics require a namespace as their first argument, e.g.
```lua
vim.diagnostic.set({namespace}, {bufnr}, {diagnostics}[, {opts}])
```
while functions that read or query diagnostics do not (although in many cases one may be supplied optionally):
```lua
vim.diagnostic.get({bufnr}[, {namespace}])
```
* We use our own severity levels to decouple `vim.diagnostic` from LSP. These
are designed similarly to `vim.log.levels` and currently include:
```lua
vim.diagnostic.severity.ERROR
vim.diagnostic.severity.WARN
vim.diagnostic.severity.INFO
vim.diagnostic.severity.HINT
```
In practice, these match the LSP diagnostic severity levels exactly, but we
should treat this as an interface and not assume that they are the same. The
"translation" between the two severity types is handled transparently in
`vim.lsp.diagnostic`.
* The actual "diagnostic" data structure is: (**EDIT:** Updated 2021-09-09):
```lua
{
lnum = <number>,
col = <number>,
end_lnum = <number>,
end_col = <number>,
severity = <vim.diagnostic.severity>,
message = <string>
}
```
This differs from the LSP definition of a diagnostic, so we transform them in
the handler functions in vim.lsp.diagnostic.
## Configuration
The `vim.lsp.with` paradigm still works for configuring how LSP diagnostics are
displayed, but this is a specific use-case for the `publishDiagnostics` handler.
Configuration with `vim.diagnostic` is instead done with the
`vim.diagnostic.config` function:
```lua
vim.diagnostic.config({
virtual_text = true,
signs = false,
underline = true,
update_in_insert = true,
severity_sort = false,
}[, namespace])
```
(or alternatively passed directly to `set()` or `show()`.)
When the `namespace` argument is `nil`, settings are set globally (i.e. for
*all* diagnostic namespaces). This is what user's will typically use for their
local configuration. Diagnostic producers can also set configuration options for
their specific namespace, although this is generally discouraged in order to
respect the user's global settings. All of the values in the table passed to
`vim.diagnostic.config()` are resolved in the same way that they are in
`on_publish_diagnostics`; that is, the value can be a boolean, a table, or
a function:
```lua
vim.diagnostic.config({
virtual_text = function(namespace, bufnr)
-- Only enable virtual text in buffer 3
return bufnr == 3
end,
})
```
## Misc Notes
* `vim.diagnostic` currently depends on `vim.lsp.util` for floating window
previews. I think this is okay for now, although ideally we'd want to decouple
these completely.
This generalizes diagnostic handling outside of just the scope of LSP.
LSP clients are now a specific case of a diagnostic producer, but the
diagnostic subsystem is decoupled from the LSP subsystem (or will be,
eventually).
More discussion at [1].
[1]: https://github.com/neovim/neovim/pull/15585
Adding the version we just released in the "version bump" commit is
useless, since that means the actual release only reports the old
version.
Closes#15362
[skip ci]
The "pull_request" trigger only enables read-access for forks,
"pull_request_target" is required if a fork is to be a trigger. Also
changed the python script to reflect this change.
Problem: Ex command info contains confusing information.
Solution: When using the NOTADR flag use ADDR_OTHER for the address type.
Cleanup code using NOTADR. Check for errors in
create_cmdidxs.vim. Adjust Makefile to see the errors.
b731689e85
Use Lua's "assert()" to make an invalid command definition
a compilation error.
Misc changes:
Remove 'RESTRICT' flag.
Neovim does not support "restricted" mode
since commit 7777532ceb.
TODO:
Do not generate files before Lua assertions
so that CMake always runs the generator script
if the previous build has an invalid command definition.
Breaking Changes:
- Deprecated all `vim.lsp.util.{*diagnostics*}()` functions.
- Instead, all functions must be found in vim.lsp.diagnostic
- For now, they issue a warning ONCE per neovim session. In a
"little while" we will remove them completely.
- `vim.lsp.callbacks` has moved to `vim.lsp.handlers`.
- For a "little while" we will just redirect `vim.lsp.callbacks` to
`vim.lsp.handlers`. However, we will remove this at some point, so
it is recommended that you change all of your references to
`callbacks` into `handlers`.
- This also means that for functions like |vim.lsp.start_client()|
and similar, keyword style arguments have moved from "callbacks"
to "handlers". Once again, these are currently being forward, but
will cease to be forwarded in a "little while".
- Changed the highlight groups for LspDiagnostic highlight as they were
inconsistently named.
- For more information, see |lsp-highlight-diagnostics|
- Changed the sign group names as well, to be consistent with
|lsp-highlight-diagnostics|
General Enhancements:
- Rewrote much of the getting started help document for lsp. It also
provides a much nicer configuration strategy, so as to not recommend
globally overwriting builtin neovim mappings.
LSP Enhancements:
- Introduced the concept of |lsp-handlers| which will allow much better
customization for users without having to copy & paste entire files /
functions / etc.
Diagnostic Enhancements:
- "goto next diagnostic" |vim.lsp.diagnostic.goto_next()|
- "goto prev diagnostic" |vim.lsp.diagnostic.goto_prev()|
- For each of the gotos, auto open diagnostics is available as a
configuration option
- Configurable diagnostic handling:
- See |vim.lsp.diagnostic.on_publish_diagnostics()|
- Delay display until after insert mode
- Configure signs
- Configure virtual text
- Configure underline
- Set the location list with the buffers diagnostics.
- See |vim.lsp.diagnostic.set_loclist()|
- Better performance for getting counts and line diagnostics
- They are now cached on save, to enhance lookups.
- Particularly useful for checking in statusline, etc.
- Actual testing :)
- See ./test/functional/plugin/lsp/diagnostic_spec.lua
- Added `guisp` for underline highlighting
NOTE: "a little while" means enough time to feel like most plugins and
plugin authors have had a chance to refactor their code to use the
updated calls. Then we will remove them completely. There is no need to
keep them, because we don't have any released version of neovim that
exposes these APIs. I'm trying to be nice to people following HEAD :)
Co-authored: [Twitch Chat 2020](https://twitch.tv/teej_dv)
- remove redundant autocmd list
This "grouped" list is useless, it only gets in the way when searching
for event names.
- intro.txt: cleanup
- starting.txt: update, revisit
- doc: `:help bisect`
- mbyte.txt: update aliases 1656367b90. closes#11960
- options: remove 'guifontset'. Why:
- It is complicated and is used by almost no one.
- It is unlikely to be implemented by Nvim GUIs (complicated to parse,
specific to Xorg...).
* Fix some small doc issues
* doc: fixup
* doc: fixup
* Fix lint and rebase
* Remove bad advice
* Ugh, stupid mpack files...
* Don't let people include these for now until they specifically want to
* Prevent duplicate tag
This makes it possible to restore the working directory of :terminal
buffers when reading those buffers from a session file.
Fixes#11288
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* scripts/vim-patch.sh: factor out _set_tokens_and_tags
This allows for caching `$tokens` and `$vim_commit_tags`, which will
become relevant with the next commit adding
`list_missing_previous_vimpatches_for_patch`.
- make parameters_doc a dict intead of a list
BEFORE:
"parameters_doc": [
{
"buffer": "Buffer handle, or 0 for current buffer"
}
],
AFTER:
"parameters_doc": {
"buffer": "Buffer handle, or 0 for current buffer"
},
- make "return", "seealso", lists instead of strings
Changes the generated msgpack result values in the runtime/doc/*.mpack
files to be formatted like this (instead of being formatted like Vim help text):
[
'nvim_win_get_var': {
'signature': 'nvim_win_get_var({window}, {name}, {err})',
'parameters': [('Window', 'window'), ('String', 'name'), ('Error *', 'err')],
'parameters_doc': [{'window': 'Window handle, or 0 for current window', 'name': 'Variable name'}],
'doc': ['Gets a window-scoped (w:) variable'],
'return': ['Variable value'],
'seealso': []
}
},
...
]
The following script is cut out from vim-patch.sh:
```sh
#!/usr/bin/env bash
BASENAME=vim-patch.sh
printf "\nInstructions:
To port one of the above patches to Neovim, execute this script with the patch revision as argument and follow the instructions, e.g.
'%s -p v8.0.1234', or '%s -P v8.0.1234'
NOTE: Please port the _oldest_ patch if you possibly can.
You can use '%s -l path/to/file' to see what patches are missing for a file.
" "${BASENAME}" "${BASENAME}" "${BASENAME}"
```
The code itself should be correct, but shellcheck 0.7.0 says:
```
In /tmp/test.sh line 5:
printf "\nInstructions:
^-- SC2183: This format string has 2 variables, but is passed 3 arguments.
```
We also had a problem before that a `%s` was added, but the accompanying
argument to printf was forgotten. Using a heredoc is less error-prone, since we
insert variables directly.
Judging class definitions in the form "string.find (line, '=% s * class% (')"
must force writing class definitions in this format, but such a mechanism is Absent.
Also, Lua has no formal class in the language specification, and implements inheritance with setmetadable.
To detect this, we should have a parser for it, not a simple regular expression.
Convenient for API clients who want to reuse the API docs in their own
docs. Could be used e.g. to eliminate nvim.net's own doxygen parser:
3a736232a4/src/NvimClient.APIGenerator/Docs
TODO: currently the result values are formatted as Vim help docs. We
should change the values to have structure, something like this:
[{
'nvim_win_get_var': [
'line1,
'line2',
[ 'item1', 'item2', ... ]
],
'nvim_win_set_var': [
...
],
...
}]
close#11296
Avoid noise during builds:
> fatal: No annotated tags can describe '417449f468c4ba186954f6295b3338fb55ee7b4a'.
> However, there were unannotated tags: try --tags.
This might be useful in general, but is expected to not happen - and
falling back is OK then. The fallback command would still display
errors then.
It also uses `--first-parent`, which is important for when a release
branch gets merged back.
* Fix/keep massaging git-describe result
Ref: https://github.com/neovim/neovim/pull/11117#issuecomment-536416223
* build: revisit generation of version from Git
Fixes "make clean && make", where "auto/versiondef.h" would be missing
since b18b84d - because BYPRODUCTS are apparently removed when cleaning.
This includes the following improvements/changes:
- do not run git-describe during CMake's configure phase just for
reporting
- do not print with changed Git version (too noisy, simplifies code)
* Move to src/nvim (included before config) for easier flow
* fallback to describe always, write empty include file
* update_version_stamp.lua: use prefix always
This avoids invoking CMake after a new commit, which might take 15s on
some systems.
Skipped on CMake < 3.2.0 (missing BYPRODUCTS support).
Co-Authored-By: Justin M. Keyes <justinkz@gmail.com>
Replace "src/nvim/" => "src/".
Replace ".*/.vim-src/" => "".
This allows to use tab completion based on existing files in Neovim's
source, or via .vim-src.
Previously you would have to typically remove the "nvim/" part manually
yourself.
Align matchit.vim with upstream Vim. We don't want to maintain a fork of
matchit.vim; our small changes should be sent to
https://github.com/chrisbra/matchit
* scripts/vim-patch.sh: fall back to "origin" for remote
Without this, it would fail e.g. with a locally cloned repo of Neovim.
* scripts/vim-patch.sh: assign_commit_details: handle tags [ci skip]
- Handle "v" prefix from Vim tags.
- Exit in case of error therein already.
* -l/-L: pass through git-log options [ci skip]
This allows for only listing missing patches for a given Vim file:
> scripts/vim-patch.sh -L src/edit.c
`vim-patch.sh -L`: down to ~0.5s from ~85s.
`vim-patch.sh -l`: down to ~6s from ~90s.
% diff old new:
193c193
< • v8.0.1366
---
> • v8.0.1367
354d353
< • v8.0.1738
This is due to duplicate tags for Vim commits
(https://github.com/vim/vim/issues/4510):
- vim/vim@1ad022a9b: tagged as v8.0.1367, v8.0.1366
- vim/vim@5d69da462: tagged as v8.0.1739, v8.0.1738
- render_node() is now the main rendering function: it traverses a node
and builds the Vim help text recursively.
- render_para() is weird and ugly, it is the entry-point for rendering
the help text for one docstring'd function.
- Any long symbol is intentional and should never be hardwrapped.
- Vim help tags are often hyphenated, and hardwrapping on hyphens breaks
the Vim help syntax parser.
Reverts previous experiment. PVS root is working correctly, one can
observe this in the PVS-studio.err file, for example:
/usr/local/clang-7.0.0/lib/clang/7.0.0/include/stddef.h:51:1: warning: V677 ...
/usr/local/clang-7.0.0/lib/clang/7.0.0/include/stddef.h:132:1: warning: V677 ...
./src/nvim/fileio.c:1382:1: warning: V1026 ...
./src/nvim/fileio.c:1388:1: warning: V1026 ...
The "./src/nvim/…" paths are correctly rooted, yet PVS somehow still
thinks it should analyze "/usr/local/clang-7.0.0/…".
See also: https://stackoverflow.com/q/44906903
Use uv_set_vterm_state() to override libuv's guess.
See https://github.com/libuv/libuv/pull/1873/ for discussion.
This commit uses a terminal-detection approach based on
GetProcessImageFileNameW(...), which will be reverted in the following
commit. The approach was intended to handle the case of running in
winpty (:terminal), but we will add $NVIM env var for that.
Also add some support for ConEmu, cygwin.
Comparing `vimCommand` from Vim's runtime/syntax/vim.vim, one can see
that "augroup" and similar commands are conspicuously missing. They are
handled specially (`vimAugroupKey`, `vimAutoCmd`).
Excluding them from the generated `vimCommand` keyword list, fixes their
highlighting.
closes#9327
I have `merge.ff = no` in my Git config to not use fast-forward merges
by default, but when updating the Vim sources it should not cause a
merge commit.
[ci skip]
In the case of nested repos, such as when "neovim/" repo contains
"neovim/.vim-src/" repo,
git rev-parse --show-toplevel
returns the fullpath to the "neovim/" repo, which failed the condition.
ref #8875
ref c05d7153d3
Longer summary lines for commits may be wrapped when downloading the
commit from GitHub. Unwrapping the lines ensures they can be compared
with the raw Vim commits.
The difference before and after this patch using:
./scripts/vim-patch.sh -r 8684
Before:
✘ Wrong commit message.
Expected:
vim-patch:8.0.1464: completing directory after :find does not add slash
Problem: Completing directory after :find does not add slash.
Solution: Adjust the flags for globpath(). (Genki Sky)
vim/vim@8a37b03
Actual:
vim-patch:8.0.1464: completing directory after :find does not
add slash
Problem: Completing directory after :find does not add slash.
Solution: Adjust the flags for globpath(). (Genki Sky)
After:
✔ Found expected commit message.
[ci skip]
This ensures that special characters in the variables are not
interpreted as escapes/format characters in the printf string, as was
seen with upstream patch 8.0.0615.
$ ./scripts/vim-patch.sh -p 8.0.0615
Updating Vim sources: /$HOME/src/neovim/.vim-src
✔ Updated Vim sources.
✔ Found Vim revision 'bf15b8d78b22661db8b19d662b62bb9a061cdd37'.
Creating patch...
Pre-processing patch...
✔ Saved patch to '/$HOME/src/neovim/vim-8.0.0615.patch'.
Fetching 'origin/master'.
✔ From https://github.com/neovim/neovim
* branch master -> FETCH_HEAD
Creating new branch 'vim-8.0.0615' based on 'origin/master'.
✔ Switched to a new branch 'vim-8.0.0615'
Branch 'vim-8.0.0615' set up to track remote branch 'master' from 'origin'.
Creating empty commit with correct commit message.
./scripts/vim-patch.sh: line 40: printf: `w': invalid format character
✔ [vim-8.0.0615 db7fbb016] vim-patch:8.0.0615: using ./scripts/vim-patch.sh: line 44: printf: `w': invalid format character
✘ [vim-8.0.0615 db7fbb016] vim-patch:8.0.0615: using
[ci-skip]
plog-converter behaviour is not the best one when creating fullhtml report and
directory already exists: it puts report inside an existing directory. Not sure
what exactly it does if inside exists as well, but if I am not mistaking report
will not be created.
This will allow users to use AppImageUpdate to update their AppImage.
It requires publishing the created zsync file alongside the appimage
file for the releases.
vim-patch:8.0.1206: no autocmd for entering or leaving the command line
(commit a4f6cec7a3)
NA patches:
vim-patch:8.0.0320: warning for unused variable with small build
The hardcoded URL breaks very often, this confuses people.
Instead, auto-detect if no URL is provided.
Also auto-detect if the script is invoked with no arguments.
vimrc_example.vim is not relevant to Nvim. Anything worth having in
there should be made an actual default.
.gitignore:
- remove *.orig ... super annoying
- Prefer "TUI" where possible to refer to the host terminal.
- Remove obsolete tags and ancient TTY exposition.
- Establish "terminal" to consistently mean "terminal emulator" in all
Nvim documentation. This removes the need for verbose qualifiers in
tags and prose.
References #6280
References #6803
This was added from the beginning to submit_pr in 775a16b0b, but I
cannot see why that is useful - in contrast, it will mess with the local
branch in case "origin" cannot be pushed to (i.e. when it points to
neovim/neovim itself).
Needed as argument list is growing large and I absolutely do not find short
options provided by getopts being particularly readable for unfamiliar commands.
[ci skip]
Contains unfinished attempt to integrate IWYU (ref #549). To finish it different
job should be done, specifically:
- Instead of feeding IWYU with modified file a mirror source tree should be
created with the help of CMake which will contain modified sources. This
solves the problem with IWYU thinking that `*.generated.h` headers should be
included in place of `*` headers.
- Build IWYU as all other third-party utilities.
- Make modified sources avoid problems with `nvim/func_attr.h` includes and
various related tricks.
Current script may only be used for manual checks like this:
./scripts/check-includes.py \
--generated-includes-dir build/include \
--generated-includes-dir build/src/nvim/auto \
--file src/nvim/eval/typval.c \
-- -Isrc -Ibuild/include -Ibuild/src/nvim/auto \
-DINCLUDE_GENERATED_DECLARATIONS
(it is also somewhat fine with `--file src/nvim/eval/typval.h`). I have no idea
why (I mean, why developer think that these lines are needed, why they are
suggested is pretty obvious: because there is typedef which mentions them before
structs are defined), but for typval.h it reports, among other things, that it
should add lines
struct dictvar_S;
struct listitem_S;
struct listvar_S;
struct listwatch_S;
Now it checks functions also after every semicolon and closing figure brace,
possibly preceded by whitespaces (tabs and spaces). This should make messing
with declarations in macros not needed.
Reasoning; currently INTERNAL_CALL is mostly used to determine whether it is
needed to deal with NL-used-as-NUL problem. This code is useful for nvim_… API
calls done from VimL, but not for API calls done from lua, yet lua needs to
supply something as channel_id.
During testing found the following bugs:
1. msgpack-gen.lua script is completely unprepared for Float values either in
return type or in arguments. Specifically:
1. At the time of writing relevant code FLOAT_OBJ did not exist as well as
FLOATING_OBJ, but it would be used by msgpack-gen.lua should return type
be Float. I added FLOATING_OBJ macros later because did not know that
msgpack-gen.lua uses these _OBJ macros, otherwise it would be FLOAT_OBJ.
2. msgpack-gen.lua should use .data.floating in place of .data.float. But it
did not expect that .data subattribute may have name different from
lowercased type name.
2. vim_replace_termcodes returned its argument as-is if it receives an empty
string (as well as _vim_id*() functions did). But if something in returned
argument lives in an allocated memory such action will cause double free:
once when freeing arguments, then when freeing return value. It did not cause
problems yet because msgpack bindings return empty string as {NULL, 0} and
nothing was actually allocated.
3. New code in msgpack-gen.lua popped arguments in reversed order, making lua
bindings’ signatures be different from API ones.
No tests yet, no documentation update, no :lua* stuff, no vim module.
converter.c should also work with typval_T, not Object.
Known problem: luaeval("1", {}) results in
PANIC: unprotected error in call to Lua API (attempt to index a nil value)
Ref #3823
It's important that users have a single, easy-to-remember place for
reading about the API. So this commit changes gen_api_vimdoc.py so that
the generated section is appended to api.txt instead of creating
a separate document.
Also remove the section numbering and ToC: it's a maintenance cost, and
it will be unnecessary when #5169 is integrated.
It's not atypical to have extra, non-"vim-patch" commits in a PR merging
a bigger or set of related patches from Vim. Rather than immediately
aborting, display the patch header to the user and let them decide
whether to continue reviewing.
grep 2.26 changed its behavior when redirecting its output to /dev/null
such that it exits as soon as one match is found. This causes sed to
get a SIGPIPE which, due to "set -o pipefail", falsely implies that the
patch is not applied.
Removing "set -o pipefail" preserves the good exit status from grep.
Since data.integer is a different (larger) integer type than
data.{buffer,window,tabpage}, we cannot abuse the union by using
data.integer to access the value for all 4 types. Instead, remove the
{buffer,window,tabpage} members and always use the integer member.
In order to accomodate this, perform distinct validation and coercion
between the Integer type and Buffer/Window/Tabpage types in
object_to_vim, msgpack_rpc helpers, and gendispatch.lua.
FEATURES:
0b5a7e4ad5#4432 API: external UIs can render custom popupmenu
c6ac4f84b1#4934 API: call any API method from vimscript
31df051ed9#4568 API: nvim_call_atomic(): multiple calls in a single request
b268ba353a#5424 API: nvim_win_get_number(), nvim_tabpage_get_number()
e7e2844d46 has("nvim-1.2.3") checks for a specific Nvim version
522b885a0d#5295, #5493 `:CheckHealth` checks tmux, terminfo, performance
719dae2e01#5384 events: allow event processing in getchar()
f25797f869#5386 API: metadata: Nvim version & API level
22dfe6925d#5389 API: metadata: "since", "deprecated_since"
605e74327a Added QuickFixLine highlight group
CHANGES:
4af6ec746c#5253 perf: Disable clipboard in do_cmdline()
6e9f329d05#5299 perf: Skip foldUpdate() in insert-mode.
9d4fcec7c6#5426 perf: Do not auto-update folds for some foldmethods.
eeec0cab58#5419 tui: Default to normal-mode cursor shape.
FIXES:
e83845285c#5436 tui: Fix "weird characters" / "bleeding termcodes"
10a54ad12e#5243 signal_init: Always unblock SIGCHLD.
bccb49bedb#5316 eval.c: Fix memory leak for detached pty job
626065d385#5227 tchdir: New tab should inherit CWD.
cd321b7d0f#5292 getcwd(): Return empty string if CWD is invalid.
6127eaef05 shada: Fix non-writeable ShaDa directory handling
ca65514a24#2789 system(): Respect shellxescape, shellxquote
2daf54ee8d#4874 Restore vim-like tab dragging
0c536b5d8a#5319 syntax.c: Support bg/fg special color-names.
3c53371b0c#4972 from justinmk/schedule-ui_refresh
68bcb32ec4#4789 tui.c: Do not wait for tui loop on teardown.
c8b6ec2e6a#5409 v:count broken in command-line window
6bc3bcefc6#5461 fix emoji display
51937e1322#5470 fix :terminal with :argadd, :argu
79d77da8a0#5481 external UIs: opening multiple files from command-line
657ba62a84#5501 rplugin: resolve paths in manifest file
6a6f188d2a#5502 system('foo &', 'bar'): Show error, don't crash.
1ff162c0d9#5515 os_nodetype: open fd with O_NONBLOCK
2a6c5bb0c4#5450 modeline: Handle version number overflow.
0ade1bb706#5225 CI tests now run against Windows!
The API level is disconnected from the NVIM version. The API metadata
holds the current API level, and the lowest backwards-compatible level
supported by this instance.
Release 0.1.6 will be the first release reporting the Nvim version and
API level.
metadata['version'] = {
major: 0,
minor: 1,
patch: 6,
prerelease: true,
api_level: 1,
api_compatible: 0,
}
The API level may remain unchanged across Neovim releases if the API has
not changed.
When changing the API the CMake variable NVIM_API_PRERELEASE is set to
true, and NVIM_API_CURRENT/NVIM_API_COMPATIBILITY are incremented
accordingly.
The functional tests check the API table against fixtures of past
versions of Neovim. It compares all the functions in the old table with
the new one, it does ignore some metadata attributes that do not alter
the function signature or were removed since 0.1.5. Currently the only
fixture is 0.mpack, generated from Neovim 0.1.5 with nvim --api-info.
Let genunicodetables determine which files it needs from the unicode
directory. cmake just needs to pass the directory and destination file
to the script.
Problem: Handling emoji characters as full width has problems with
backwards compatibility.
Solution: Only put characters in the 1f000 range in the emoji table.
6a08454b93
Problem: Handling emoji characters as full width has problems with
backwards compatibility.
Solution: Remove ambiguous and double width characters from the emoji table.
Use a separate table for the character class.
(partly by Yashuhiro Matsumoto)
b86f10ee10
Problem: Emoji characters are not considered as a kind of word character.
Solution: Give emoji characters a word class number. (Yashuhiro Matsumoto)
4077b33a83
Problem: Although emoji characters are ambiguous width, best is to treat
them as full width.
Solution: Update the Unicode character tables. Add the 'emoji' options.
(Yasuhiro Matsumoto)
3848e00e01
Without the groupings, only the first alternation matches the diff
marker. For example,
local na_doc='todo\.txt\|version\d\.txt\|tags'
... +'g^diff --git a/runtime/doc/'${na_doc}'...
becomes, after expansion,
... +'g^diff --git a/runtime/doc/todo\.txt\|version\d\.txt\|tags'...
so the matches become "^diff --get a/runtime/doc/todo\.txt",
"version\d\.txt", or "tags". Adding the grouping ensures the expected
behavior of requiring "^diff --get a/runtime/doc/" before every
filename.
Left over change from acb7c82 (fix leak when a api function is
incorrectly called with a list.). These initializations are now never
used and causes warnings in static analysis
Problems:
- Disables cross-compiling (alternative: keeps two hash implementations which
need to be synchronized with each other).
- Puts code-specific name literals into CMakeLists.txt.
- Workaround for lua’s absence of bidirectional pipe communication is rather
ugly.
Removes all kinds of problems with sorting, provides a ready-to-use function
list representation for genvimvim.lua, does not require specifying function name
twice (VimL function name (string) + f_ function name).
Without this the "cd scripts/.." might change to another dir (since
CDPATH is looked at before a local path), and then NEOVIM_SOURCE_DIR
might end up being "/somewhere/else\n/somewhere/else" (since the "cd"
prints the dir already in that case).
Closes https://github.com/neovim/neovim/pull/5213.
It is a wrong thing to do, this makes valid variable values be treated
incorrectly: in
XDG_DATA_HOME='/home/$foo/.local/share'
`$foo` should be treated literally and not expanded to `foo` environment
variable value.
Also makes option_expand not try to expand too long strings even if these too
long strings are default values. Previously it thought that default values
should always be expanded. Also does not try to expand NULL should it be the
default value just in case.
Fixes#4961
If a user has multiple remotes set for neovim/neovim, then
find_get_remote was returning 'remote1\nremote2\n', which breaks
anything trying to use it. Since we're just using this remote to fetch
from, any one will do.
It's acceptable for “git describe --tags --exact-match …” to fail, since
all runtime updates commits are untagged. All that matters is that we
get a tag when one exists.
Therefore, ignore the failure status of the git describe call, relying
on the captured output instead.
There are a total of 5 shell scripts in the Neovim source tree.
All but runtime\macros\less.sh had warnings/errors when run through
Shellcheck (http://www.shellcheck.net/).
This commit fixes all warnings/errors and also changes the shebang to
"#!/bin/sh" when possible (this was not possible for vim-patch.sh
because it uses many bashisms).
The shellcheck errors that were fixed are:
SC2068: Double quote array expansions to avoid re-splitting elements.
SC2086: Double quote to prevent globbing and word splitting.
SC2124: Assigning an array to a string! Assign as array, or use *
instead of @ to concatenate
SC2155: Declare and assign separately to avoid masking return values.
Make get_vim_sources fetch the whole repository (it's not THAT big) so we can
pick up all the patches. The regexp didn't pick up the NA patches if there was a
comma after NA, so I extended it (I allowed arbitray things after NA, so maybe
someone can write a comment or so, should not lead to confusion).
* Calling "vim-patch.sh -p" on a checked-out branch already created with
"-p" will re-use the branch and append commits.
* Fetch upstream/master before checking out branch on first call of "-p".
* Reverted creation of commit in submit step ("-s") to previous behavior:
Create an empty commit with correct commit message when "-p" is called.
* Submitting a pull request with "-s" will create a correct pull request
message even if multiple patches have been ported in one single branch
with "-p".
When calling "vim-patch.sh -s" on a checked-out branch created with
"vim-patch.sh -p", create commit from staged changes, push to origin,
create pull request (using hub), and clean up patch files.
This will avoid confusion if additional `it()` blocks are added.
(`setup()` only runs once per `describe()` block, whereas `before_each()`
runs before each `it()`).
Any patch may contain mixed encodings, so we must process them as byte
arrays. E.g. with stock `sed` on OS X patch
8a94d873aa8c753a8522ea86a049bdf2abd0c507 causes this error:
sed: RE error: illegal byte sequence
To avoid that, set LC_ALL=C.
Also remove redundant *.patch creation from review_pr().
What works:
1. ShaDa file dumping: header, registers, jump list, history, search patterns,
substitute strings, variables.
2. ShaDa file reading: registers, global marks, variables.
Most was not tested.
TODO:
1. Merging.
2. Reading history, local marks, jump and buffer lists.
3. Documentation update.
4. Converting some data from &encoding.
5. Safer variant of dumping viminfo (dump to temporary file then rename).
6. Removing old viminfo code (currently masked with `#if 0` in a ShaDa file for
reference).
API functions exposed via msgpack-rpc now fall into two categories:
- async functions, which are executed as soon as the request is parsed
- sync functions, which are invoked in nvim main loop when processing the
`K_EVENT special key
Only a few functions which can be safely executed in any context are marked as
async.
* Link to the commit details on GitHub for a tagged version.
* Non-tagged patches (runtime updates) are still linked to
Google Code because they are identified by a Mercurial commit hash.
Fixes the handling of the initial input lines of a test script by simply
skipping all initial empty lines.
Helped-by: Florian Walch <florian@fwalch.com>
Suggested-by: Florian Walch <florian@fwalch.com>
Add check to see if a string contains ], which can result in
cases where wrapping a string in [[...]] breaks. Use [=[...]=] instead
on those strings.
Use [=[...]=] for insert() and expect().
- Check for mercurial before using it
- Make 'Merging patches...' wiki page easier to copy
- Use `basename` instead of assuming the user is running vim-patch.sh
via the repo root
- Appease shellcheck by quoting path variables
- Remove unneeded variable quoting inside [[ ]] blocks
- Don't unconditionally 'exit 1'
'-h' and '--help' are both recognized options, so current behavior is
misleading.
* Remove 'test' prefix from test names.
* Ask if existing spec files should be overwritten.
* Fix for legacy tests with no initial buffer content (e.g. test_signs).
- Call compiler from CMake instead of lua script to generate a
preprocessor file - allows for better/early error detection if
the compiler fails
- Preprocessor files are saved along with the headers as .i files
- Accept preprocessor lines with trailing chars after # as is
the case in Clang/Windows
- The fourth argument to gendeclarations.lua is now the path to
the proprocessor output file
- Expose more logging control from the log.c module(get log stream and omit
newlines)
- Remove logging from the generated functions in msgpack-gen.lua
- Refactor channel.c/helpers.c to log every msgpack-rpc payload using
msgpack_object_print(a helper function from msgpack.h)
- Remove the api_stringify function, it was only useful for logging msgpack-rpc
which is now handled by msgpack_object_print.
Since all API functions now run immediately after a msgpack-rpc request is
parsed by libuv callbacks, a mechanism was added to override this behavior and
allow certain functions to run in Nvim main loop.
The mechanism is simple: Any API function tagged with the FUNC_ATTR_DEFERRED (a
"dummy" attribute only used by msgpack-gen.lua) will be called when Nvim main
loop receives a K_EVENT key.
To implement this mechanism it was necessary some restructuration on the
msgpack-rpc modules, especially in the msgpack-gen.lua script.
Now that the lua client is available, python/lupa are no longer necessary to run
the functional tests. The helper functions previously defined in
run-functional-tests.py were adapted to test/functional/helpers.lua.
The 'lupa' python package provides a simple way to seamless integrate lua and
python code.
This commit replaces vroom by a python script that exposes the 'neovim' package
to a lua state, and invokes busted to run functional tests. This is a temporary
solution that will enable writing functional tests using lua/bused while a lua
client library is not available.
The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style
syntax while also providing the customization power of a full programming
language. Another reason is to use a single framework for unit/functional tests.
Two other changes were performed in this commit:
- Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now
identified by "gcc/gcc-32". They will run unit/functional tests for both 64
and 32 bits.
- Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
Adapt gendeclarations.lua/msgpack-gen.lua to allow the `ArrayOf(...)` and
`DictionaryOf(...)` types in function headers. These are simple macros that
expand to Array and Dictionary respectively, but the information is kept in the
metadata object, which is useful for building clients in statically typed
languages.
Instead of building all metadata from msgpack-gen.lua, we now merge the
generated part with manual information(such as types and features). The metadata
is accessible through the api method `vim_get_api_info`.
This was done to simplify the generator while also increasing flexibility(by
being able to add more metadata)
Enhance msgpack-gen.lua to extract custom api type codes from the ObjectType
enum in api/private/defs.h. The type information is made available from the api
metadata and clients can use to correctly serialize/deserialize these types
using msgpack EXT type.
A new method is now exposed via msgpack-rpc: "get_api_metadata". This method has
the same job as the old method '0', it returns an object with API metadata for
use by generators.
There's one difference in the return value though: instead of returning a
string containing another serialized msgpack document, the metadata object is
returned directly(a separate deserialization step by clients is not required).
Use Map(String, rpc_method_handler_fn) for storing/retrieving rpc method
handlers in msgpack_rpc_init and msgpack_rpc_dispatch.
Also refactor serialization/validation functions in the
msgpack_rpc.c/msgpack_rpc_helpers.c modules to accept the new STR and BIN types.
Using msgpack v5 will let nvim be more compatible with msgpack libraries for
other platforms.
This also replaces "raw" references by "bin" which is the new name for msgpack
binary data type
:diffsplit command used to include some flag value twice. If I was using bitwise
OR it would be OK, but I had addition here. Changed to use bitwise OR.
To simplify modification/inclusion of continuous integration targets, this
removes travis.sh which contains a big if statement in favor of multiple scripts
under the new '.ci' directory.
Also changed the default log level to INFO so developers won't end up with big
log files without asking explicitly(DLOG statements were placed in really "hot"
code)
- Initialize variables before validating argument count to remove possibility of
freeing uninitialized pointers
- Set the error when the argument count validation fails
This simplifies the generated msgpack_rpc_dispatch() function, separates the
code for each RPC method more clearly and allows easy implementation of
alternative dispatching methods (e.g. string method id dispatch).
Stop forcing some platform setting that are really intended to be used
for Travis CI. Under other systems, like Arch Linux, it prevents
dependencies from being correctly located.
This is how API dispatching worked before this commit:
- The generated `msgpack_rpc_dispatch` function receives a the `msgpack_packer`
argument.
- The response is incrementally built while validating/calling the API.
- Return values/errors are also packed into the `msgpack_packer` while the
final response is being calculated.
Now the `msgpack_packer` argument is no longer provided, and the
`msgpack_rpc_dispatch` function returns `Object`/`Error` values to
`msgpack_rpc_call`, which will use those values to build the response in a
single pass.
This was done because the new `channel_send_call` function created the
possibility of having recursive API invocations, and this wasn't possible when
sharing a single `msgpack_sbuffer` across call frames(it was shared implicitly
through the `msgpack_packer` instance).
Since we only start to build the response when the necessary information has
been computed, it's now safe to share a single `msgpack_sbuffer` instance
across all channels and API invocations.
Some other changes also had to be performed:
- Handling of the metadata discover was moved to `msgpack_rpc_call`
- Expose more types as subtypes of `Object`, this was required to forward the
return value from `msgpack_rpc_dispatch` to `msgpack_rpc_call`
- Added more helper macros for casting API types to `Object`
any
Modify gendeclarations.lua to check if the generated non-static declaration
header changed before rewriting it with a new version. This is to prevent
unnecessary rebuilds of modules that depend on modules that had private changes.
- The 'stripdecls.py' script replaces declarations in all headers by includes to
generated headers.
`ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'`
was used for this.
- Add and integrate gendeclarations.lua into the build system to generate the
required includes.
- Add -Wno-unused-function
- Made a bunch of old-style definitions ANSI
This adds a requirement: all type and structure definitions must be present
before INCLUDE_GENERATED_DECLARATIONS-protected include.
Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is
the only exception.
I hadn't spotted that the `sh -e` commandline was being used. I *think* this
is what's causing the exit 0 line not to run. Pray for success.
It's a real shame I can't this locally, what a mess.
Run only on push to branch coverity-scan. We can use a cron script to do
this 4 times a week (that's our allowance).
NOTE: possible future improvements are:
1. Fold the build matrix item into another short one so we don't overburden
travis. It's a little less clear but it should be nicer on the
infrastructure.
2. Change the security token, one can do that from the coverity admin page.
3. Don't do the naive `make depend`, but use the prebuilt libraries.