1

I try to configure lsp-mode and company-lsp with python-language-server for python autocompletion, but when I choose completion candidate it completes with function arguments. How can I prevent this behaviour?

For example for function

def foo(arg1, arg2):
    ...

It will autocomplete like

foo(arg1, arg2)

I tried to set (setq lsp-enable-snippet nil) but it didn't help

1 Answer 1

3

There are actually two variables that drive this behavior.

You tried the first one, lsp-enable-snippet and it didn't work. This means that the culprit is probably company-lsp, which engages in a similar behavior and uses a variable that is nearly identical, company-lsp-enable-snippet.

Try disabling that with (setq company-lsp-enable-snippet nil) and see if that does the trick 🙂.

As an aside, when I struggle with a problem like this (where I have a suspicion there is a tangential/related mode driving the behavior), I try to looking for similarly named variables or variables that contain a reference to the behavior/feature/setting at hand. It's not a perfect heuristic, but it is how I found out about company's complementing behavior to lsp mode as answer above. If you have a feeling a problem is of this nature, next time try using C-h v and searching for the culprit variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.