Skip to content
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

Insert parentheses to function completion and equals to arg completion #168

Merged
merged 1 commit into from
Feb 1, 2020

Conversation

renkun-ken
Copy link
Member

Closes #167.

This PR:

  • Insert () after function name when function completion item is selected
  • Insert = after argument name when arg completion item is selected.

@randy3k
Copy link
Member

randy3k commented Feb 1, 2020

Thank you.

@krassowski
Copy link
Contributor

Am I right that snippets should be only returned if the client declared snippetSupport? I think that we are sending snippetSupport=false but getting the snippets anyway.

Not that I do not want to implement this (it is great to see new features added!), just checking what is you opinion here.

@randy3k
Copy link
Member

randy3k commented Mar 12, 2020

@krassowski you are absolutely correct.

@marskar
Copy link

marskar commented Sep 24, 2020

This only works for snippets, correct?
Is there anyway to autocomplete parentheses for all functions with snippets?
The Python LSP has a setting that can be enabled.

@renkun-ken
Copy link
Member Author

@marskar Inserting fun($0) while seeing fun in completion list is only supported by editor that has snippetSupport capability. Seems it has nothing to do with user snippets. If editor has snippetSupport, then all functions will insert parentheses automatically.

@marskar
Copy link

marskar commented Sep 24, 2020

@renkun-ken, thanks, autocompleting parentheses works well great for me now.
If anyone reads this and is curious about the setup,
I

  • brew installed node
  • vim-plug installed coc.vim
  • ran install.packages("languageserver")
  • added the code below to the .Rprofile in my home directory:
options(
    languageserver.server_capabilities = list(
        snippetSupport = TRUE
    )
)

@randy3k
Copy link
Member

randy3k commented Oct 1, 2020

By the way, I don't think

options(
    languageserver.server_capabilities = list(
        snippetSupport = TRUE
    )
)

is valid. snippetSupport is a behavior supported by the editor or editor plugins. In your case, it seems that coc.vim already supports snippetSupport.

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.

Function completion should add parentheses
4 participants