microsoft / python-language-server

Microsoft Language Server for Python
Apache License 2.0
912 stars 131 forks source link

Underlined parameter in tooltip not relevant after using a named parameter #401

Open jakebailey opened 5 years ago

jakebailey commented 5 years ago

image

Here you can see that default is the parameter hint being underlined, but it's only being highlighted because it's the fifth parameter and I've already typed four. This doesn't really make sense because the moment I started explicitly naming my parameters, the position no longer matters (and trying to put something in that position without naming it would simply fail).

It's probably better to stop underlining parameters in the tooltip once a named parameter has been given.

jakebailey commented 5 years ago

I think this turns out to be a lot more complicated than I thought it was. The LS gives a list of those parameters in SignatureInformation, and I think VSC is just picking by index which one to highlight. I'm not sure if there's a good way to handle this unless the LS can send a new SignatureInformation after the code changes, changing that list on the fly to match what is being written.

jakebailey commented 5 years ago

Turns out that we do control that index:

https://github.com/Microsoft/python-language-server/blob/083666d318bd5814131aab70c92f2cf55c6a3ee4/src/LanguageServer/Impl/Sources/SignatureSource.cs#L76-L81