Skip to content

Replace placeholders in completion text #193

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

Merged
merged 1 commit into from
Dec 15, 2017
Merged

Conversation

yshui
Copy link
Contributor

@yshui yshui commented Dec 5, 2017

In deoplete source, replace the placeholders with the neosnippet format.

We should probably make this behavior configurable.

@@ -15,8 +15,9 @@


def simplify_snippet(snip: str) -> str:
return re.sub(r'(?<!\\)\$\d+', '', snip)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HerringtonDarkholme Could you clarify a little bit of this snippet format here? Is it for neosnippet or some other formats?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern is from LSP spec. https://github.com/Microsoft/language-server-protocol/blob/cb75aa414c16b2fb1236881570499102b8941080/snippetSyntax.md

I only substitute patterns like $1, $2 which one single regular expression can handle.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It seems this change covers more cases and should be good to merge in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how it works if users don't have neosnippet installed. Will deoplete remove snippet placeholder? @yshui

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would. That's why I think we should make this configurable.

@autozimu
Copy link
Owner

autozimu commented Dec 6, 2017

I don't know the snippet format of this original implementation, and I don't use snippet myself. Better to clarify the original format before introducing any new changes here.

@autozimu
Copy link
Owner

autozimu commented Dec 6, 2017

Please check lint error. I will merge this in after CI pass.

@YaLTeR
Copy link
Contributor

YaLTeR commented Dec 14, 2017

This looks like the right place to comment, I get the ${1:something} placeholders instead of arguments regardless of which completion plugin I use and it's very annoying. Do I have to install something else for this to not happen?

In deoplete source, replace the placeholders with the neosnippet format.
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

Successfully merging this pull request may close these issues.

4 participants