fix: completeFunctionCalls adds brackets when writing JSX#240
fix: completeFunctionCalls adds brackets when writing JSX#240m-gail wants to merge 4 commits intopmizio:masterfrom
Conversation
|
Hi, thanks for your contribution. I'm still on my vacation so I'll test it next week! |
| local filetype = vim.bo[requested_bufnr].filetype | ||
| local is_valid_context_for_function_snippet = utils.is_valid_context_for_function_snippet( | ||
| requested_bufnr, | ||
| params.data, |
There was a problem hiding this comment.
After using this PR for a bit, I've noticed that the position here does under some circumstances not get updated between when it first appears as a completion item and when it is chosen as a completion.
For example, when you are in insert mode and press backspace, the results and positions remain the same, which can lead to some unexpected behavior like this (| indicates cursor position):
# go into insert mode
{fooBarBaz|}<Component></Component>
# press backspace once, if you complete now, a snippet is used correctly
{fooBarBa|}<Component></Component>
# press backspace two more times, if you complete now, a snippet is not used
# even though it should be
# because the position is still the same as in step 1, but there is a '<'
# on that position now
{fooBar|}<Component></Component>
The problem could be solved, by querying the current cursor position from nvim here, instead of using the params, but I'm not sure if there is a better solution to this.
|
Any updates on this? |
|
This would be a really nice improvement. 🙏 |
|
Any updates? |
Solves #239
Fixes brackets being placed wrongly (for example with JSX and import statements) when complete_function_calls is set to true as described in the linked issue.
Old behavior
New behavior