GeezerVison is showing github.com — Feature request: Inlay hint · Issue #397 · python-lsp/python-lsp-server
Feature request: Inlay hint #397Descriptionpython still don't have avaliable language server support inlay hint, hope pylsp can be the hero 😄 Reacted by Maikol Solís, 金雄镕, Xie Zejian, Nathan Ridge, Jongwook Choi, goingtosleep, Dikesh, Sébastien Iooss, Magnus Larsen, Ítalo Vieira and 21 more Activityccordoba12 commented on Jun 23, 2023 Hey @fecet, thanks for reporting. What do you mean by this? Reacted by Shahriar Heidrich fecet commented on Jun 23, 2023 Amar1729 commented on Oct 19, 2023 Just as a note - inlay hints are supported by coc-pyright and VSCode's pylance, but notably not pyright (although I don't use either pylance, which requires VSCode, or coc-pyright). markis commented on Jun 3, 2024 Reacted by Amar Paul, Jongwook Choi and Shahriar Heidrich Reacted by Shahriar Heidrich baco commented on Jun 3, 2024
Just as a note - inlay hints are supported by coc-pyright and VSCode's pylance, but notably not pyright.
I don't know coc-pyright approach, but:
- VSCode's Pylance is not possible to make it work. It has proprietary licensing and does some checks against Microsoft's marketplace, that even VSCodium staff are having issues in giving the support for running outside VSCode.
- VSCode's Pyright won't have the feature. Microsoft has chopped that functionality out, in favor of adding that to Pylance. Pylance and Pyright are, some how complimentary. Pyright does only type validation.
As @markis said, BasedPyright project supports that. And it's even more accessible for Python developers, since doesn't force users to install NodeJS (like coc-pyright o pyright require). It does install NodeJS behind the curtains though, but it's all encapsulated in a virtual environment, transparent to the Python developer. Amar1729 commented on Jun 4, 2024 Yeah, at this point i would definitely recommend basedpyright. It didn't exist at the time I made my comment lol Reacted by Dionisio E Alonso and Markis Taylor claytharrison commented on Dec 22, 2024 So there's a plugin that provides this (https://github.com/BoringStuffInc/pylsp-inlay-hints), but as an experimental capability. At least in my case, eglot for Emacs looks for inlayHintProvider as a regular capability, so it doesn't work.
I would like to adapt the plugin to do that, but I can't tell if there's any way for plugins to provide a new proper capability to pylsp. I only see a hookspec for experimental ones. I'll keep digging, but does anyone have any hints on this?
EDIT:
All I have to do to get pylsp-inlay-hints working with eglot is to add inlayHintProvider to pylsp's capabilities in python_lsp.py, i.e.
def capabilities(self):
server_capabilities = {
...
"inlayHintProvider": {
"resolveProvider": False,
"workDoneProgress": True,
},
...
}Reacted by Shahriar Heidrich and Bruno Eduardo Reacted by Sam Martin-Brown, Shahriar Heidrich and Bruno Eduardo
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|