Skip to content

Please set userdata.snippet in completed_item if the client support snippet #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Shougo opened this issue Feb 9, 2019 · 3 comments
Closed

Comments

@Shougo
Copy link

Shougo commented Feb 9, 2019

It is to fix for neosnippet.

Related issue: #396

I have read the code and I found LanguageClient-neovim does not set snippet in user_data.
It should set.

Because, some LanguageClient does not support snippet like pyls.
But neosnippet does not know this candidate whether contains snippet.

From src/type.rs.

        let is_snippet;
        let snippet;
        if lspitem.insert_text_format == Some(InsertTextFormat::Snippet) {
            is_snippet = Some(true);
            snippet = Some(word.clone());
        } else {
            is_snippet = None;
            snippet = None;
        };

        let mut info = String::new();
        if let Some(ref doc) = lspitem.documentation {
            info += &doc.to_string();
        }

        let user_data = VimCompleteItemUserData {
            lspitem: Some(lspitem.clone()),
        };

        Ok(VimCompleteItem {
            word,
            abbr,
            icase: Some(1),
            dup: Some(1),
            menu: lspitem
                .detail
                .clone()
                .unwrap_or_default()
                .replace("\n", " "),
            info,
            kind: lspitem.kind.map(|k| format!("{:?}", k)).unwrap_or_default(),
            snippet,
            is_snippet,
            user_data: Some(serde_json::to_string(&user_data)?),
        })

Current user_data only set lspitem.
snippet and is_snippet information does not send to neosnippet.

@Shougo
Copy link
Author

Shougo commented Feb 9, 2019

user_data.snippet should be empty if it does not support snippet.

The behavior is compatible with ncm2.

@autozimu
Copy link
Owner

autozimu commented Feb 9, 2019

Sure, I can make the change as long as there is a semi-consensus around how to use the user_data field.

@Shougo
Copy link
Author

Shougo commented Feb 10, 2019

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants