> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devinenterprise.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 代码透镜

> 使用 Devin Desktop 的代码透镜，可直接在编辑器中对函数和类快速进行解释、重构和添加 Docstring 操作。

<div id="explain-refactor-and-add-docstring">
  ## 解释、重构和添加 Docstring
</div>

在文本编辑器顶部，Devin Desktop 会在函数和类上显示 *代码透镜*。

<Frame>
  <img src="https://mintcdn.com/cognitionai-enterprise/GYcs1r0Vcxr5GSpj/desktop/assets/windsurf/windsurf-code-lenses.png?fit=max&auto=format&n=GYcs1r0Vcxr5GSpj&q=85&s=8f6762170c56c4887ee92af8549bac16" width="884" height="216" data-path="desktop/assets/windsurf/windsurf-code-lenses.png" />
</Frame>

`Explain` 代码透镜会调用 Cascade，直接解释函数或类的作用以及它的工作原理。

`Refactor` 和 `Docstring` 代码透镜则会调用 Command。

* 如果你点击 `Refactor`，Devin Desktop 会显示一个下拉菜单，其中包含可选的预填充指示供你选择。你也可以自己编写指示。这相当于选中该函数并调用 Command。
* 如果你点击 `Docstring`，Devin Desktop 会在函数定义上方为你生成 docstring。
  (在 Python 中，docstring 会正确生成在函数定义的 *下方*。)

<Frame>
  <video autoPlay muted loop playsInline src="https://mintcdn.com/cognitionai-enterprise/GYcs1r0Vcxr5GSpj/desktop/assets/windsurf/windsurf-refactor-code-lens.mp4?fit=max&auto=format&n=GYcs1r0Vcxr5GSpj&q=85&s=495dc0e146f23f0874a7db9d7eafba28" data-path="desktop/assets/windsurf/windsurf-refactor-code-lens.mp4" />
</Frame>
