aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
Commit message (Collapse)AuthorAge
...
* fix(lsp): don't attach a client in lsp.start() if there is none (#19328)Nicolas Hillegeer2022-07-11
| | | | | | | vim.lsp.start_client() may fail (for example if the `cmd` is not executable). It produces a nice error notification in this case. Passing the `nil` value returned from an erroneous `vim.lsp.start_client()` call into `vim.lsp.buf_attach_client()` causes a meaty param validate exception message. Avoid this.
* fix(lsp): abort pending changes after flush when debouncing (#19314)Rishikesh Vaishnav2022-07-11
| | | | | | | | | | | Issuing a server request triggers `changetracking.flush` so as to make sure we're not operating on a stale state. This immediately triggers notification of any pending changes (as a result of debouncing) to the server. However, this happens in addition to the notification that is waiting on the debounce delay. Because we `nil` `buf_state.pending_change` when it is called, the fix is to also check that this is non-`nil` when it is called and exit if it is, as this being `nil` would mean that it originates from a pending change that has already been flushed out.
* feat(lsp): defaults: tagfunc, omnifunc (#19003)Mathias Fußenegger2022-07-10
| | | set `tagfunc` to `vim.lsp.tagfunc` and `omnifunc` to `vim.lsp.omnifunc` if empty when attaching a server
* fix(lsp): pcall nvim_del_augroup_by_name (#19302)Christian Clason2022-07-10
| | | fixup for #19283
* vim-patch:9.0.0049: csv and tsv files are not recognized (#19300)Christian Clason2022-07-10
| | | | | | Problem: Csv and tsv files are not recognized. Solution: Add patterns fo csv and tsv files. (Leandro Lourenci, closes vim/vim#10680) https://github.com/vim/vim/commit/99af91e5820c78a196c9272cd8ce5aa5be7bf374
* refactor: remove functions marked for deprecation in 0.8 (#19299)Gregory Anders2022-07-09
|
* refactor(lua): replace vim.cmd use with API calls (#19283)Raphael2022-07-09
| | | Signed-off-by: Raphael <glephunter@gmail.com>
* feat(runtime)!: enable filetype.lua by default (#19216)Christian Clason2022-07-07
| | | | | | * revert to filetype.vim by setting `g:do_legacy_filetype` * skip either filetype.lua or filetype.vim via `g:did_load_filetypes` (Running both is no longer required and therefore no longer supported.)
* refactor(lua): reformat with stylua 0.14.0 (#19264)Christian Clason2022-07-07
| | | | * reformat Lua runtime to make lint CI pass * reduce max line length to 100
* fix(filetype): remove call to vim.fn.resolve and pass filename to match functionsmjonas2022-07-06
| | | | | For example on MacOS, /etc/hostname.file is symlinked to /private/etc/hostname.file. We only care about the original file path though.
* fix(filetype): fix filetype patternssmjonas2022-07-06
|
* vim-patch:9.0.0042: missing change for filetype detectionsmjonas2022-07-06
| | | | | | Problem: Missing change for filetype detection. Solution: Include change to detect guile from shebang line. https://github.com/vim/vim/commit/324478037923feef1eb8a771648e38ade9e5e05a
* vim-patch:9.0.0041: a couple of filetype patterns do not have "*" before "/etc"smjonas2022-07-06
| | | | | | Problem: A couple of filetype patterns do not have "*" before "/etc". Solution: Add the star. (Jonas Strittmatter, closes vim/vim#10662) https://github.com/vim/vim/commit/704988f0c3598c1b0cc47f3b46f1f1229312f2bc
* refactor(runtime): port scripts.vim to lua (#18710)Jonas Strittmatter2022-07-03
|
* vim-patch:9.0.0012: signature files not detected properly (#19172)Christian Clason2022-07-01
| | | | | Problem: Signature files not detected properly. Solution: Add a function to better detect signature files. (Doug Kearns) https://github.com/vim/vim/commit/cdbfc6dbab1d63aa56af316d6b13e37939e7f7a8
* fix(filetype): update call sites of vim.filetype.match (#19171)Gregory Anders2022-06-30
| | | These were not updated in #18895.
* fix(lsp): small bugs in snippet-parser #18998L3MON4D32022-06-29
| | | | | | | | | This fixes the following bugs: `${1:else_text}` -> format with if_text: "else_text" `${1:-else_text}` -> format with if_text: "else_text" `${1:}` in `format` (eg. empty else_text) -> error. `${1:}` (eg. empty placeholder) -> error. Thanks hrsh7th :)
* vim-patch:9.0.0006: not all Visual Basic files are recognized (#19153)Christian Clason2022-06-29
| | | | | Problem: Not all Visual Basic files are recognized. Solution: Change detection of *.cls files. (Doug Kearns) https://github.com/vim/vim/commit/8b5901e2f9466eb6f38f5b251e871f609f65e252
* vim-patch:9.0.0005: hare files are not recognized (#19151)Christian Clason2022-06-29
| | | | | Problem: Hare files are not recognized. Solution: Add a filetype pattern. (Hugo Osvaldo Barrera, closes vim/vim#10630) https://github.com/vim/vim/commit/040674129f3382822eeb7b590380efa5228124a8
* fix(vim.ui.input): accept nil or empty "opts" #191090x74696d6d792022-06-28
| | | Fix #18143
* fix(filetype): check for non-nil match in detect.rules (#19129)Christian Clason2022-06-27
|
* refactor(filetype): allow vim.filetype.match to accept buf and filename (#19114)Gregory Anders2022-06-27
| | | | | | | This is necessary in cases where filetype detection acts recursively. For example, when matching files that end with .bak, the "root" of the filename is matched again against the same buffer (e.g. a buffer named "foo.c.bak" will be matched again with the filename "foo.c", using the same underlying buffer).
* refactor(filetype)!: allow vim.filetype.match to use different strategies ↵Gregory Anders2022-06-26
| | | | | | | | | | | | | | | | | | | (#18895) This enables vim.filetype.match to match based on a buffer (most accurate) or simply a filename or file contents, which are less accurate but may still be useful for some scenarios. When matching based on a buffer, the buffer's name and contents are both used to do full filetype matching. When using a filename, if the file exists the file is loaded into a buffer and full filetype detection is performed. If the file does not exist then filetype matching is only performed against the filename itself. Content-based matching does the equivalent of scripts.vim, and matches solely based on file contents without any information from the name of the file itself (e.g. for shebangs). BREAKING CHANGE: use `vim.filetype.match({buf = bufnr})` instead of `vim.filetype.match(name, bufnr)`
* fix(filetype.lua): always return a string in getlines function (#19080)Hazel Weakly2022-06-24
| | | | This re-introduces the fix that the filetype.lua refactor inadvertently reverted. The fix ensures that in the case when end_lnum is omitted, a string is always returned.
* refactor(runtime): refactor filetype.lua (#18813)Jonas Strittmatter2022-06-21
| | | | Move some filetype detection functions to detect.lua, sort patterns by detected filetype.
* refactor: use nvim_{get,set}_option_value for vim.{b,w}oGregory Anders2022-06-20
| | | | | | | | | | | | | | | | | | | `nvim_get_option_value` and `nvim_set_option_value` better handle unsetting local options. For instance, this is currently not possible: vim.bo.tagfunc = nil This does not work because 'tagfunc' is marked as "local to buffer" and does not have a fallback global option. However, using :setlocal *does* work as expected :setlocal tagfunc= `nvim_set_option_value` behaves more like :set and :setlocal (by design), so using these as the underlying API functions beneath vim.bo and vim.wo makes those two tables act more like :setlocal. Note that vim.o *already* uses `nvim_set_option_value` under the hood, so that vim.o behaves like :set.
* fix(treesitter): new iter if foldedkevinhwang912022-06-16
|
* fix(lua): highlight.on_yank can close timer in twice #18976notomo2022-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Steps to reproduce: 1. setting `vim.highlight.on_yank` ``` vim.api.nvim_create_autocmd({ "TextYankPost" }, { pattern = { "*" }, callback = function() vim.highlight.on_yank({ timeout = 200 }) end, }) ``` 2. repeat typing `yeye` ... 3. causes the following error. ``` Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x01e96970 is already closing stack traceback: [C]: in function 'close' vim/_editor.lua: in function '' vim/_editor.lua: in function <vim/_editor.lua:0> ``` 📝 Test result before fix: [----------] Global test environment setup. [----------] Running tests from test/functional/lua/highlight_spec.lua [ RUN ] vim.highlight.on_yank does not show errors even if buffer is wiped before timeout: 15.07 ms OK [ RUN ] vim.highlight.on_yank does not show errors even if executed between timeout and clearing highlight: 15.07 ms ERR test/helpers.lua:73: Expected objects to be the same. Passed in: (string) 'Error executing vim.schedule lua callback: vim/_editor.lua:0: handle 0x02025260 is already closing stack traceback: [C]: in function 'close' vim/_editor.lua: in function '' vim/_editor.lua: in function <vim/_editor.lua:0>' Expected: (string) ''
* docs: fix typos (#18866)dundargoc2022-06-15
| | | | | | | docs: fix typos and similarly insignificant changes Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: smjonas <jonas.strittmatter@gmx.de> Co-authored-by: kanreki <32443233+kanreki@users.noreply.github.com>
* feat(lsp): sort codelens if multiple item per line (#18951)rhcher2022-06-13
|
* feat(filetype): remove side effects from vim.filetype.match (#18894)Gregory Anders2022-06-09
| | | | | | | | Many filetypes from filetype.vim set buffer-local variables, meaning vim.filetype.match cannot be used without side effects. Instead of setting these buffer-local variables in the filetype detection functions themselves, have vim.filetype.match return an optional function value that, when called, sets these variables. This allows vim.filetype.match to work without side effects.
* fix(diagnostic): check for negative column value (#18868)mohsen2022-06-08
|
* refactor(runtime): port remaining patterns from filetype.vim to filetype.lua ↵Jonas Strittmatter2022-06-06
| | | | (#18814)
* fix(lsp): fix multi client handling in code action (#18869)Mathias Fußenegger2022-06-05
| | | Fixes https://github.com/neovim/neovim/issues/18860
* perf(tests): don't invoke nvim_get_all_options_info until neededbfredl2022-06-05
| | | | | This call alone is responible of 40 000 000 out of 80 000 000 individual alloc/free calls in the test suite.
* fix(lsp): set buflisted before switching to buffer (#18854)zeertzjq2022-06-04
|
* vim-patch:8.2.5054: no good filetype for conf files similar to dosini (#18851)Christian Clason2022-06-04
| | | | | Problem: No good filetype for conf files similar to dosini. Solution: Add the confini filetype. (closes vim/vim#10510) https://github.com/vim/vim/commit/635f48010dcf6d97f3a65b4785e1726ad386d3eb
* docs: fix typos (#18269)dundargoc2022-06-04
| | | | | | | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Dan Sully <dan+github@sully.org> Co-authored-by: saher <msaher.shair@gmail.com> Co-authored-by: Stephan Seitz <stephan.seitz@fau.de> Co-authored-by: Benedikt Müller <d12bb@posteo.de> Co-authored-by: Andrey Mishchenko <mishchea@gmail.com> Co-authored-by: Famiu Haque <famiuhaque@protonmail.com> Co-authored-by: Oliver Marriott <hello@omarriott.com>
* fix(filetype): fix typo in starsetf function (#18856)Gregory Anders2022-06-03
|
* feat(lsp): send didChangeConfiguration after init (#18847)Mathias Fußenegger2022-06-03
| | | | | | | Most LSP servers require the notification to correctly load the settings and for those who don't it doesn't cause any harm. So far this is done in lspconfig, but with the addition of vim.lsp.start it should be part of core.
* feat(lsp): add a start function (#18631)Mathias Fußenegger2022-06-03
| | | | | | | | | | | | A alternative/subset of https://github.com/neovim/neovim/pull/18506 that should be forward compatible with a potential project system. Configuration of LSP clients (without lspconfig) now looks like this: vim.lsp.start({ name = 'my-server-name', cmd = {'name-of-language-server-executable'}, root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]), })
* fix(treesitter): correct region for string parser (#18794)Christian Clason2022-06-02
| | | fixes injections for string parsers after https://github.com/neovim/neovim/commit/eab4d03a3264b2afaf803ed839fa25bc4e7acedd
* fix(lua): stop pending highlight.on_yank timer, if any (#18824)Wsevolod2022-06-02
| | | | | When yanking another range while previous yank is still highlighted, the pending timer could clear the highlight almost immediately (especially when using larger `timeout`, i.e. 2000)
* fix(lsp): adjust offset encoding in lsp.buf.rename() (#18829)Fredrik Ekre2022-06-01
| | | | | | | | Fix a bug in lsp.buf.rename() where the range returned by the server in textDocument/prepareRename was interpreted as a byte range directly, instead of taking the negotiated offset encoding into account. This caused the placeholder value in vim.ui.input to be incorrect in some cases, for example when non-ascii characters are used earlier on the same line.
* fix(checkhealth): skip vim.health #18816Javier Lopez2022-06-01
| | | | | | | | | | | | | | | | | | Problem: https://github.com/neovim/neovim/pull/18720#issuecomment-1142614996 The vim.health module is detected as a healthcheck, which produces spurious errors: vim: require("vim.health").check() ======================================================================== - ERROR: Failed to run healthcheck for "vim" plugin. Exception: function health#check, line 20 Vim(eval):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field 'check' (a nil value) stack traceback: [string "luaeval()"]:1: in main chunk Solution: Skip vim.health when discovering healthchecks.
* feat(fs): add vim.fs.normalize()Gregory Anders2022-05-31
|
* feat(fs): add vim.fs.find()Gregory Anders2022-05-31
| | | | | This is a pure Lua implementation of the Vim findfile() and finddir() functions without the special syntax.
* feat(fs): add vim.fs.dir()Gregory Anders2022-05-31
| | | | | This function is modeled after the path.dir() function from Penlight and the luafilesystem module.
* feat(fs): add vim.fs.basename()Gregory Anders2022-05-31
|
* feat(fs): add vim.fs.dirname()Gregory Anders2022-05-31
|