Commit Graph

117 Commits

Author SHA1 Message Date
Ashkan Kiani
d410812311 UI tweaks.
- Hide diagnostics on client exit
- Stop insert on popup focus.
- Hide popup on insertchar (for signature_help)
2019-11-23 16:14:24 -08:00
Ashkan Kiani
73487f4130 Improve the character_offset code. 2019-11-22 00:31:10 -08:00
Ashkan Kiani
78991ffbf4 Improve performance of util.set_lines + bugfix
Also permit character_offset for col past the end of line (useful in
range formatting).
2019-11-22 00:02:04 -08:00
Ashkan Kiani
a3d67dac5f Fix encoding translation in other places. 2019-11-21 16:23:12 -08:00
Ashkan Kiani
c055ca00ce Remove comments. 2019-11-21 15:55:45 -08:00
Ashkan Kiani
43d73ee884 Fix position params for encoding. 2019-11-21 15:41:32 -08:00
Ashkan Kiani
da07e71b18 Account for character length in jump position. 2019-11-21 15:34:28 -08:00
Ashkan Kiani
b27965538d Fix hovers staying on bufhidden 2019-11-21 15:20:32 -08:00
Ashkan Kiani
bcae04f6c6 Updates
- Use correct implementation of text_edits.
- Send indent options to rangeFormatting and formatting.
- Remove references to vim bindings and filetype from lsp.txt
- Add more examples to docs.
- Add before_init to allow changing initialize_params.
2019-11-21 15:19:06 -08:00
Ashkan Kiani
6a51401378 Merge remote-tracking branch 'origin/master' into lsp-followup 2019-11-21 10:04:32 -08:00
Björn Linse
76e0a8bd93 lsp: transmit "\n" after last line when 'eol' is set
Otherwise some servers like clangd will emit spurious
"no newline at end of file" warnings.
2019-11-21 11:12:57 +01:00
Ashkan Kiani
b7170f2d72 Remove resolve_bufnr/lualint 2019-11-20 20:59:52 -08:00
Ashkan Kiani
7bf766ad09 Use the apply_text_edits from util. 2019-11-20 20:59:12 -08:00
Ashkan Kiani
6d9f48ddcf Fix reference in rename. 2019-11-20 20:57:21 -08:00
Ashkan Kiani
6fc409d593 Add full text_edit implementation.
- Implements textDocument/formatting, textDocument/rangeFormatting,
workspace/applyEdit.
TODO:
- still has edge cases around replacement probably. Only tested with
inserts on the same position.
2019-11-20 20:51:44 -08:00
Ashkan Kiani
b984f613c1 Extend list_extend to take start/finish. 2019-11-20 17:09:21 -08:00
Ashkan Kiani
9b7f956715 Use err_message in default_callbacks 2019-11-20 16:39:45 -08:00
Ashkan Kiani
4c7ef3754a Satisfy lualint. 2019-11-20 16:37:23 -08:00
Ashkan Kiani
93beae4f31 Fix rename support. 2019-11-20 16:35:11 -08:00
Ashkan Kiani
1e16b3cf28 Spaces not tabs. 2019-11-20 16:16:36 -08:00
Ashkan Kiani
c40f8600d2 Change error writer to not be annoying. 2019-11-20 16:16:13 -08:00
Ashkan Kiani
03eb88848c Change callback resolution to be dynamic.
This allows default_callbacks to be specified after client creation to
be considered. Also it simplifies the code.
2019-11-20 16:09:03 -08:00
Ashkan Kiani
a4b7004f48 Move everything to buf & default_callbacks
- Rename builtin_callbacks to default_callbacks and slightly change its
semantics:
  - No longer contains the default implementations. Instead, any
  default_callbacks will be used in preference for our .buf methods.
  - Add this to the docs.
2019-11-20 16:03:32 -08:00
Ashkan Kiani
2d580756ca Add everything to lsp.buf and get rid of autoload. 2019-11-20 15:35:18 -08:00
Ashkan Kiani
c83380cf80 Add lsp.buf and hover implementation. 2019-11-20 14:21:57 -08:00
Ashkan Kiani
ff65cc990a Bugfix. Don't use nvim.lua that doesn't exist :) 2019-11-20 11:41:45 -08:00
Ashkan Kiani
568b454088 Add vim.uri_to_bufnr 2019-11-20 11:39:54 -08:00
Ashkan Kiani
0904ffe387 Bugfixes.
- Return after an error in RPC.
- Use an empty vim table for serialization.
2019-11-20 11:36:50 -08:00
Ashkan Kiani
3ae9b3781e Bugfix for floating_preview
Don't modify your inputs.
2019-11-20 11:34:10 -08:00
Ashkan Kiani
69a0712a9c Reduce code blocks in markdown previews.
If the preview is just a code block, then use the language as the
filetype instead of using markdown.
This reduces the size of the preview.
2019-11-20 11:23:50 -08:00
Ashkan Kiani
00dc12c5d8 lua LSP client: initial implementation (#11336)
Mainly configuration and RPC infrastructure can be considered "done". Specific requests and their callbacks will be improved later (and also served by plugins). There are also some TODO:s for the client itself, like incremental updates.

Co-authored by at-tjdevries and at-h-michael, with many review/suggestion contributions.
2019-11-13 21:55:26 +01:00
Justin M. Keyes
a0d992785f Lua: Use vim.validate() instead of assert() 2019-11-10 23:43:49 -08:00
Justin M. Keyes
7aa4042d3b Lua: vim.validate() 2019-11-10 23:43:49 -08:00
Hirokazu Hata
678a51b1da Lua: vim.validate()
We often want to do type checking of public function arguments.

- test: Rename utility_function_spec.lua to vim_spec.lua
- .luacov: Map lua module names
2019-11-10 22:50:24 -08:00
Björn Linse
474d0bcbf7 lua: vim.rpcrequest, vim.rpcnotify, vim.NIL 2019-11-10 13:08:05 +01:00
Hirokazu Hata
c2fc4255f9
runtime: Use module pattern with vim/shared.lua
It's a bit cumbersome for us to add an export target every time we define a new function.
It's also cumbersome to care about the order of definition when creating a new function by referring to other functions in the module.
2019-10-23 10:50:42 +09:00
Hirokazu Hata
996a057fb9 lua/stdlib: adjust some validation messages #11271
close #11271
2019-10-26 00:27:01 -07:00
Björn Linse
c844f986d4 tree-sitter: use "module" pattern in lua source 2019-09-28 17:46:25 +02:00
Björn Linse
f86a2c33a2 tree-sitter: simplify editing using the new old_byte_size parameter 2019-09-28 17:46:25 +02:00
Björn Linse
06ee45b9b1 tree-sitter: fix lint, delete "demo" plugin (replaced by functional tests) 2019-09-28 17:46:25 +02:00
Björn Linse
167a1cfdef tree-sitter: improve parser API (shared parser between plugins) 2019-09-28 14:55:43 +02:00
Björn Linse
d24dec596c tree-sitter: inspect language 2019-09-28 14:55:43 +02:00
Björn Linse
c8f861b739 tree-sitter: rename tree_sitter => treesitter for consistency 2019-09-28 14:55:43 +02:00
Björn Linse
4ea5e63aa8 tree-sitter: add basic testing on ci
build tree-sitter c parser on ci for testing purposes
2019-09-28 14:55:43 +02:00
Björn Linse
afba23099f tree-sitter: support pre-registration of languages 2019-09-28 14:55:43 +02:00
Björn Linse
1e9e2451be tree-sitter: objectify API 2019-09-28 14:55:43 +02:00
Björn Linse
005b6d638c tree-sitter: split tree-sitter lua interface from demo code 2019-09-28 14:55:43 +02:00
Björn Linse
0e0beef85e tree-sitter: load parsers as .so files 2019-09-28 14:31:03 +02:00
Björn Linse
cd10096386 tree-sitter: initial tree-sitter support 2019-09-28 14:31:03 +02:00
Justin M. Keyes
af946046b9 test: Rename meth_pcall to pcall_err
- Rename `meth_pcall`.
- Make `pcall_err` raise an error if the function does not fail.
- Add `vim.pesc()` to treat a string as literal where a Lua pattern is
  expected.
2019-09-06 17:19:07 -07:00
Kovas Palunas
fdd8dcae01 man.vim: Handle ANSI escape sequences with ":" #10267
closes #10267
2019-06-30 15:25:49 +02:00
Justin M. Keyes
4769deb36a
doc #10017
- gen_vimdoc.py: fancy "bullet"
- rework `:help channel-callback`
- rename `:help buffered` to `:help channel-buffered`
2019-05-25 10:00:41 +02:00
Justin M. Keyes
5b04a4fa09 lua/shared: share trim() impl 2019-05-20 23:46:56 +02:00
Justin M. Keyes
5c13f368c6 lint 2019-05-19 21:26:33 +02:00
Justin M. Keyes
fab81cfb04 lua/shared: share more stuff
Leave trim() in vim.lua, because gen_vimdoc.py needs at least one
function in there, else it gets confused...
2019-05-19 18:31:40 +02:00
Justin M. Keyes
e4c2d85c77 lua/shared: share deepcopy() with test/*
deepcopy() was duplicated in test/helpers.lua
2019-05-19 17:58:54 +02:00
Justin M. Keyes
e628c011bf gen_vimdoc.py: support lua/shared.lua module [ci skip] 2019-05-19 17:30:20 +02:00
Justin M. Keyes
9d7aaf7149 lua/shared: move table util funcs to vim.shared
Use `tbl_` prefix for all table-util functions. Specify in the function
docstring if it expects a list-like or map-like table.
2019-05-18 21:07:30 +02:00
Justin M. Keyes
bba75eb184 lua/stdlib: Introduce vim.shared
This is where "pure functions" can live, which can be shared by Nvim and
test logic which may not have a running Nvim instance available.

If in the future we use Nvim itself as the Lua engine for tests, then
these functions could be moved directly onto the `vim` Lua module.

closes #6580
2019-05-18 15:48:13 +02:00
KillTheMule
bb3aa824b7 lua/stdlib: vim.inspect, string functions
ref #6580
ref #8677
2019-01-14 02:14:34 +01:00
Justin M. Keyes
127b8569e6 lint 2018-12-20 11:57:30 +01:00
Justin M. Keyes
221f6fffad runtime/lua/vim/compat.lua
ref #9280
Introduce the `vim.compat` module, to help environments with system Lua
5.2+ run the build/tests. Include the module implicitly in all tests.

ref #8677
legacy `vim` module:
    beep
    buffer
    command
    dict
    eval
    firstline
    lastline
    line
    list
    open
    type
    window
2018-12-20 11:57:30 +01:00
Matěj Cepl
e6d0dea42b test: Lua 5.2/5.3 compat #9280
Make the code run both on Lua 5.1 (which is the default for Neovim, and
is what LuaJIT provides) and Lua 5.2+.
2018-12-20 11:57:30 +01:00
Filip Szymański
423d7af3df man.lua: avoid float conversion on lua 5.3 (#7851)
Error detected while processing function man#open_page[58]..<SNR>54_put_page:
    line    8:
    E5105: Error while calling lua chunk: /usr/share/nvim/runtime/lua/man.lua:165: Vim(let):E805: Using a Float as a Number
2018-01-15 20:14:27 +01:00
Gabriel Holodak
eb44519b5d Address PR comments 2017-12-27 23:28:04 -05:00
Gabriel Holodak
6740c94562 Add support for escape sequences 2017-12-27 23:27:14 -05:00
Gabriel Holodak
c28ce5f619 Switch to processing in Lua 2017-12-27 23:27:14 -05:00