Closed pappasam closed 4 years ago
A custom function I've written to work around the problem in this special case (disabling enablecompleted* neosnippet variables):
function! s:format_yaml_snippet()
" Find and replace things with $0, $1, $2, etc
s/$\([0-9]\+\)/<`\1`>/g
" Expand custom yaml snippet
execute 's/\%x00 /\r'
\ . repeat(' ', indent('.'))
\ . repeat(' ', &shiftwidth)
\ . '/g'
endfunction
command! FormatYamlSnippet call s:format_yaml_snippet()
Fixed.
Unfortunately, while the latest fix gets us closer, it ignores the current level of indentation and does not convert the tab character to spaces when expandtab is set to 1. See below for a gif:
Thanks for addressing this so quickly btw, your plugins are the best!
Sorry. It is feature.
Possibly, but the same thing now happens with my Python language snippets that come directly from the neosnippet-snippets plugin. I suspect this may be a bug, not a feature:
Please test the latest version of neosnippet.
Python: now cares about current level of indentation, but has two levels of indentation:
Snippets coming from the language server for YAML are doing the correct thing now, for the most part. Two minor issues that I will document soon.
there's one extra space created for the first snippet location
Please upload v:completed_item
result.
imap <C-b> <Plug>(neosnippet_expand_or_jump)
Python's v:completed_item:
{'word': 'defd', 'menu': '[ns] def function(...): """..."""', 'user_data': '{"snippet_trigger": "defd", "snippet": "def ${1:#:n ame}(${2}):\n\t\t\"\"\"${3:#:function documentation}\"\"\"\n\t\t${0:pass}"}', 'info': '', 'kind': '', 'abbr': ''}
Yaml's v:completed_item:
{'word': 'info: title: $1 version: $2', 'menu': '[LC] ', 'user_data': '{"lspitem":{"label":"info","kind":10,"documentation":"","insertText":"info :\n\ttitle: $1\n\tversion: $2","insertTextFormat":2,"textEdit":{"range":{"start":{"line":2,"character":0},"end":{"line":2,"char acter":3}},"newText":"info:\n\ttitle: $1\n\tversion: $2"}},"snippet":"info:\n\ttitle: $1\n\tversion: $2"}', 'info': '', 'kind': 'Property', 'abbr': 'info'}
Spuriously (not every time), the first "jump to next symbol" inserts the snippet again when using this key mapping: imap (neosnippet_expand_or_jump)
Because, LanguageClient-neovim's word is broken. Snippet item is inserted directly.
2nd problem is not bug of neosnippet.
And sorry. I cannot test yaml-language-server. So I don't want to test your problem.
No worries! The python snippet problem will probably affect way more people, so that’s the important one. I just listed the yaml issue for completeness.
On Sun, Oct 13, 2019 at 12:17 PM Shougo notifications@github.com wrote:
And sorry. I cannot test yaml-language-server. So I don't want to test your problem.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Shougo/neosnippet.vim/issues/475?email_source=notifications&email_token=AA4NDF7ZOBWBXVJCPGG2OITQONC2XA5CNFSM4I7RU4K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBCZV3Q#issuecomment-541432558, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4NDF3XQVRQKHT7GB6S6XDQONC2XANCNFSM4I7RU4KQ .
https://github.com/Shougo/neosnippet.vim/issues/475#issuecomment-541431230
Fixed. Please test the latest version.
I have tested and installed yaml-languege-server. But it does not work for me.
Oh, it is bad.
Haha, yeah, the latest version is broken. 0.4.1 is the most recent working version. https://github.com/redhat-developer/yaml-language-server/issues/192
And I tested your fixes; they work!
Oh...
If you want 0.4.1 of yaml-language-server to work, you'll need to configure it according to these docs: https://github.com/autozimu/LanguageClient-neovim/wiki/yaml-language-server . It's buggy, but is the only option I could find for editing openapi specs.
Thanks for all the help! I'm guessing that based on your fixes, neosnippet will better-support more vscode-like language-servers going forward, which will be a great user experience improvement for lsp-supported snippets in neovim.
OK. I get it. yaml-language-server works.
version
snippet is generated, but info
is not generated.
why?? I am confusing by the behavior.
I don't fix the non-reproducible problems. It is my policy.
If you create the reproducible steps, I will test it later for yaml languege-server. If not, my work is done.
I'll open a new issue if I figure out how to describe the yaml-language-server issue clearly. I think this current issue is definitely resolved, thanks again for your help!
Thanks for this awesome plugin! These fixes may be out of scope because they're related to language-servers that focus more on vscode. That said, maybe you'll consider it in-scope, so I'll outline the problems in case it helps you and/or others who run into similar issues.
Problems
I've run into two issues using the latest version of this plugin with the latest version of LanguageClient-neovim.
Gif
Value of v:completed_item
Environment
vimrc: