Commit Graph

117 Commits

Author SHA1 Message Date
Mathias Fussenegger
38201650cd LSP: Remove diagnostic message handling in locations_to_items
`locations_to_items` is for turning `Location[]` into items, not for
`Diagnostic[]`
2020-02-27 12:50:12 +01:00
Mathias Fussenegger
220a2b05c6 LSP/references: Add context to locations returned by server
This changes the `textDocument/references' callback to annotate the
locations returned by the server with the content present at the
locations range.

The quickfix list then looks as follows:

    cr8/insert_fake_data.py|17 col 32| from .misc import parse_table, parse_version
    cr8/insert_fake_data.py|43 col 15| version = parse_version(r['rows'][0][0])
    cr8/java_magic.py|8 col 22| from cr8.misc import parse_version
    cr8/java_magic.py|30 col 19| version = parse_version(fst)
    cr8/java_magic.py|33 col 16| return parse_version(version_str)

Instead of:

    cr8/insert_fake_data.py|17 col 32|
    cr8/insert_fake_data.py|43 col 15|
    cr8/java_magic.py|8 col 22|
    cr8/java_magic.py|30 col 19|
    cr8/java_magic.py|33 col 16|
2020-02-27 12:49:49 +01:00
Björn Linse
52124f286c
Merge pull request #11880 from bfredl/tree-sitter-regex
add regex support in treesitter queries
2020-02-27 12:28:47 +01:00
Alvaro Muñoz
83add102cf
Add signs for Lsp diagnostics (#11668)
* Add signs for Lsp diagnostics
* defer sign definition until init.vim is loaded
2020-02-27 12:12:53 +01:00
Mathias Fußenegger
cb8b9428ca
LSP/hover: Do not throw away contents if first line is empty (#11939)
haskell-ide-engine sends `hover` payloads as follows:

    {
      contents = {
        kind = "markdown",
        value = "\n```haskell\nfoo :: Either String (Integer, Text)\n```\n`foo` *local*"
      },
      range = {
        end = {
          character = 5,
          line = 57
        },
        start = {
          character = 2,
          line = 57
        }
      }
    }

`value` starts with `\n`. The logic in `convert_input_to_markdown_lines`
threw away the whole information.
2020-02-27 00:00:06 +01:00
Alvaro Muñoz
ad745f9da2
add support to show diagnostics count in statusline (#11641)
* add support to show diagnostics count in statusline
* documentation
2020-02-26 20:22:14 +01:00
Alvaro Muñoz
ca8699378c
LSP: implement documentHighlight (#11638)
* implement documentHighlight
* fix bug
* document highlight groups
* use uppercase for help section title
* documentation
2020-02-26 20:10:16 +01:00
Björn Linse
9c00fea585 lua: add regex support, and @match support in treesitter queries 2020-02-26 19:39:02 +01:00
Björn Linse
08af82b9cb treesitter: redraw on changed query 2020-02-26 19:39:02 +01:00
Mathias Fußenegger
ff1730373c
lsp/completion: show duplicates in completion popup #11920
Allow duplicates so that in languages with overloaded functions it will
show all signatures.

E.g. instead of having a single (last one wins)

    add(int index, String element)

It shows all signatures:

    add(String e) : boolean
    add(int index, String element) : void
2020-02-21 00:34:07 -08:00
Hirokazu Hata
f3d4ddd0f8
lsp: make functions private and use filter function 2020-02-19 07:39:56 +09:00
Hirokazu Hata
c1bfc8093f
lsp: respect the sort order if there is sortText 2020-02-19 07:27:35 +09:00
Hirokazu Hata
4ac376740c
lsp: fix textDocument/completion handling
fix: #11826
Some lanuguage servers return complementary candidates whose prefixes do not match are also returned.
So we exclude completion candidates whose prefix does not match.
ex) Microsoft python-language-server, rust-analyzer
2020-02-19 07:27:29 +09:00
Hirokazu Hata
e2ed8053bf
lua: move test helper function, map and filter, to vim.shared module 2020-02-18 17:43:10 +09:00
Justin M. Keyes
a446fbc8fa lsp/rpc.lua: fix env application function
Env vars must be merged with the current env.
2020-02-16 22:09:28 -08:00
Justin M. Keyes
1eb0f5371a LSP: fix validate_client_config
- `cmd_env` is a table not a function.
- tests: Set $NVIM_LOG_FILE for fake LSP server.
2020-02-16 17:53:33 -08:00
Hirokazu Hata
c230c7d1a6
lua: if second argument is vim.empty_dict(), vim.tbl_extend uses empty_dict() instead of {} 2020-02-14 19:35:46 +09:00
Hirokazu Hata
417fc6ccf7
lua: vim.deepcopy uses empty_dict() instead of {} for empty_dict()
fix: https://github.com/neovim/nvim-lsp/issues/94
2020-02-13 11:55:43 +09:00
Matthieu Coudron
58ec72f9fd
LSP: rename validate_command to _cmd_parts #11847
and now only accepts a list of strings (instead of string or list).
2020-02-11 21:48:25 -08:00
Jesse-Bakker
5d5b068d5b
LSP: Refine formatting tabSize #11834
Use the logic explained in the softtabstop help section for defining
the tabSize parameter in formatting requests. This means that:

 - if softtabstop is 0, tabstop is used
 - if softtabstop < 0, shiftwidth is used
 - if softtabstop > 0, softtabstop is used

When inserting spaces instead of tabs, softtabstop is used in vim.
Therefor it would be more logical to use it when formatting instead
of the current tabstop.
2020-02-10 22:53:14 -08:00
Björn Linse
95fd28f4a1 treesitter: use internal "decorations" buffer 2020-02-10 13:10:15 +01:00
Mathias Fußenegger
174f7a2980 lsp: Support text edit on inactive buffer (#11843)
Using `vim.lsp.buf.rename()` can result in receiving a TextEdit that
affects a file for which there is no active or loaded buffer.

In that case `api.nvim_buf_get_lines(...)` returned an empty result,
leading to an error.

Closes https://github.com/neovim/neovim/issues/11790
2020-02-10 09:05:42 +09:00
Hirokazu Hata
dd8b29cfe2
LSP: set InitializeParams.rootPath value #11838
InitializeParams.rootPath is deprecated now. But some language servers still use it.
2020-02-08 22:51:02 -08:00
Björn Linse
00c57c98df treesitter: add standard &rtp/parser/ search path for parsers 2020-02-07 09:22:55 +01:00
Matthieu Coudron
e956ea7672 LSP: show diagnostic in qf/loclist #11777
instead of the content of the file at this line.

ref https://github.com/neovim/nvim-lsp/issues/69
2020-01-28 01:45:25 -08: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
Justin M. Keyes
9231684986
doc [ci skip] #11656 2020-01-12 23:41:55 -08:00
Justin M. Keyes
0a1c6d9a37 LSP: highlight groups test, doc 2020-01-08 22:18:18 -08:00
Alvaro Muñoz
e616ec4394 LSP: differentiate diagnostic underline by severity 2020-01-08 08:50:02 -08:00
Ville Hakulinen
c241395b3d LSP: place hover window by vertical space #11657
Make the hover window position itself vertically wherever is the most
space available.
2020-01-03 04:39:25 -08:00
Björn Linse
ea4127e9a7 lua: metatable for empty dict value 2020-01-01 19:26:29 +01:00
Justin M. Keyes
ac6ebfcc1d LSP: eliminate lsp.print_debug_info…()
Reduce API surface.  We should not add functions unless they are really
needed.  Users should be nudged to use vim.inspect() directly.
2019-12-31 15:39:17 -08:00
Justin M. Keyes
8b84119650 LSP: eliminate lsp.stop_all_clients()
Reduce API surface.  We don't need so many variations of functions. Too
many functions means verbose, largely redundant documentation, tests,
and cognitive burden.
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
Ashkan Kiani
34a59242a0 Revert "runtime: Add vim.lsp.get_client_by_name" #11623
reverts 680693e263 #11603
2019-12-29 09:05:32 +01:00
Hirokazu Hata
680693e263 runtime: Add vim.lsp.get_client_by_name (#11603)
Since the client name is more obvious than the client id for the user, add an
API to get the lsp client by the client name.
2019-12-28 09:28:00 -08:00
Ashkan Kiani
07a2260e1d
LSP: Handle rpc RequestCancelled specifically. (#11606)
This was creating extra noise in errors that we should've been handling
internally.

Fixes #11515
2019-12-24 14:28:09 -08:00
Björn Linse
440695c296 tree-sitter: implement query functionality and highlighting prototype [skip.lint] 2019-12-22 12:51:46 +01:00
Ashkan Kiani
ee7ac469c6
LSP: Use async completion for omnifunc. (#11578) 2019-12-20 22:49:29 -08:00
Ashkan Kiani
026ba804d1
LSP: Improve the display of the default hover callback. (#11576)
Strips the code blocks from markdown and does syntax highlighting.
2019-12-20 02:50:37 -08:00
Mike Hartington
d00c624ba4 LSP: fix omnifunc findstart (#11522) 2019-12-20 02:46:47 -08:00
Jakub Łuczyński
30ed245d00 LSP: Add jump when calling gotodef (#11521) 2019-12-07 03:34:22 -08:00
Ashkan Kiani
70b6061666
Add vim.startswith and vim.endswith (#11248) 2019-12-01 05:32:55 -08:00
Björn Linse
950690e48a lsp: allow the user to config LspDiagnosticError etc by standard means 2019-11-28 18:48:18 +01:00
Ashkan Kiani
6e8c5779cf
LSP: Move default buf callbacks to vim.lsp.callbacks (#11452)
- In the process, refactored focusable_preview to a util function.
- Add text for locations_to_items of the current line.
- Improve location callback to handle multiple return values by using
set_qflist.
- Remove update_tagstack and leave note for future travelers.
2019-11-26 05:59:40 -08:00
Justin M. Keyes
fd5710ae9a
doc + extmarks tweaks #11421
- nvim_buf_get_extmarks: rename "amount" => "limit"
- rename `set_extmark_index_from_obj`
2019-11-25 01:08:02 -08:00
Ashkan Kiani
a9036502dc Bring vim into local scope 2019-11-24 03:14:03 -08:00
Ashkan Kiani
b35f6aa9dd Add support for textDocument/references.
Add set_qflist and set_loclist.
- Also add locations_to_items, which calculates byte offsets for
character positions in files and avoids unnecessary operations.
2019-11-24 03:01:18 -08:00
Ashkan Kiani
b78fdd7ce5 Merge branch 'master' into lsp-followup 2019-11-24 02:29:23 -08:00
Ashkan Kiani
d0d38fc36e Lua: vim.env, vim.{g,v,w,bo,wo} #11442
- Add vim variable meta accessors: vim.env, vim.{g,v,w,bo,wo}
- Redo gen_char_blob to generate multiple blobs instead of just one
  so that multiple Lua modules can be inlined.
- Reorder vim.lua inclusion so that it can use previously defined C
  functions and utility functions like vim.shared and vim.inspect things.
- Inline shared.lua into nvim, but also keep it available in runtime.
2019-11-24 02:28:48 -08:00