Commit Graph
65 Commits
Author SHA1 Message Date
TJ DeVriesandChristian Clason b80651eda9 feat(api): nvim_clear_autocmd
Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2022-03-31 14:30:42 +02:00
TJ DeVries 7fb2310edb fix: set nested before executing callback (#17801) 2022-03-30 17:59:36 +02:00
TJ DeVries 4f007a7f65 fix: do not pass aucmd to the callback (#17650) 2022-03-08 16:27:11 +00:00
TJ DeVries 0f613482b3 feat(lua): add missing changes to autocmds lost in the rebase
Note: some of these changes are breaking, like change of API signatures
2022-02-28 19:53:50 +01:00
TJ DeVries 991e472881 feat(lua): add api and lua autocmds 2022-02-27 22:04:55 +01:00
TJ DeVries 2bcf18deaa Merge pull request #14779 from tjdevries/tjdevries/vim_opt_fixes
An assortment of various vim.opt fixups.
2021-06-29 10:24:41 -04:00
TJ DeVries 19b7cef0a7 fix(vim.opt): Fix #14828 with empty values being incorrectly inserted 2021-06-29 09:18:59 -04:00
TJ DeVries 6ecec87c09 fix(vim.opt): Fix #14668 Now correctly handles unescaped commas in isfname style 2021-06-29 08:42:07 -04:00
TJ DeVries 9119ea1bec fix(vim.opt): Fix #14669 whichwrap now acts as expected 2021-06-29 08:42:07 -04:00
TJ DeVries 1d3ee1c441 fix(vim.opt): #14708 Now lets you put duplicate values in wildmode 2021-06-29 08:42:07 -04:00
TJ DeVries 43956dea55 lua: Add vim.opt and fix scopes of vim.o (#13479)
* lua: Add vim.opt

* fixup: cleaning

* fixup: comments

* ty clason

* fixup: comments

* this is the last commit. period.
2021-05-28 17:24:48 +02:00
TJ DeVriesandThomas Vigouroux 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
TJ DeVries d50f99f08b fixup: remove unused test function 2021-03-31 18:09:03 +02:00
TJ DeVries 06c065469b ts: Add per-language highlight links 2021-03-31 18:09:00 +02:00
TJ DeVries 240cec9192 ts: Add language version to vim.treesitter (#14255) 2021-03-30 16:40:29 -04:00
TJ DeVries d6209a7b84 fixup: Add a test and it is so pretty 2021-03-30 10:57:38 -04:00
TJ DeVries 04fb94cd80 ts: Add per-language query overriding 2021-03-30 08:25:11 -04:00
TJ DeVries 875979ec3f lsp: Unopened buffers return 0 for line count, which leads to broken positions 2021-03-22 10:22:23 -04:00
TJ DeVries 880fb0d146 lsp: Force re-display of diagnostics when opening a file 2021-03-22 10:21:56 -04:00
TJ DeVriesandJan Dammshäuser 564dd7d8db lsp: get_language_id (#14092)
* Allow specifying a languageId for a lsp

For some languages the filetype might not match the languageId the
language server accepts. In these cases the config for the language
server can contain a function which gets the current buffer and filetype
and returns a languageId. When it isn't provided the filetype is used
instead.

Example:
```lua
require'lspconfig'.sourcekit.setup{
    get_language_id = function(bufnr, ft)
        return 'swift'
    end;
}
```

Closes #13093

* lsp: Change to get_language_id

Co-authored-by: Jan Dammshäuser <mail@jandamm.de>
2021-03-10 16:53:23 -05:00
TJ DeVries 901dd79f6a feat: add completion to ':lua' 2021-01-26 17:04:31 -08:00
TJ DeVries 9f3b2a757b lsp: Add severity_limit for other diagnostics features (#13528)
* lsp: Add severity_limit for other diagnostics

* docs and tests

* fix: lint

* Add to other types

* fix: lint
2021-01-12 12:58:50 -05:00
TJ DeVries e0a4399adc fix(lsp): Allow subsequent text document edits to pass (#13534)
* fix: Allow subsequent text document edits to pass

* fixup: cleaner code

* add tests
2021-01-11 11:39:11 -05:00
TJ DeVries 7718826edf docs: nvim_buf_set_text 2021-01-01 14:24:40 -05:00
TJ DeVries 08ec36efaf feat: Allow incremental sync & lsp flags (#13371) 2020-12-08 21:09:33 -05:00
TJ DeVries ced951c2aa api/options: fixup 2020-12-04 13:29:44 +01:00
TJ DeVries 35767912bb api/options: add option metadata 2020-12-04 13:29:27 +01:00
TJ DeVries 7574918dc7 vim-patch:8.1.0825: code for autocommands is mixed with file I/O code (#13305) 2020-11-24 14:53:38 -05:00
TJ DeVries 2f8eaad6d8 fix: NULL segfaults brought to you by @vigoux 2020-11-18 11:16:38 -05:00
TJ DeVries 35325ddac0 doc: fixup sign information (#13281)
Thanks to @sunzoje for finding the outdated documentation.
2020-11-13 00:02:40 -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
TJ DeVries dc14b1468a lsp: remove vim.NIL from processing (#13174)
* lsp: remove vim.NIL from processing

* lsp: remove instances of vim.NIL
2020-11-02 08:50:44 -05:00
TJ DeVries 98024853f4 lsp: Remove snippet lies (#13183)
We don't actually support snippets in core in the way that users would
truly expect. So, by default, we will not say that builtin-lsp has
`snippetSupport`.

To re-enable, users can do the following:

First, get a capabilities dictionary with

`local capabilities = vim.lsp.protocol.make_client_capabilities()`

Then override

`capabilities.textDocument.completion.completionItem.snippetSupport = true`

and then pass those capabilties to the setup function.

```
nvim_lsp.server_name.setup {
  ...,
  capabilities = capabilities,
  ...,
}
```

See https://github.com/neovim/neovim/issues/12795
2020-10-30 10:58:12 -04:00
TJ DeVries a83b76790b fixup: fixup: fixup: fixup: 2020-10-22 16:21:35 -04:00
TJ DeVries 7fca3ddcca fixup: some small nit picks 2020-10-22 16:08:32 -04:00
TJ DeVries 1afe6dd2f4 fixup: bfredl comments 2020-10-22 16:08:32 -04:00
TJ DeVries 78556aba7d api: nvim_buf_delete 2020-10-22 16:08:32 -04:00
TJ DeVries 0ad5b34170 Merge pull request #12053 from tjdevries/tjdevries/nicer_validate
vim.validate(): include stacktrace in message
2020-10-17 16:47:18 -04:00
TJ DeVries 7b89353985 lua: vim.wait allows control of fast events (#13053)
* lua: vim.wait allows control of fast events

* fixup: remove requirement of function for easier waiting

* fixup: lint

* fixup: bfredl comments
2020-10-06 12:58:05 -04:00
TJ DeVries aad7a74053 vim.validate(): include stacktrace in message 2020-10-05 09:47:59 -04:00
TJ DeVries 4a2618c817 doc: Add docs for uri functions (#12887) 2020-09-14 09:12:17 -04:00
TJ DeVries d8e6a0396a docs: update (#12860) 2020-09-06 19:55:49 -04:00
TJ DeVries 43202964f3 Merge pull request #12708 from runiq/lsp-doc
Add docs for some methods in vim.lsp
2020-08-25 09:52:22 -04:00
TJ DeVriesandAshkan Kiani 3ccdbc570d lua: add vim.register_keystroke_callback (#12536)
* feat: Add vim.register_keystroke_callback

* fixup: Forgot to remove mention of old option

* fixup: Answer jamessan comments

* fixup: Answer norcalli comments

* fixup: portability

* Update runtime/doc/lua.txt

Co-authored-by: Ashkan Kiani <ashkan.k.kiani@gmail.com>
2020-08-14 10:03:17 -04:00
TJ DeVries aa48c1c724 Merge pull request #12739 from vigoux/ts-refactor-predicates
treesitter: refactor
2020-08-14 08:33:50 -04:00
TJ DeVries e797d0658c fix: runtimepath always updates lua package.path 2020-08-10 16:48:35 -04:00
TJ DeVries 398201cfab lua: Fix crash on unprotected lua errors (#12658)
Can be reproduced with a script like this:

-- in some lua file
vim.fn.timer_start(10, function() error("uh....") end)

-- will cause neovim to crash with the following error.
PANIC: unprotected error in call to Lua API
        (nlua_CFunction_func_call failed.)

After this, it will instead print the error message
from the top of the stack, like so.

tmp/error_nvim.lua:10: uh...

Also added an example test. Previously this test
caused the embedded nvim to panic.
2020-07-19 17:16:48 -04:00
TJ DeVries 1ca67a73c0 Merge pull request #12507 from tjdevries/tjdevries/viml_lua_callbacks
[RFC] Allow passing lua functions and closures into vim functions.
2020-07-11 17:40:31 -04:00
TJ DeVries 6360cf7ce8 lua: Add ability to pass tables with __call
vim-patch:8.2.1054: not so easy to pass a lua function to Vim
vim-patch:8.2.1084: Lua: registering function has useless code

I think I have also opened up the possibility for people to use these
callbacks elsewhere, since I've added a new struct that we should be
able to use.

Also, this should allow us to determine what the state of a list is in
Lua or a dictionary in Lua, since we now can track the luaref as we go.
2020-07-10 20:23:12 -04:00
TJ DeVries 971a191c4d lua: Add ability to pass lua functions directly to vimL 2020-07-10 16:17:33 -04:00
TJ DeVries a695da7d3f Merge pull request #12590 from nvim-treesitter/ts-fix-highlight
[RDY] Treesitter: fix highlight, attempt 2
2020-07-10 12:58:44 -04:00
TJ DeVries b39edb5b60 doc: Add information about lua function calls (#12574) 2020-07-08 10:42:34 -04: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
TJ DeVries 25aa2969f2 Merge pull request #12497 from leun4m/patch/tex-runtime
Apply several upstream changes to text-runtime
2020-06-18 07:31:24 -04:00
TJ DeVries d14298a1f0 test: remove flaky unhelpful test
vim.wait( sthg)
2020-06-06 01:11:12 +02:00
TJ DeVries dd4018947c lsp: do not process diagnostics for unloaded buffers (#12440) 2020-06-04 19:37:38 -04:00
TJ DeVries b8e2cd4f60 Merge pull request #12348 from tjdevries/luawait
[RFC] lua: Add vim.wait()
2020-05-30 12:56:02 -04:00
TJ DeVries be662fe5c7 lua: vim.wait implementation 2020-05-30 12:01:32 -04:00
TJ DeVries a6be7a9180 doc: Vim internal variables & options in lua (#12302)
* doc: Add info about vim dicts in lua

* doc: preamble and info

* doc: remove weird spacing

* fixup
2020-05-17 23:29:34 -04:00
TJ DeVries 1407899c32 lua: Add buffer, window and tab accessors (#12268)
* Add buffer, window and tab accessors

* Fix deletion and add tests
2020-05-07 15:22:24 -04:00
TJ DeVries 45626de63f get_keymap API (#6236)
* Add api function get keymap

nvim_get_keymap(mode)
nvim_buf_get_keymap(buffer, mode)
2017-05-25 12:41:53 +02:00
TJ DeVries 19646a2985 health.vim: 'guicursor' advice #6506
Also:
- Mark provider sections as "(optional)".
- Fix help-link substitution to support single-quoted tags.
2017-04-20 22:44:51 +02:00
TJ DeVries 2cc523c3af CheckHealth
- Use execute() instead of redir
- Fixed logic on suboptimal pyenv/virtualenv checks.
- Move system calls from strings to lists. Fixes #5218
- Add highlighting
- Automatically discover health checkers
- Add tests

Helped-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Helped-by: Tommy Allen <tommy@esdf.io>

Closes #4932
2016-08-21 21:25:33 -04:00
TJ DeVries aa22b5fd9a Add new functionality to the = marker in the STL
This new functionality is explained in the documentation.

Also, many tests have been added to the buffer_spec.lua file
2016-06-14 20:10:11 +02:00
TJ DeVries e355624748 Fix style according to linter 2016-06-09 15:47:35 +02:00