Commit Graph

664 Commits

Author SHA1 Message Date
Axis
ece2960f1b
build(gen_vimdoc): remove needless list creation and unused variable (#19079)
build(gen_vimdoc): remove needless list creation
2022-06-25 18:03:02 +08:00
zeertzjq
7718b75846
refactor: move some mapping-related code to a separate file (#19061)
This marks the following Vim patches as ported:

vim-patch:8.1.1785: map functionality mixed with character input

Problem:    Map functionality mixed with character input.
Solution:   Move the map functionality to a separate file. (Yegappan
            Lakshmanan, closes vim/vim#4740)  Graduate the +localmap feature.
b66bab381c

vim-patch:8.2.3643: header for source file is outdated

Problem:    Header for source file is outdated.
Solution:   Make the header more accurate. (closes vim/vim#9186)
a3f83feb63

Also cherry-pick a change for <unique> mappings from patch 8.2.0807.
Rename map_clear_mode() to do_mapclear().
2022-06-23 21:17:11 +08:00
Christian Clason
504d7decbd
vim-patch:8c1b8cb2e0b5 (#18966)
Update runtime files
8c1b8cb2e0
2022-06-15 09:20:32 +02:00
bfredl
612944c586 refactor(api): update vimdoc 2022-06-12 19:45:39 +02:00
zeertzjq
214f866fe5
fix(terminfo): disable smglr for vtpcon and conemu (#18855) 2022-06-05 14:39:56 +02:00
Gregory Anders
67cbaf58c4 feat(fs): add vim.fs.parents()
vim.fs.parents() is a Lua iterator that returns the next parent
directory of the given file or directory on each iteration.
2022-05-31 13:04:40 -06:00
Justin M. Keyes
c43e2874c0 fix(vim-patch.sh)
In scripts/vim-patch.sh line 335:
      printf '
             ^-- SC2183 (warning): This format string has 4 variables, but is passed 3 arguments.

    In scripts/vim-patch.sh line 597:
      list_missing_vimpatches 1 "$@" | while read -r vim_commit; do
                                                     ^--------^ SC2030 (info): Modification of vim_commit is local (to subshell caused by pipeline)

    In scripts/vim-patch.sh line 626:
      done < <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "${vim_commit}" -- . ':!src/version.c')
                                                                                   ^-----------^ SC2031 (info): vim_commit was modified in a subshell. That change might be lost.

    For more information:
      https://www.shellcheck.net/wiki/SC2183 -- This format string has 4 variable...
      https://www.shellcheck.net/wiki/SC2030 -- Modification of vim_commit is loc...
      https://www.shellcheck.net/wiki/SC2031 -- vim_commit was modified in a subs...
2022-05-28 10:30:03 -07:00
zeertzjq
eb623a1c45 docs: add missing termdebug docs from Vim runtime updates
388a5d4f20
4466ad6baa
6aa57295cf

Rename terminal.txt to nvim_terminal_emulator.txt in vim-patch.sh.
2022-05-26 07:47:00 +08:00
dundargoc
b239db3cb5
feat(lintcommit): remove "chore", add "dist" #18594
"chore" is never necessary, choose "fix" or "feat" if nothing else applies.
2022-05-17 05:42:48 -07:00
Marco Hinz
b2799518c7
feat(terminfo): bump built-in terminfo entries (#18570)
Removes NOLINT, which is pointless for the generated terminfo_defs.h.

Adds `uncrustify:off`, so it is not uncrustify which complains about the same
things (too long lines, no space after comma) instead.
2022-05-16 01:45:34 +02:00
dundargoc
b1b5802009
build(gen_vimdoc): eliminate non-constant global variables (#17781) 2022-05-15 11:23:56 +02:00
dundargoc
2875d45e79
ci(commitlint): ignore "fixup" commits #18556 2022-05-13 05:37:33 -07:00
dundargoc
a1b663cce8
build(lua2dox): add parenthesis around parameter types in documentation (#18532)
This will check if the string after the variable in a @param is either
"number", "string", "table", "boolean" and "function" and if so add a
parenthesis around it. This will help separate the variable type with
the following text. Had all our functions been annotated with emmylua
then a more robust solution might have been preferable (such as always
assuming the third string is parameter type without making any checks).
I believe however this is a clear improvement over the current situation
and will suffice for now.
2022-05-12 08:02:46 -06:00
zeertzjq
3a91adabda
refactor: rename keymap.{c,h} to keycodes.{c,h} (#18535)
Most code in keymap.h is for keycode definitions, while most code in
keymap.c is for the parsing and conversion of keycodes.

The name "keymap" may also make people think these two files are for
mappings, while in fact keycodes are used even when no mappings are
involved, so "keycodes" should be a better file name than "keymap".
2022-05-12 20:19:29 +08:00
Sean Dewar
c24b442e31
fix(runtime/genvimvim): omit s[ubstitute] from vimCommand #18480
It's special cased by the vimSubst syntax group, and isn't present in Vim's
vimCommand group.

For example, this fixes `call s:Foo()` highlighting `:` as Error in Nvim, as the
`s` is parsed as vimCommand rather than as vimUserFunc since
`contains=vimCommand` was added to vimUserFunc (and vimFunc) in a rt update.

Interestingly, `g:`, `l:`, etc. have the same issues due to :global, :list, etc.
Vim also has that problem, so it should ideally be fixed upstream.

We could also omit g[lobal] from vimCommand and rely on vimGlobal instead, but
it doesn't work in some cases, like when there's a `:` before the command. Also,
Vim matches only `g` in vimCommand for some reason, which doesn't produce any
highlight for `:global/foo/bar` (with Nvim you at least get some highlights on
the `global` bit despite the leading `:`).

Also, remove special handling of :py3 in syntax/vim.vim, as the generator seems
to have no problems finding it.
2022-05-11 17:08:25 -07:00
Dundar Goc
59162584b1 build(gen_vimdoc): print user's doxygen version if it's too old
@theHamsta suggested in
https://github.com/neovim/neovim/pull/18348#discussion_r862594173 to
also print the users doxygen version if the version is too old.
2022-05-02 11:17:06 +02:00
Dundar Goc
649cdc14ba ci(gen_vimdoc): handle edge case when checking doxygen version
When checking the version of the doxygen installed from conda the output
has the following format:

1.9.2 (ee54ebd4f0ad83d9c44f19a459146de64d0ffba2*)

This would cause an error in the "Missing API docs" CI job. This fix
will correctly parse the doxygen version for both stable releases
("1.9.2") as well as the version with the git commit hash attached.
2022-05-02 10:58:40 +02:00
Dundar Goc
5fc251daeb build(gen_vimdoc): abort if doxygen version is too old
There have been a few instances where developers got confused as to why
their generated documentation differs from the one generated by the CI.
More often than not, the reason is that their doxygen version is older
than 1.9.0, which is the current minimum version. Having a simple
version check will help save future developers avoid this problem.
2022-05-01 18:05:12 +02:00
ii14
7502f1cae0
docs(api): more API attributes #18336 2022-04-30 16:16:16 -07:00
dundargoc
933274c438
fix/PVS #17863
* fix(PVS/V002): disable rule completely

V002: "Some diagnostic messages may contain incorrect line number in
this file." This particular check seems unreliable. It says on their
website https://pvs-studio.com/en/docs/warnings/v002/ that this warning
occurs when there are multiline pragmas, but there are none in
extmark.c.

* fix(PVS/V756): ignore "counter is not used inside a nested loop" warning

The nested loop starts with "AutoCmd *ac = ap->cmds" so "ap" is
definitely used.

* fix(PVS/V560): disable "a part of conditional expression is always true"

* fix(PVS/V614): potentially uninitialized variable 'blen' used
2022-04-24 18:51:22 -07:00
dundargoc
e63e5d1dbd
docs: typo fixes (#17859)
Co-authored-by: Elias Alves Moura <eliamoura.alves@gmail.com>
Co-authored-by: venkatesh <shariharanvenkatesh@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com>
Co-authored-by: Steve Vermeulen <sfvermeulen@gmail.com>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: rwxd <rwxd@pm.me>
Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com>
2022-04-15 12:35:06 +02:00
zeertzjq
8f95f3ea06
fix(vim-patch.sh): fix N/A files patterns (#18073) 2022-04-11 14:41:26 +08:00
Abraham Francis
0d2674a3c5
ci: add script to bump versions (#17884)
* ci: add script for bumping dependencies

* docs: add usage information for bump-deps.sh
2022-04-07 17:41:48 +02:00
Lewis Russell
00effff569
vim-patch:8.1.1693: syntax coloring and highlighting is in one big file (#17721)
Problem:    Syntax coloring and highlighting is in one big file.
Solution:   Move the highlighting to a separate file. (Yegappan Lakshmanan,
            closes vim/vim#4674)

f9cc9f209e

Name the new file highlight_group.c instead.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-18 12:47:08 +08:00
Daiki Mizukami
ecc36c3d1c
docs: remove extra whitespaces 2022-03-14 08:16:01 +09:00
Daiki Mizukami
be2def4100
chore(gen_vimdoc): fall back to brief_desc_node when desc_node is empty 2022-03-14 07:53:42 +09:00
Daiki Mizukami
334a16c791
refactor(gen_vimdoc): simplify files in CONFIG 2022-03-14 07:53:42 +09:00
Daiki Mizukami
cf4786ddfa
chore(gen_vimdoc): call delete_lines_below only if the file exists
Previously, `delete_lines_below` would raise `FileNotFoundError` when
adding a new file to `CONFIG` and you had to manually write a file with
help tag of the first section as placeholder. This change relieves you
of that need.
2022-03-14 07:53:41 +09:00
Daiki Mizukami
2d28c40ef9
refactor(gen_vimdoc): detect section_start_token automatically 2022-03-14 07:53:41 +09:00
Dundar Göc
46a0cec3a6 chore(stripdecls): remove unused and no longer functional script 2022-03-09 09:30:26 +01:00
zeertzjq
80e6f81862 docs(lua): reference runtime/lua/vim/_editor.lua 2022-03-06 22:32:22 +08:00
zeertzjq
0ec92bb463 feat(vim-patch.sh): support additional args for -s
This allows creating a draft vim-patch PR.
2022-03-05 10:12:17 +08:00
TJ DeVries
991e472881 feat(lua): add api and lua autocmds 2022-02-27 22:04:55 +01:00
Dundar Göc
f50a9a4288 ci(commitlint): allow first non-space character to be a quote 2022-02-11 20:02:50 +01:00
zeertzjq
4d349330a7 chore(vim-patch.sh): use piping instead of here string for while read
Using a here string can cause an error if there are no missing patches:
`./scripts/vim-patch.sh: line 580: runtime_commits: bad array subscript`

Using piping doesn't cause the error.
2022-02-08 10:08:17 +08:00
Dundar Göc
03e189d1a1 chore(gen_vimdoc): correct minimum python version 2022-02-05 13:36:27 +01:00
Dundar Göc
de672b6d7a chore(gen_vimdoc): remove duplicate extmark.c entry 2022-02-03 18:56:32 +01:00
shadmansaleh
6d41f65aa4 feat(lua): add vim.keymap
This introduces two new functions `vim.keymap.set` & `vim.keymap.del`

differences compared to regular set_keymap:
- remap is used as opposite of noremap. By default it's true for <Plug> keymaps and false for others.
- rhs can be lua function.
- mode can be a list of modes.
- replace_keycodes option for lua function expr maps. (Default: true)
- handles buffer specific keymaps

Examples:
```lua
vim.keymap.set('n', 'asdf', function() print("real lua function") end)
vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, {buffer=true})
vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", {silent = true, buffer = 5 })
vim.keymap.set('i', '<Tab>', function()
  return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>"
end, {expr = true})
vim.keymap.set('n', '[%', '<Plug>(MatchitNormalMultiBackward)')

vim.keymap.del('n', 'asdf')
vim.keymap.del({'n', 'i', 'v'}, '<leader>w', {buffer = 5 })
```
2022-01-04 22:31:59 +06:00
Gregory Anders
3fd454bd4a
feat: filetype.lua (#16600)
Adds a new vim.filetype module that provides support for filetype detection in
Lua.
2022-01-04 07:28:29 -07:00
Dundar Göc
167c10130c ci: fix shellcheck errors introduced in version 0.8.0
Solved following shellcheck warnings:
SC2030
SC2295
SC2015
2022-01-03 12:47:06 +01:00
Dundar Göc
89a844a9c7 ci: remove unused "squash typo" workflow 2021-12-20 23:47:04 +01:00
dundargoc
caa6992a10
chore: fix typos (#16361)
Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: István Donkó <istvan.donko@gmail.com>
Co-authored-by: Julian Berman <Julian@GrayVines.com>
Co-authored-by: bryant <bryant@users.noreply.github.com>
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com>
Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com>
Co-authored-by: Jesse Wertheim <jaawerth@gmail.com>
Co-authored-by: dm1try <me@dmitry.it>
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl>
Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: István Donkó <istvan.donko@gmail.com>
Co-authored-by: Julian Berman <Julian@GrayVines.com>
Co-authored-by: bryant <bryant@users.noreply.github.com>
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com>
Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com>
Co-authored-by: Jesse Wertheim <jaawerth@gmail.com>
Co-authored-by: dm1try <me@dmitry.it>
Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl>
Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
2021-11-27 11:10:48 -05:00
Michael Lingelbach
0746f0021f fix(docgen): add tagfunc.lua 2021-11-18 11:30:09 -07:00
Michael Lingelbach
9d6a475ced
fix(docs): add sync.lua to gen_vimdoc (#16285) 2021-11-11 07:23:52 -07:00
Sean Dewar
97ae0ab4d8
fix(vim-patch.sh): run nvim with -u NONE -n #16179
Problem:
Because of -u NORC, vim-patch.sh would hang on my machine due to one of my
plugins (start package) waiting for prompt input.

Solution:
- Use -u NONE instead to disable all plugins.
- Also use -n to disable swapfiles. These changes only apply to the --headless
  nvim instances used to process things.
2021-10-30 09:04:04 -07:00
Björn Linse
a60beeb34f refactor(api): break out Vim script functions to its own file 2021-10-29 16:59:53 +02:00
dundargoc
3e1ef18579
ci: add newly added api file extmark.c to gen-vimdoc (#16158) 2021-10-27 11:42:19 -06:00
Gregory Anders
dfef90a518
fix(gen_vimdoc.py): spacing around inline elements #16092
The spacing fix drew attention to a couple of places that were using
incorrect formatting such as the key listing for `nvim_open_win`, so
those were fixed too.
2021-10-19 12:55:22 -07:00
Dundar Göc
35c13620a1 ci: allow older git versions when using lintcommit
More specifically, use "git rev-parse --abbrev-ref HEAD" instead of "git
branch --show-current" to get current branch.
2021-10-14 10:13:56 +02:00
dundargoc
2f50c7b5a3
ci(squash_typos.py): credit authors #15967 2021-10-08 16:37:45 -07:00
Justin M. Keyes
dd7812ec66 fix(docs): add win_config.c 2021-10-05 09:56:22 -07:00
dundargoc
6d8cafed40
ci: exclude lua-cjson from PVS report #15859 2021-10-05 05:02:49 -07:00
Justin M. Keyes
c74a706869 fix(release.sh): ignore failed "rm" 2021-10-02 08:26:57 -07:00
zeertzjq
a3b5b4a31e
feat(vim-patch.sh): better detection of remote name #15846 2021-10-02 06:15:01 -07:00
Mathias Fußenegger
63fde086d9
feat(ui): add vim.ui.select and use in code actions (#15771)
Continuation of https://github.com/neovim/neovim/pull/15202

A plugin like telescope could override it with a fancy implementation
and then users would get the telescope-ui within each plugin that
utilizes the vim.ui.select function.

There are some plugins which override the `textDocument/codeAction`
handler solely to provide a different UI. With custom client commands and
soon codeAction resolve support, it becomes more difficult to implement
the handler right - so having a dedicated way to override the picking
function will be useful.
2021-09-27 21:57:28 +02:00
dundargoc
6736ee8be5
chore: remove unused script finddeclarations.pl #15814 2021-09-27 09:02:42 -07:00
dundargoc
3246bf5f4e
ci(lintcommit.lua): replace third-party commitlint #15747 2021-09-26 12:13:59 -07:00
Justin M. Keyes
03ed72642d fix(pvs): Exclude xdiff from analysis
ref 088161a945
ref fbe88ef8f5
2021-09-24 03:26:31 -07:00
Justin M. Keyes
508fcdadb7 fix(PVS): disable "typo" warnings V1051, V1074
PVS is worried about typos. Now we need it to stop worrying...
Disable these checks entirely, they are all false positives.

tui.c:1873        V1074   Boundary between escape sequence and string is unclear. The escape sequence ends with a letter and the next character is also a letter. Check for typos.
tui.c:1983        V1074   Boundary between escape sequence and string is unclear. The escape sequence ends with a letter and the next character is also a letter. Check for typos.

regexp_nfa.c:6189 V1051   Consider checking for misprints. It's possible that the 'pim->result' should be checked here.
screen.c:2928     V1051   Consider checking for misprints. It's possible that the 'vcol_sbr' should be checked here.
screen.c:3187     V1051   Consider checking for misprints. It's possible that the 'line_attr' should be checked here.
screen.c:3267     V1051   Consider checking for misprints. It's possible that the 'multi_attr' should be checked here.
screen.c:4747     V1051   Consider checking for misprints. It's possible that the 'redraw_next' should be checked here.
syntax.c:3448     V1051   Consider checking for misprints. It's possible that the 'arg_end' should be checked here.
syntax.c:3625     V1051   Consider checking for misprints. It's possible that the 'arg_end' should be checked here.
tui.c:1836        V1051   Consider checking for misprints. It's possible that the 'data->unibi_ext.set_cursor_style' should be checked here.
tui.c:1863        V1051   Consider checking for misprints. It's possible that the 'data->unibi_ext.set_cursor_style' should be checked here.
tui.c:1882        V1051   Consider checking for misprints. It's possible that the 'data->unibi_ext.set_cursor_style' should be checked here.
2021-09-24 03:22:26 -07:00
Justin M. Keyes
736299bf22 build(lint): check scripts/*.lua 2021-09-19 16:36:08 -07:00
Justin M. Keyes
6565adcbff
build(lint): commit linter #15725
Example test failure:

    $ nvim -es +"lua require('scripts.lintcommit')._test()"
    [ FAIL ]: expected=true, got=false
        input: ":no type before colon 1"
    [ FAIL ]: expected=true, got=false
        input: "ci: tab after colon"

Example main({trace=true}) output:

    $ nvim -es +"lua require('scripts.lintcommit').main()"
    run: { "git", "branch", "--show-current" }
    run: { "git", "merge-base", "origin/master", "master" }
    run: { "git", "merge-base", "upstream/master", "master" }
    run: { "git", "rev-list", "89db07556dbdce97c0c150ed7e47d80e1ddacad3..master" }
    run: { "git", "show", "-s", "--format=%s", "d2e6d2f5fc93b6da3c6153229135ba2f0b24f8cc" }
    Invalid commit message: "buildlint): commit linter #15620"
        Commit: d2e6d2f5fc93b6da3c6153229135ba2f0b24f8cc
        Invalid commit type "buildlint)". Allowed types are:
        { "build", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "test", "chore", "vim-patch" }
        See also:
            https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#commit-messages
            https://www.conventionalcommits.org/en/v1.0.0/
2021-09-19 12:57:57 -07:00
Justin M. Keyes
2aa662568a build(lint): commit linter #15620 2021-09-19 11:06:47 -07:00
dundargoc
65572c719a
build(lint): commit linter #15620 2021-09-19 09:27:08 -07:00
Justin M. Keyes
2e8103475e
Merge #15585 refactor: move vim.lsp.diagnostic to vim.diagnostic
## 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.
2021-09-16 14:23:42 -07:00
Gregory Anders
d140d3bd33
fix(docs): ignore _*.lua files from auto doc generation #15678 2021-09-16 10:49:11 -07:00
Gregory Anders
a5bbb932f9 refactor: move vim.lsp.diagnostic to vim.diagnostic
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
2021-09-15 14:09:47 -06:00
Christian Clason
c58a667e57 chore(vim-patch): add doc/vim9.txt to unwanted files 2021-09-10 13:20:11 +02:00
Gregory Anders
a422f2136a
docs(gen_vimdoc.py): ignore health.lua files #15614 2021-09-09 18:28:12 -07:00
Dundar Göc
9367aee62d ci: ensure all PRs are up to date with master before attempting squash
This is to ensure unrelated authors don't get credited.
2021-08-15 12:38:05 +02:00
James McCoy
084b28bec8
Merge pull request #15367 from jamessan/release-fixes
Clean up release handling
2021-08-14 21:22:13 -04:00
James McCoy
f027c5e1e4
build: update appdata.xml version in release commit
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]
2021-08-13 23:32:10 -04:00
dundargoc
222cd43222
ci: comment from bot is more helpful in case of conflict (#15359)
Also change PR title to follow conventional commits convention.
2021-08-13 15:58:31 +02:00
dundargoc
ce172d8d4a
ci: fix typo squasher by changing trigger to "pull_request_target" (#15357)
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.
2021-08-13 15:18:15 +02:00
dundargoc
7dbbd5d8b1
ci: create GitHub Action that squashes all typo PRs into a single PR (#15041)
The action adds all pull-request authors (and Marvim) as a co-author to the
newly created PR and also links to the closed PRs.
2021-08-09 15:21:50 +02:00
zeertzjq
545e05d2fe
chore(vim-patch.sh): replace hub with gh (#15162) 2021-08-03 19:52:48 +02:00
Dundar Göc
9f6989d551 chore: PVS/V1042 - ignore warning globally.
V1042 is a warning that a file has a copyleft license, which is an
irrelevant warning to open-source projects.
2021-07-17 17:27:17 +02:00
Matthieu Coudron
389cbe63bf chore: add log hander to gen_vimdoc
so it actually dumps output.
Plus a description of what it does in the argparser.
2021-07-10 17:55:45 +02:00
dundargoc
e8247bc739
lint (#14941)
Fix SC2155 error, found by shellcheck v0.7.2.

https://github.com/koalaman/shellcheck/wiki/SC2155
2021-07-01 12:37:03 -04:00
Daniel Steinberg
fe10a4e555
Open funcs_data.mpack in binary mode. (#14944)
"b" flag is required to read binary files on Windows. 
https://www.lua.org/pil/21.2.2.html
2021-06-30 18:17:48 -04:00
Daniel Steinberg
99a4152a4b
fix: Remove [RFC] from PR subject in vim-patch.sh (#14917)
As of PR #10383, CONTRIBUTING.md says '[RFC] is assumed by default'. As
of PR #11656, CONTRIBUTING.md says '**do not** put "RFC" in the PR
title'.
2021-06-28 20:40:00 -04:00
Jan Edmund Lazo
a72dfec855
release.sh: use stdin for release commit message (#14832)
v0.5.0 has too many commits since v0.4.0.
"git commit -m" triggers "Argument list too long" error.
2021-06-16 22:58:54 -04:00
Mathias Fussenegger
2bdd553c9e feat(lsp): Add codelens support 2021-06-14 21:45:14 +02:00
James McCoy
cf714bf418
vim-patch.sh -m: Ignore changes to version.c
[skip ci]
2021-05-19 22:50:05 -04:00
James McCoy
86d35bef13
fix(vim-patch.sh -m): Show all commits touching a file, not just the first
[skip ci]
2021-05-19 22:50:05 -04:00
TJ DeVries
27da5511a0
docs: Treesitter (#13260)
* doc & fixes: Generate treesitter docs

* fixup to treesitter-core

* docs(treesitter): fix docs for most functions

Co-authored-by: Thomas Vigouroux <tomvig38@gmail.com>
2021-05-01 08:19:48 -04:00
James McCoy
794a287846
fix(pvscheck): Switch URL to pvs-studio.com
[skip ci]
2021-04-29 20:04:29 -04:00
Matthieu Coudron
e55c27fc6e more generic shebang for lua2dox_filter
previous one was not working/ or use /bin/sh
2021-03-04 15:44:40 +01:00
Matthieu Coudron
513ac58043 fix: section_name must be a dict {filename:name}
else it was triggering an error during regeneration of the files.
2021-03-04 15:44:40 +01:00
Jan Edmund Lazo
4a1a86a2be
vim-patch.sh: remove unsupported files (#13570)
Add files listed in https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim#na-not-applicable-patches.
2021-02-03 18:53:27 -05:00
Jan Edmund Lazo
f3c242c13c
vim-patch:8.1.1241: Ex command info contains confusing information
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.
2021-01-01 04:30:55 -05:00
notomo
93ba977793 docs: add check_textlock attribute 2020-12-16 21:57:24 +09:00
James McCoy
2b594b9c81
Use vX.Y.Z-dev+{git-describe} for development versions 2020-12-06 21:01:11 -05:00
TJ DeVries
f75be5e9d5
lsp: vim.lsp.diagnostic (#12655)
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)
2020-11-12 22:21:34 -05:00
James McCoy
088161a945
pvs: Exclude xdiff from analysis and comment munging 2020-11-10 10:00:25 -05:00
James McCoy
65993c444a
Use the free PVS-Studio license
As of release 7.10, PVS Studio requires a license, even for the "check
me" comment based analyzing.
2020-11-10 09:42:28 -05:00
Thomas Vigouroux
3eb241d831
bundle: move tree-sitter as a bundled dep
fixup! bundle: move tree-sitter as a bundled dep

fixup! bundle: move tree-sitter as a bundled dep
2020-11-03 10:39:35 +01:00
Jan Edmund Lazo
442ad4bb63
fixup! rename: user_funcs -> userfunc 2020-11-01 13:22:52 -05:00
Jan Edmund Lazo
5db836bbca
fixup! eval.c: factor out eval/funcs.c #11828 2020-11-01 13:21:33 -05:00
Jan Edmund Lazo
ff11247837
fixup! refactor: move session functions to ex_session.c 2020-11-01 12:17:39 -05:00
Jan Edmund Lazo
074745d924
Fix shellcheck error SC2155
Close https://github.com/neovim/neovim/pull/11765
2020-10-15 22:51:19 -04:00
Daniel Hahler
82b09bc9d2
scripts/vim-patch.sh: include --shortstat with -m 2020-10-15 22:51:19 -04:00
James McCoy
ec057d40f3
Download emoji-data from UNIDATA/ 2020-10-04 11:50:29 -04:00
TJ DeVries
4a2618c817
doc: Add docs for uri functions (#12887) 2020-09-14 09:12:17 -04:00
James McCoy
b163a89925
vim-patch.sh: Fix PR subject with multiple patches 2020-09-04 08:46:46 -04:00
Justin M. Keyes
c2662210b5
docs, remove 'guifontset' #11708
- 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...).
2020-08-31 00:51:35 -07:00
Patrice Peterson
9d9edebceb gen_vimdoc: Allow to keep intermediary output 2020-08-23 13:48:27 +02:00
Patrice Peterson
ac05343a10 Add docs for most vim.lsp methods
Most of the lsp.log will be addressed in a separate PR.
2020-08-23 13:48:25 +02:00
jnozsc
44cbf288ec
script: simplify python version check (#12672) 2020-07-24 22:42:25 +02:00
TJ DeVries
7b529e7912
doc: fix scripts and regenerate (#12506)
* 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
2020-07-02 07:09:17 -04:00
Thomas Vigouroux
6b949211a0 treesitter: update runtime
Update to 81d533d2d1b580fdb507accabc91ceddffb5b6f0.
2020-06-03 21:33:34 +02:00
Thomas Vigouroux
662688817b treesitter: enhance script and add README
The script now updates a `treesitter_commit_sha.txt` file to keep track
of which commit/branch/tag we're at.
2020-06-02 23:13:42 +02:00
Thomas Vigouroux
f5fbe8e3b5 treesitter: add update script and update runtime
Update treesitter runtime to : 9a82dcc666d06617cbab3061467075019fae0b0d
2020-06-02 23:13:42 +02:00
Poh Zi How
ed815c61fd
vim-patch.sh: fix bash version-check message #12398 2020-05-31 10:27:05 -07:00
James McCoy
c37d9fa3da
Merge pull request #11764 from blueyed/vim-patch-usage 2020-05-15 10:45:10 -04:00
James McCoy
fdedaa7226
Merge pull request #12081 from xylix/bash-version-check 2020-04-21 22:35:31 -04:00
Kerkko Pelttari
f47e574c87 Apply suggestions from code review
Improve error message for unsupported bash version, use double square bracket operator

Co-Authored-By: Daniel Hahler <github@thequod.de>
2020-04-07 10:43:17 +03:00
Kerkko Pelttari
d26a66a2b3 Check for bash version in vim-patch.sh 2020-04-06 09:59:25 +03:00
James McCoy
dc7f59e04b
vim-patch.sh: Fix creation of commit list for PR review
[ci skip]
2020-03-31 22:40:33 -04:00
Daniel Hahler
1dc5e5ae9b doc 2020-01-26 15:20:51 +01:00
Daniel Hahler
20f5f44883 set -u before return
Follow up to a4d21f059.
2020-01-26 15:07:44 +01:00
Daniel Hahler
f755370682 scripts/vim-patch.sh: add -m to usage
Ref: https://github.com/neovim/neovim/pull/11514#issuecomment-569476828
2020-01-26 14:51:14 +01:00
Chris LaRose
c6ff23d7a0 terminal: absolute CWD in term:// URI #11289
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>
2020-01-26 00:24:42 -08:00
Jan Edmund Lazo
4c152be726
fixup! fixup! vim-patch.sh: list related missing Vim patches [ci skip] #11514 2020-01-19 10:05:23 -05:00
Justin M. Keyes
9231684986
doc [ci skip] #11656 2020-01-12 23:41:55 -08:00
Jan Edmund Lazo
a4d21f0592 vim-patch.sh: fix for bash 4.3 or older #11700 2020-01-11 12:09:54 -08:00
Justin M. Keyes
0dcf4bd3eb gen_vimdoc.py: rename mode to target 2019-12-31 15:39:17 -08:00
Justin M. Keyes
b112fe828f gen_vimdoc.py: generate LSP docs 2019-12-31 08:06:48 -08:00
Justin M. Keyes
c24f8f46b4 gen_vimdoc.py: sort by name 2019-12-30 03:31:32 -08:00
Justin M. Keyes
b81547ce6d gen_vimdoc.py: better handling of inline (non-block) nodes 2019-12-30 03:12:24 -08:00
Justin M. Keyes
27b678f577 gen_vimdoc.py: fix deprecated check 2019-12-30 00:15:49 -08:00
Jan Edmund Lazo
81a0d10f13
fixup! vim-patch.sh: list related missing Vim patches [ci skip] #11514 2019-12-29 18:34:04 -05:00
Daniel Hahler
5f1aec5abd Fix scripts/vim-patch.sh for Bash 4.3
Ref: https://github.com/neovim/neovim/pull/11514#issuecomment-568780231
2019-12-25 13:03:16 +01:00
Daniel Hahler
34abe8fd23 vim-patch.sh: list related missing Vim patches [ci skip] #11514
* 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`.
2019-12-24 08:15:18 +01:00
Daniel Hahler
2e280dac7d gen_vimdoc.py: lint #11593 2019-12-23 07:08:49 +01:00
Justin M. Keyes
781c708c27
Merge #11396 'gen_vimdoc.py: mpack result' [ci skip] 2019-12-22 05:40:31 +01:00
Justin M. Keyes
9ea7aeb308 gen_vimdoc.py: rename for clarity
- render_para => fmt_node_as_vimhelp
- Inline parse_parblock() in fmt_node_as_vimhelp()
2019-12-21 20:36:00 -08:00
Justin M. Keyes
4657819e80 gen_vimdoc.py: mpack: collect functions in 1 dict
All Nvim API, core Vimscript, and core Lua functions are globally
unique, so there is no need for per-module nested dicts.

BEFORE (generated mpack structure):
    [
      {
        "buffer.c": {
          "nvim__buf_stats": { ... },
          ...
        },
        "window.c": {
          "nvim_win_close": { ... },
          ...
        },
        ...
      }
    ]

AFTER (generated mpack structure):
    [
      {
        "nvim__buf_stats": {
          ...
        },
        "nvim_buf_attach": {
          ...
        },
        "nvim_tabpage_set_var": {
          ...
        },
        "nvim_ui_attach": {
          ...
        },
        "nvim_win_close": {
          ...
        }
      }
    ]
2019-12-21 20:36:00 -08:00
Justin M. Keyes
f968dad3bf gen_vimdoc.py: fix "seealso", "xrefs"
- Also fix xrefs ("Deprecated" section)
- Fix "Deprecated" rendering by a weird hack (see comment).
- Eliminate unnecessary use of render_para()
2019-12-21 20:36:00 -08:00
Justin M. Keyes
62e365f577 gen_vimdoc.py: mpack: exclude deprecated functions
The `mpack` variable was a tuple, which manifests as an array in the
generated msgpack structure.
- Removes noise from the mpack data (deprecated functions are
  deprecated).
- Eliminates 1 level of nesting.

BEFORE:
    [
      {
        "buffer.c": [
          {
            "nvim__buf_stats": { ... },
            ...
          },
          {
            "buffer_del_line": { ... },
            ...
          },
        ],
        ...
      }
    ]

AFTER:
    [
      {
        "buffer.c": {
          "nvim__buf_stats": { ... },
          ...
        },
        ...
    ]
2019-12-21 20:36:00 -08:00
Justin M. Keyes
481da1ce40 gen_vimdoc.py: fix mpack generator
- 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
2019-12-21 20:36:00 -08:00
Justin M. Keyes
01adb81c55 gen_vimdoc.py: DRY 2019-12-21 20:36:00 -08:00
Brian Wignall
001e69cd46 doc: fix typos
close #11459
2019-11-27 22:47:25 -08:00
Justin M. Keyes
f460bae441 release.sh [ci skip] 2019-11-24 17:53:33 -08:00
Justin M. Keyes
af53a0c012
doc: Lua [ci skip] #11378
- Rework :help lua-commands
- Rename if_lua.txt => lua.txt
2019-11-17 19:06:59 -08:00
smolck
4bd7881fce [scripts/gen_vimdoc.py] Generate better-formatted mpack
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': []
            }
        },
        ...
    ]
2019-11-15 20:00:13 -06:00
Marco Hinz
9fb278ddea
vim-patch.sh: multiline printf -> heredoc (#11351)
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.
2019-11-08 20:47:58 +01:00
Marco Hinz
2ba212e8c2
vim-patch.sh: add missing argument
[skip ci]
2019-11-08 15:18:01 +01:00
Justin M. Keyes
3e21d49836 Merge #11319 'inccommand: fix issues with modifiers and prompting' 2019-11-05 17:34:21 -08:00
erw7
90981f5861 update_version_stamp.lua: Use NUL on Windows #11323 2019-11-02 04:54:59 +09:00
Hirokazu Hata
f9da267373
scripts/lua2dox.lua: Remove class declaration block
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.
2019-10-27 11:58:28 +09:00