VS Code 中 IntelliSense 中的本地图像

Tra*_*lip 5 markdown intellisense jsdoc visual-studio-code

我在 VS Code 中使用 TypeScript。我使用 JSDoc 来发表评论,因此 IntelliSense 通常将评论显示为工具提示。我使用 Markdown 来格式化这些评论,包括图像。大多数情况下它是有效的,但有一个问题。我只能看到来自 HTTP 服务器的图像。它不会显示本地文件系统中的图像

这是我期望看到的。 这就是我所期望的 但是,只有当我将图像存储在网络服务器上时,这才有效。

这是我尝试访问本地文件时看到的内容。 包括损坏的图像

这是这些图片背后的代码的简短版本。您可以在此处的上下文中找到确切的代码。

class IntelliSenseTest {
  /**
   * `to` and `from` assume that we are moving around the shape counter-clockwise,
   * i.e. the mathematically positive direction.
   * ![explanation of dots](./kite-dart-dots.png)
   */
  constructor(
  ) {}
}

export class Segment {
    /**
     * `to` and `from` assume that we are moving around the shape counter-clockwise,
     * i.e. the mathematically positive direction.
     * ![explanation of dots](https://raw.githubusercontent.com/TradeIdeasPhilip/penrose-tiling/master/docs/kite-dart-dots.png)
     */
    constructor(
    ) {}
    //..
  } 
Run Code Online (Sandbox Code Playgroud)

第一个例子是破损的。第二个可以正确显示图像,但它使用了一种令人讨厌的解决方法。我希望能够将图像和源文件保存在同一目录中。我希望能够将它们包含在同一个提交中。那可能吗?

注意:VS Code 能够在自己的窗口中显示此文件。我可以直接链接到 README.md 中的本地文件。我们正在查看完全相同的图像,我刚刚将我的项目推送到了 github。

您可以从此图像或github中看到和*.png文件*.ts位于同一目录中。 VS代码文件列表

有人让这个功能发挥作用了吗? 知道为什么它对我不起作用吗?

gea*_*ear 0

我遇到了同样的问题,刚刚编写了一个 Visual Studio 代码插件来解决您的问题。

https://marketplace.visualstudio.com/items?itemName=mgiesen.image-comments&ssr=false#overview

我的插件允许您插入将显示在工具提示中的本地图像路径。