Commit Graph

530 Commits

Author SHA1 Message Date
Ido Ariel
d8f5f4d090
doc(lsp): various small fixes (#15113)
- remove incorrect usage of docstrings
- fix make_formatting_params return type documentation to 'DocumentFormattingParams'
- make progress_handler private
- fix links
2021-07-17 11:15:57 +02:00
Michael Lingelbach
19a2e59f7e
Merge pull request #15017 from donbex/local-file-uri
fix(lsp): accept file URIs without a hostname
2021-07-14 12:20:13 -07:00
Michael Lingelbach
c31bc6ea73
fix(lsp): pass bufnr for async formatting (#15084)
the `textDocument/rangeFormatting` nad `textDocument/formatting` did not
pass bufnr to apply_text_edits, meaning edits were applied to
the user's currently active buffer. This could result in text being
applied to the wrong buffer.
2021-07-14 09:15:43 -07:00
Michael Lingelbach
eece0735fe
fix(lsp): avoid ipairs on non-sequential tables (#15059)
ipairs terminates on the first nil index when iterating over table keys:

for i,k in ipairs( {[1] = 'test', [3] = 'test'} ) do
  print(i, k)
end

prints:
1 test

Instead, use pairs which continues iterating over the entire table:

for i,k in pairs( {[1] = 'test', [3] = 'test'} ) do
  print(i, k)
end

prints:
1 test
3 test
2021-07-11 11:34:26 -07:00
Mathias Fussenegger
c21a6972a0 fix(lsp): Ensure human readable errors are printed
`return err_message(tostring(err))` caused errors to be printed as
`table: 0x123456789` instead of showing the error code and error
message.

This also removes some `if err` blocks that never got called because at
the end of `handlers.lua` all the handlers are wrapped with logic that
adds generic error handling.
2021-07-11 11:22:35 +02:00
Mathias Fussenegger
256570a7a6 fix(lsp): Ensure users get feedback on references/symbols errors or empty results
Relates to https://github.com/neovim/neovim/issues/15050

Users should get some indication if there was an error or an empty
result.
2021-07-11 10:57:00 +02:00
Mathias Fußenegger
7c61d9c3bf
fix(lsp): Add separator between codelens in virttext (#15049)
Before:

  Lens1Lens2

After:

  Lens1 | Lens2

Fixes https://github.com/neovim/neovim/issues/15048
2021-07-10 21:35:38 +02:00
Oliver Marriott
0b64d5ecd1
fix(lsp): correctly check for windows in lsp logger (#14954) 2021-07-10 11:11:33 -07:00
Tom Payne
1dab9357de feat(vim.uri): Allow URI schemes other than file: without authority 2021-07-10 18:27:37 +01:00
Alessandro Pezzoni
a2c2a08652 fix(lsp): accept file URIs without a hostname
RFC 8089, which defines the file URI scheme, also allows URIs without a
hostname, i.e. of the form file:/path/to/file. These are returned by
some language servers and accepted by other LSP implementations, such as
VSCode's, so it is reasonable for us to accept them as well.
2021-07-10 18:27:37 +01:00
Mathias Fussenegger
e43dbfdd05 feat(lsp): Make line diagnostics display prettier
Adds indentation that matches the number prefix to ensure diagnostic
messages spawning multiple lines align.

Before:

    Diagnostics:
    1. • Variable not in scope: red :: t0 -> t
    • Perhaps you meant one of these:
        ‘rem’ (imported from Prelude), ‘read’ (imported from Prelude),
        ‘pred’ (imported from Prelude)
    2. • Variable not in scope: repeDoubleColon :: [Char] -> t0
    • Perhaps you meant ‘replaceDoubleColon’ (line 32)

After:

    Diagnostics:
    1. • Variable not in scope: red :: t0 -> t
       • Perhaps you meant one of these:
           ‘rem’ (imported from Prelude), ‘read’ (imported from Prelude),
           ‘pred’ (imported from Prelude)
    2. • Variable not in scope: repeDoubleColon :: [Char] -> t0
       • Perhaps you meant ‘replaceDoubleColon’ (line 32)
2021-07-09 20:36:08 +02:00
Folke Lemaitre
9132b76da6
fix(lsp): support duplicate params in signature help (#15032) 2021-07-09 03:38:29 -07:00
Folke Lemaitre
03d15d9e09
fix(lsp): restore diagnostics extmarks that were moved to the last edit line (#15023) 2021-07-08 08:40:41 -07:00
Folke Lemaitre
af263711a3
feat(lsp): highlight active parameter in signature help (#15018) 2021-07-07 23:04:35 -07:00
Folke Lemaitre
77b33e4b9f
fix(lsp): restore diagnostics extmarks on buffer changes (#15011) 2021-07-07 22:31:39 +02:00
Folke Lemaitre
910967e5af
fix(lsp): prevent double <text> for cached plaintext markup 2021-07-05 00:39:46 +02:00
jadedpasta
490615612e
fix(vim.opt): vimL map string values not trimmed (#14982)
Options formatted as a list of comma-separated key-value pairs may have
values that contain leading and trailing whitespace characters. For
example, the `listchars` option has a default value of
`"tab:> ,trail:-,nbsp:+"`. When converting this value to a lua table,
leading and trailing whitespace should not be trimmed.

Co-authored-by: Robert Hrusecky <robert.hrusecky@utexas.edu>
2021-07-04 00:14:39 -07: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
David Zhang
b02e64c4df fix(vim.opt): Add basic error handling 2021-06-29 08:42:07 -04:00
ckipp01
e6175f6389 fix(vim.opt): Get window options before setting.
This closes #14677, but I also am a little unsure if there are times
where this may not be correct. However, this just changes the behavior
that even if `was_set` was false, we still get for
`nvim_win_get_option`.
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
jimman2003
bdf3df4027
Fixed +1 -1 in util.lua (#14913)
No point in adding and then subtracting I believe ;)
2021-06-26 13:43:18 -04:00
Folke Lemaitre
e680d7d6af
fix(lsp): render the last line in stylize_markdown 2021-06-25 11:45:42 -07:00
Folke Lemaitre
28dde1038f
style(lsp): make get_markdown_fences private 2021-06-25 18:32:00 +02:00
Michael Lingelbach
5d792701cf
Merge pull request #14904 from mfussenegger/nil-message-callbacks
fix(lsp): Handle nil message_callbacks
2021-06-25 09:13:01 -07:00
Michael Lingelbach
7b5a233d64
Merge pull request #14617 from folke/fancy_markdown_fences_support
feat(lsp): use `g:markdown_fenced_languages` in `vim.lsp.util.stylized_markdown`
2021-06-25 09:02:28 -07:00
Folke Lemaitre
aa1e20497a
feat(lsp): use markdown_fenced_languages in stylized_markdown 2021-06-25 17:27:38 +02:00
Mathias Fussenegger
58473178ff fix(lsp): Handle nil message_callbacks
The `onexit` handler could set `message_callbacks` to `nil` within the
luv event loop while the mainloop runs a function that tries to access
`message_callbacks`.

This adds some checks to prevent errors in that case.

Fixes https://github.com/neovim/neovim/issues/14863
2021-06-25 14:45:17 +02:00
Mathias Fussenegger
7ea652e4bf fix(lsp): Set dir completion option for add_workspace_folder
Given that the input is pre-filled with a path, it should be possible to
use dir completion.
2021-06-25 14:28:17 +02:00
Akin Sowemimo
444f175335 fix(lsp): do not convert vim.NIL to nil in lists 2021-06-24 11:23:19 +01:00
Michael Lingelbach
060255253f fix(lsp): handlers should focus quickfix list 2021-06-21 20:44:37 -07:00
Steven Arcangeli
43835ab0da fix(lsp): fix severity_limit logic in set_loclist 2021-06-19 07:35:17 -07:00
Folke Lemaitre
39d9713c5b
chore(lsp): removed deprecated floating preview methods 2021-06-17 07:48:40 +02:00
Lukas Reineke
f76f72a27b
fix(lsp): add bufnr to formatting requests
Add the buffer number to the `textDocument/formatting` request, so
that it is passed to the handler.
The built-in formatting handlers do not use the buffer number, but user
overrides should have access to it.
2021-06-15 23:53:43 -07:00
Shadman
3df0e475e8
docs(lsp): Clarify opts for show_line_diagnostics() 2021-06-15 23:21:04 -07:00
cbarrete
8cdffd42dd
docs(lsp): annotate call_hierarchy function as private 2021-06-14 23:19:23 -07:00
Jaehwang Jerry Jung
b8dfa2f112
fix(lsp): fix on_detach in lsp.diagnostic
`lsp.diagnostic.get_all()` was returning diagnotics for `:bwipeout`-ed
buffers because the diagnostic cache is not cleared. The first argument
of on_detach callback is the string "detach", not the bufnr.
2021-06-14 23:07:52 -07:00
Folke Lemaitre
d7d1f40d2c
fix(lsp): replace --- by a line in stylize_markdown 2021-06-15 07:35:58 +02:00
Michael Lingelbach
98b597bf03
Merge pull request #14737 from rktjmp/lsp-guard-against-negative-lines
[RDY] fix(lsp): guard against negative diagnostic line numbers
2021-06-14 15:01:58 -07:00
Timothée Sterle
15039d7597
fix(lsp): allow 'rounded' and 'solid' in floats 2021-06-14 23:19:45 +02:00
Mathias Fussenegger
2bdd553c9e feat(lsp): Add codelens support 2021-06-14 21:45:14 +02:00
Michael Lingelbach
141647cfbb
Merge pull request #14765 from folke/lsp_plaintext
fix(lsp): convert_input_to_markdown_lines: preserve plaintext
2021-06-12 17:48:04 -07:00
Folke Lemaitre
afb0274c28
fix(lsp): convert_input_to_markdown_lines: preserve plaintext 2021-06-12 21:47:17 +02:00
Oliver Marriott
ee4735881d fix(lsp): guard against negative diagnostic line numbers 2021-06-13 03:38:59 +10:00
Michael Lingelbach
f9b9b82047 fix(lsp): cap diagnostic end range to buf length
Closes #14743
2021-06-10 22:16:34 -04:00
Mathias Fussenegger
f03a4d616b feat(lsp): Split out a diagnostics_to_items function from set_loclist
Makes it easier to re-use the logic to populate the quickfix list
instead of the location list.
2021-06-07 18:24:32 +02:00
Michael Lingelbach
4ce61742cf
Merge pull request #14726 from folke/lsp_single_popup_per_buffer
fix(lsp): max 1 floating preview per buffer. Fixes #11508
2021-06-06 03:22:10 -07:00
Viktor Kojouharov
36d05845f7 feat(lsp): extend diagnostic.set_loclist
add option to show workspace diagnostic instead of the current buffer's
2021-06-06 09:59:46 +02:00