如何自动包装Pylance提供的VSCode python intelliSence?

2024-09-28 23:18:30 发布

您现在位置:Python中文网/ 问答频道 /正文

功率响应:

Not converting to markdown wouldn't be a good idea (as it prevents us from using markdown at all in the tooltips). VS Code's plaintext support is broken until 1.52, but maybe then we could add a toggle to say "use plaintext only".


我正在使用VSCode编写python,并使用Pylance提供智能。我想知道它是否能以一种简洁的方式提供自动包装的信息?目前提供的intellisense信息将所有内容混合在一行中,因此很难看到

更具体地说,下图显示了不带自动换行的intellisense。我希望Args:和以下信息与绿色注释所写的内容完全相同(每行都是一个参数及其解释)。我怎样才能做到呢

图1:没有自动换行的用户定义类FDNN的智能感知

enter image description here

图2:没有自动换行的pytorch类nn.Linear的智能感知

enter image description here


编辑1:

删除注释前的r无效

enter image description here


编辑2:

添加-比纯文本效果更好,但面临_转义问题

enter image description here


Tags: to信息编辑内容智能notbe功率
1条回答
网友
1楼 · 发布于 2024-09-28 23:18:30

解决方案很简单:删除docstring前面的r


编辑

我已经尝试了r函数的doc字符串,但无法重现该行为

如果将文档字符串格式化为一种标记,则只有它具有problems with ^{} in variable names时,它的显示效果才会更好

在标题行下面加上-(减号),这样文本就变得合理了

class FDNN:
  """
  Applies a fused fuzzy .....

  Args
    
      input_size:     size of input vector
      memfcn:         type of membership functions
      memparalist:    list of tuples of membership functions
  """
  def __init__(self):
    pass

对于函数,键入开头(后文档字符串的呈现方式不同,它在参数工具提示中用作文本

这可能是为VSC创建问题的原因。不同提供者中的描述有不同的解释,应该可以将它们标记为纯文本或“标记”

相关问题 更多 >