pyright的type hints提示

大概很久没更新过vim的插件系统,最近重装了一下coc.nvim,发现最新的coc-pyright版本,增加了inlay hints,他的效果是在代码的变量边上显示变量类型,函数返回类型,如下所示:

这个如果习惯没关系,在debug的时候会很好用,如果在写代码,甚至复制代码的时候,可能会有影响,总之不是很习惯。可以在vim里面通过:CocConfig打开coc-settings.json,在里面增加下面两个配置就可以了

{
  # 返回类型不显示
  "pyright.inlayHints.functionReturnTypes": false,  
  # 变量类型不显示
  "pyright.inlayHints.variableTypes": false  
}

具体参考:

https://github.com/fannheyward/coc-pyright#Configurations

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.