Prechádzať zdrojové kódy

[vscode]Add quick link

dufu1991 3 rokov pred
rodič
commit
3fe6059d79

+ 5 - 0
packages/vscode-extension/CHANGELOG.md

@@ -1,3 +1,8 @@
+# 0.0.7
+
+- Added direct link to the corresponding component content on the STDF official website at the bottom of the tooltip.
+- Added direct link to the source code of the corresponding component on GitHub/Gitee at the bottom of the tooltip.
+
 # 0.0.6
 
 - Add README.(0.0.2 - 0.0.6)

+ 5 - 0
packages/vscode-extension/CHANGELOG_CN.md

@@ -1,3 +1,8 @@
+# 0.0.7
+
+- 悬浮窗底部增加直接跳转 STDF 官网对应组件内容。
+- 悬浮窗底部增加直接跳转 STDF 对应组件源码(GitHub/Gitee)。
+
 # 0.0.6
 
 - 增加 README。(0.0.2 - 0.0.6)

+ 5 - 1
packages/vscode-extension/README.md

@@ -10,7 +10,11 @@ Search for `stdf-vscode-extension` in the VS Code extensions marketplace and cli
 
 # Features
 
-### When hovering over the STDF component name, display the API of that component.
+When hovering over the name of an STDF component, the following information will be displayed:
+
+- The API of this component.
+- The example/API/guide of this component on the STDF official website.
+- The source code of this component on GitHub/Gitee.
 
 ![TIP](https://stdf.design/assets/vscode/tip.png)
 

+ 5 - 1
packages/vscode-extension/README_CN.md

@@ -10,7 +10,11 @@
 
 # 功能
 
-### 光标悬浮于 STDF 组件名称上时,显示该组件的API。
+光标悬浮于 STDF 组件名称上时悬浮显示。
+
+- 此组件 API。
+- 直接打开 STDF 官网此组件的示例/API/指南。
+- 直接打开 STDF 此组件源码(GitHub/Gitee)。
 
 ![TIP](https://stdf.design/assets/vscode/tip.png)
 

+ 1 - 1
packages/vscode-extension/package.json

@@ -2,7 +2,7 @@
     "name": "stdf-vscode-extension",
     "displayName": "stdf-vscode-extension",
     "description": "A VS Code extension to facilitate STDF development",
-    "version": "0.0.6",
+    "version": "0.0.7",
     "publisher": "STDF",
     "icon": "./src/assets/stdf-vscode-extension.png",
     "main": "./src/extension.js",

+ 9 - 3
packages/vscode-extension/src/extension.js

@@ -41,14 +41,20 @@ function activate(context) {
                     // 读取 api.md 文件的内容
                     // Read the contents of the api.md file
                     const apiContent = require('fs').readFileSync(apiPath, 'utf-8');
-                    // 在 apiContent 后面添加示例、API、指南的链接
-                    // Add links to examples, API, and guides after apiContent
+                    // 在 apiContent 后面添加示例、API、指南、组件源码的链接
+                    // Add links to examples, API, guides, and component source code after apiContent
                     const baseUrl = 'https://stdf.design/#/components?nav=';
+                    const baseUrlCode = 'https://github.com/dufu1991/stdf/blob/main/packages/stdf/components/';
+                    const baseUrlCodeGitee = 'https://gitee.com/dufu1991/stdf/blob/main/packages/stdf/components/';
                     const addContent = `**[${isZh ? '示例' : 'Demo'}](${baseUrl}${wordLower}&tab=0&lang=${
                         isZh ? 'zh_CN' : 'en_US'
                     })   [API](${baseUrl}${wordLower}&tab=1&lang=${isZh ? 'zh_CN' : 'en_US'})   [${
                         isZh ? '指南' : 'Guide'
-                    }](${baseUrl}${wordLower}&tab=2&lang=${isZh ? 'zh_CN' : 'en_US'})**`;
+                    }](${baseUrl}${wordLower}&tab=2&lang=${isZh ? 'zh_CN' : 'en_US'})   [${
+                        isZh ? '源码(GitHub)' : 'Source code(GitHub)'
+                    }](${baseUrlCode}${wordLower}/${word}.svelte)   [${
+                        isZh ? '源码(Gitee)' : 'Source code(Gitee)'
+                    }](${baseUrlCodeGitee}${wordLower}/${word}.svelte)**`;
                     const allContent = apiContent + '\n\n' + '---' + '\n\n' + addContent;
 
                     // 返回提示信息