首页 > 解决方案 > 如何使用它的 API 为 VsCode 扩展制作自定义排水沟指示器?

问题描述

我在一个带有突出显示的图像下方附加了我想要实现用于放置装订线指示器的自定义线的位置。与放置断点的工作方式类似,我想实现我自己的排水沟指示器系统,该系统将在悬停时显示指示器的阴影,并且可以在单击时放置。

如果可能的话,我该怎么做,文档的链接将不胜感激!

天沟亮点

我当前使用的装饰类型是使用键绑定设置的。

    const decorationType = vscode.window.createTextEditorDecorationType({
      isWholeLine: true,
      borderWidth: `0 0 0 0`,
      backgroundColor: new vscode.ThemeColor("checkbox.border"),
      gutterIconPath: path.join(__filename, "..", "..", "assets", "pin.png"),
      gutterIconSize: "contain",
      rangeBehavior: vscode.DecorationRangeBehavior.ClosedOpen,
    });
    editor.setDecorations(decorationType, [
      new vscode.Range(editor.selection.active, editor.selection.active),
    ]);

标签: typescriptvisual-studio-codevscode-extensionsgutter

解决方案


推荐阅读