首页 > 解决方案 > VS Code 中 IntelliSense 中的本地图像

问题描述

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

这是我希望看到的。 这是我所期望的 但是,这仅在我将图像存储在 Web 服务器上时才有效。

这是我尝试访问本地文件时看到的。 包括破碎的图像

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

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(
    ) {}
    //..
  } 

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

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

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

有没有人使这个功能工作? 知道为什么它不适合我吗?

标签: visual-studio-codemarkdownintellisensejsdoc

解决方案


推荐阅读