diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..52c7129 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Release Notes + +## v0.0.9 + +- The UI was optimized and a deprecated tag was added to indicate that the API is not recommended. + +## v0.0.8 + +- Fixed some Windows compatibility issues. +- Optimized the UI interface of webview. + +## v0.0.7 + +- Launch experience satisfaction questionnaire survey +- You are welcome to submit your questions and suggestions on the [experience questionnaire](https://g.alicdn.com/aes/tracker-survey-preview/0.0.13/survey.html?pid=fePxMy&id=3486). + +## v0.0.6 + +- Surpport code snippets. + +## v0.0.5 + +- Added aliyun-cli installation instructions. + +## v0.0.3 + +- Support API calling. +- Support SDK code sample. + +## v0.0.1 + +Initial release + +- Support product searching and subscription. +- Support API searching. +- Support API Document View. diff --git a/README.en-US.md b/README.en-US.md deleted file mode 100644 index 854068e..0000000 --- a/README.en-US.md +++ /dev/null @@ -1,69 +0,0 @@ -# Alibaba Cloud API Toolkit - -[![Version](https://img.shields.io/visual-studio-marketplace/v/alibabacloud-openapi.vscode-alicloud-api)](https://marketplace.visualstudio.com/items?itemName=alibabacloud-openapi.vscode-alicloud-api) -[![Installs](https://img.shields.io/visual-studio-marketplace/i/alibabacloud-openapi.vscode-alicloud-api)](https://marketplace.visualstudio.com/items?itemName=alibabacloud-openapi.vscode-alicloud-api) -[![Ratings](https://img.shields.io/visual-studio-marketplace/r/alibabacloud-openapi.vscode-alicloud-api)](https://marketplace.visualstudio.com/items?itemName=alibabacloud-openapi.vscode-alicloud-api) - -The Alibaba Cloud API Toolkit for VSCode makes it easier to access Alibaba Cloud services. - -## Features - -* **Alicloud Product subscription:** You can search for Alicloud products and subscribe to its APIs you want to use. - -* **API Searching:** You can search the Open API of Alibaba Cloud products to which you are subscribed. - -* **API Document View:** Clicking on an API can navigate you to a new tab which displays the corresponding API document, -including descriptions, request parameters, response parameters and error codes. -Click to debug, you can link to Aliyun OpenAPI portal for online API trial. - -* **Call the API:** You can use the form to call the Alibaba Cloud API and see the response. - -* **SDK Code Sample:** You can get the SDK code samples and quickly open the corresponding SDK code in VS Code. - -* More features are under development, please stay tuned. - -## Extension UI Guide - -![VSCode Extension Guide](https://img.alicdn.com/imgextra/i1/O1CN01iYMtwm27arlqDq7V3_!!6000000007814-0-tps-2328-1540.jpg) - - * Product Searching `ctrl+cmd+k` - -![Product Searching](https://img.alicdn.com/imgextra/i1/O1CN01bcJ5DM1RpmnlOjDHK_!!6000000002161-0-tps-1202-798.jpg) - - * API Searching `ctrl+cmd+l` - -![API Serching](https://img.alicdn.com/imgextra/i1/O1CN01KaWkBF1UfCUkY0N3v_!!6000000002544-0-tps-1286-518.jpg) - -* Call the API - -The feature requires you to configure your AK/SK information as follows: -1. Install [Alibaba Cloud CLI Tools](https://marketplace.visualstudio.com/items?itemName=alibabacloud-openapi.aliyuncli) extentions. -2. Open the command line to install aliyun-cli `brew install aliyun-cli`, -3. Enter `aliyun configure` and follow the prompts to configure it, -4. Click the Alibaba Cloud icon in VS Code status bar to manage your profiles, -5. More information please refer to the [Alibaba Cloud CLI Documentation] (https://github.com/aliyun/aliyun-cli?tab=readme-ov-file#configure). - -![API debug](https://img.alicdn.com/imgextra/i4/O1CN01F1qI7S1BunIFJPiAt_!!6000000000006-0-tps-2618-2050.jpg) - -* SDK Code Sample - -![sdk demo](https://img.alicdn.com/imgextra/i1/O1CN01GVhWTl1waRdYmCn7E_!!6000000006324-0-tps-2630-2038.jpg) - -## Requirements -- Need VS Code 1.75.0 or above. - -## Release Notes - -### 0.0.1 -Initial release -- Support product searching and subscription. -- Support API searching. -- Support API Document View. - -### 0.0.3 -- Support API calling. -- Support SDK code sample. - -## License - -See the [Apache License 2.0](./LICENSE). \ No newline at end of file diff --git a/README.md b/README.md index 384c578..75f3277 100644 --- a/README.md +++ b/README.md @@ -8,40 +8,42 @@ The Alibaba Cloud API Toolkit for VSCode makes it easier to access Alibaba Cloud English | [简体中文](./README.zh_CN.md) -## Features -* **Alicloud Product Subscription:** You can search for Alicloud products and subscribe to its APIs you want to use. +## Features -* **API Searching:** You can search the Open API of Alibaba Cloud products to which you are subscribed. +- **Alicloud Product Subscription:** You can search for Alicloud products and subscribe to its APIs you want to use. -* **API Document View:** Clicking on an API can navigate you to a new tab which displays the corresponding API document, -including descriptions, request parameters, response parameters and error codes. +- **API Searching:** You can search the Open API of Alibaba Cloud products to which you are subscribed. -* **Call the API:** You can use the form to call the Alibaba Cloud API and see the response. - -* **SDK Code Sample:** You can get the SDK code samples and quickly open the corresponding SDK code in VS Code. +- **API Document View:** Clicking on an API can navigate you to a new tab which displays the corresponding API document, + including descriptions, request parameters, response parameters and error codes. -* **Code Snippets:** You can use the code snippets to quickly generate the code. +- **Call the API:** You can use the form to call the Alibaba Cloud API and see the response. +- **SDK Code Sample:** You can get the SDK code samples and quickly open the corresponding SDK code in VS Code. -* More features are under development, please stay tuned. +- **Code Snippets:** You can use the code snippets to quickly generate the code. + +- More features are under development, please stay tuned. ## Extension UI Guide -![VSCode Extension Guide](https://img.alicdn.com/imgextra/i1/O1CN01rOmqbK1pOoGtdWxFO_!!6000000005351-0-tps-2462-1440.jpg) +![VSCode Extension Guide](https://img.alicdn.com/imgextra/i2/O1CN01t993u81InC3xh7RVU_!!6000000000937-0-tps-2328-1646.jpg) ### Product Searching `ctrl+cmd+k` - + ![Product Searching](https://img.alicdn.com/imgextra/i1/O1CN01bcJ5DM1RpmnlOjDHK_!!6000000002161-0-tps-1202-798.jpg) - + ### API Searching `ctrl+cmd+l` -![API Serching](https://img.alicdn.com/imgextra/i1/O1CN01KaWkBF1UfCUkY0N3v_!!6000000002544-0-tps-1286-518.jpg) +![API Serching](https://img.alicdn.com/imgextra/i4/O1CN01KCrc1a1vooTmC9a1h_!!6000000006220-0-tps-1986-542.jpg) ### Call the API -The feature requires you to configure your AK/SK information as follows: -1. Install [Alibaba Cloud CLI Tools](https://marketplace.visualstudio.com/items?itemName=alibabacloud-openapi.aliyuncli) extentions. -2. Install [aliyun-cli](https://github.com/aliyun/aliyun-cli?tab=readme-ov-file#installation). -3. You can run the `aliyun configure` command for quick configuration. +The feature requires you to configure your AK/SK information as follows: + +1. Install Aliyun CLI: [Install guide](https://www.alibabacloud.com/help/en/cli/installation-guide). +2. Install [Alibaba Cloud CLI Tools](https://marketplace.visualstudio.com/items?itemName=alibabacloud-openapi.aliyuncli) extentions. +3. You can run the `aliyun configure` command for quick configuration. + ``` $ aliyun configure Configuring profile 'default' ... @@ -51,20 +53,23 @@ Default Region Id [None]: cn-hangzhou Default output format [json]: json Default Language [zh]: zh ``` + 4. Click the Alibaba Cloud icon in VS Code status bar to manage your profiles. -![](https://img.alicdn.com/imgextra/i1/O1CN0144NU9N1L4G1cq89Uf_!!6000000001245-0-tps-248-46.jpg) -![](https://img.alicdn.com/imgextra/i2/O1CN01btLUkc1ldEHJQ0w4S_!!6000000004841-0-tps-1206-190.jpg) -5. More information please refer to the [Alibaba Cloud CLI Documentation](https://github.com/aliyun/aliyun-cli?tab=readme-ov-file#configure). + ![](https://img.alicdn.com/imgextra/i1/O1CN0144NU9N1L4G1cq89Uf_!!6000000001245-0-tps-248-46.jpg) + ![](https://img.alicdn.com/imgextra/i2/O1CN01btLUkc1ldEHJQ0w4S_!!6000000004841-0-tps-1206-190.jpg) + More information please refer to the [Alibaba Cloud CLI Documentation](https://github.com/aliyun/aliyun-cli?tab=readme-ov-file#configure). -![API debug](https://img.alicdn.com/imgextra/i4/O1CN01F1qI7S1BunIFJPiAt_!!6000000000006-0-tps-2618-2050.jpg) +![API debug](https://img.alicdn.com/imgextra/i3/O1CN01yfMcHl1i6lNdjzmzs_!!6000000004364-2-tps-2688-1820.png) ### SDK Code Sample + You can generate the SDK Sample by using the debugger form and then open it in your editor. -![sdk demo](https://img.alicdn.com/imgextra/i1/O1CN01GVhWTl1waRdYmCn7E_!!6000000006324-0-tps-2630-2038.jpg) +![sdk demo](https://img.alicdn.com/imgextra/i1/O1CN01C0vQDB29gTtW5erj4_!!6000000008097-0-tps-2638-1778.jpg) ### Code Snippets -You can use the code snippets to quickly generate the code. + +You can use the code snippets to quickly generate the code. Type your subscribed API into the editor and select the API snippet you want to generate. @@ -74,38 +79,14 @@ Or use the keyboard shortcuts `ctrl+cmd+l` to search the API and select Insert s ![code snippets](https://img.alicdn.com/imgextra/i3/O1CN01dmGwmX1ZyVHozyKx4_!!6000000003263-1-tps-842-468.gif) ## Feedback -Submit bug reports and feature requests on [our Github repository](https://github.com/aliyun/alibabacloud-api-vscode-toolkit/issues) -. -## Requirements -- Need VS Code 1.75.0 or above. - -## Release Notes - -### 0.0.8 -- Fixed some Windows compatibility issues. -- Optimized the UI interface of webview. - -### 0.0.7 -- Launch experience satisfaction questionnaire survey +- Submit bug reports and feature requests on [our Github repository](https://github.com/aliyun/alibabacloud-api-vscode-toolkit/issues). - You are welcome to submit your questions and suggestions on the [experience questionnaire](https://g.alicdn.com/aes/tracker-survey-preview/0.0.13/survey.html?pid=fePxMy&id=3486). -### 0.0.6 -- Surpport code snippets. - -### 0.0.5 -- Added aliyun-cli installation instructions. - -### 0.0.3 -- Support API calling. -- Support SDK code sample. +## Requirements -### 0.0.1 -Initial release -- Support product searching and subscription. -- Support API searching. -- Support API Document View. +- Need VS Code 1.75.0 or above. ## License -See the [Apache License 2.0](./LICENSE). \ No newline at end of file +See the [Apache License 2.0](./LICENSE). diff --git a/README.zh_CN.md b/README.zh_CN.md index 217c7f3..a57a8cc 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -26,7 +26,7 @@ Alibaba Cloud API Toolkit 是一个轻量化的阿里云 API 工具,支持在 ## 插件 UI 导览 -![VSCode Extension Guide](https://img.alicdn.com/imgextra/i1/O1CN01o9s4TT1GTq3oggW7K_!!6000000000624-0-tps-2456-1446.jpg) +![VSCode Extension Guide](https://img.alicdn.com/imgextra/i1/O1CN01tlXFtt1mj0vE1ZrhR_!!6000000004989-0-tps-2498-1768.jpg) ### 产品搜索 `ctrl+cmd+k` @@ -34,14 +34,14 @@ Alibaba Cloud API Toolkit 是一个轻量化的阿里云 API 工具,支持在 ### API 搜索 `ctrl+cmd+l` -![API Serching](https://img.alicdn.com/imgextra/i1/O1CN01KaWkBF1UfCUkY0N3v_!!6000000002544-0-tps-1286-518.jpg) +![API Serching](https://img.alicdn.com/imgextra/i2/O1CN01ySJXt41c4ZnIbj51N_!!6000000003547-0-tps-1986-542.jpg) ### API 调试 调试功能需要配置你的 AK/SK 信息,配置方法如下: -1. 安装 [Alibaba Cloud CLI Tools](https://marketplace.visualstudio.com/items?itemName=alibabacloud-openapi.aliyuncli) 插件, -2. 打开命令行安装 aliyun-cli `brew install aliyun-cli`, +1. 安装阿里云 CLI:[安装指南](https://help.aliyun.com/zh/cli/installation-guide); +2. 安装 [Alibaba Cloud CLI Tools](https://marketplace.visualstudio.com/items?;itemName=alibabacloud-openapi.aliyuncli) 插件; 3. 输入 `aliyun configure` 命令,按照提示进行配置, ``` @@ -54,20 +54,18 @@ Default output format [json]: json Default Language [zh]: zh ``` -4. 点击 VS Code 状态栏中的阿里云图标,管理你的 profiles, +4. 点击 VS Code 底部状态栏中的阿里云图标,管理你的 profiles, ![](https://img.alicdn.com/imgextra/i1/O1CN0144NU9N1L4G1cq89Uf_!!6000000001245-0-tps-248-46.jpg) ![](https://img.alicdn.com/imgextra/i2/O1CN01btLUkc1ldEHJQ0w4S_!!6000000004841-0-tps-1206-190.jpg) -1. 更多信息请参考 [Alibaba Cloud CLI Documentation](https://github.com/aliyun/aliyun-cli?tab=readme-ov-file#configure)。 + 更多信息请参考 [Alibaba Cloud CLI Documentation](https://github.com/aliyun/aliyun-cli?tab=readme-ov-file#configure)。 -![API debug](https://img.alicdn.com/imgextra/i4/O1CN01F1qI7S1BunIFJPiAt_!!6000000000006-0-tps-2618-2050.jpg) - -![API debug](https://learn.microsoft.com/zh-cn/visualstudio/ide/media/vs-2022/copilot-chat-visual-studio.gif?view=vs-2022#lightbox) +![API debug](https://img.alicdn.com/imgextra/i3/O1CN01yfMcHl1i6lNdjzmzs_!!6000000004364-2-tps-2688-1820.png) ### SDK 示例 你能够通过调试表单生成 SDK 代码示例,并在编辑器中打开对应的 SDK 代码。 -![sdk demo](https://img.alicdn.com/imgextra/i1/O1CN01GVhWTl1waRdYmCn7E_!!6000000006324-0-tps-2630-2038.jpg) +![sdk demo](https://img.alicdn.com/imgextra/i1/O1CN01C0vQDB29gTtW5erj4_!!6000000008097-0-tps-2638-1778.jpg) ### Code Snippets @@ -83,44 +81,13 @@ Default Language [zh]: zh ## 反馈 -欢迎在我们的 [Github repository](https://github.com/aliyun/alibabacloud-api-vscode-toolkit/issues) 上提交你的问题和建议。 +- 欢迎在我们的 [Github repository](https://github.com/aliyun/alibabacloud-api-vscode-toolkit/issues) 上提交你的问题和建议。 +- 您对插件的使用体验满意吗?点击 [体验问卷](https://g.alicdn.com/aes/tracker-survey-preview/0.0.13/survey.html?pid=fePxMy&id=3486) 进行吐槽或夸赞,您的反馈对我们十分重要! ## Requirements - Need VS Code 1.75.0 or above. -## Release Notes - -### 0.0.8 -- Fixed some Windows compatibility issues. -- Optimized the UI interface of webview. - -### 0.0.7 - -- Launch experience satisfaction questionnaire survey. -- You are welcome to submit your questions and suggestions on the [experience questionnaire](https://g.alicdn.com/aes/tracker-survey-preview/0.0.13/survey.html?pid=fePxMy&id=3486). - -### 0.0.6 - -- Surpport code snippets. - -### 0.0.5 - -- Added aliyun-cli installation instructions. - -### 0.0.3 - -- Support API calling. -- Support SDK code sample. - -### 0.0.1 - -Initial release - -- Support product searching and subscription. -- Support API searching. -- Support API Document View. - ## License See the [Apache License 2.0](./LICENSE). diff --git a/media/src/components/APIPage/API.tsx b/media/src/components/APIPage/API.tsx index 0de062a..82f9edf 100644 --- a/media/src/components/APIPage/API.tsx +++ b/media/src/components/APIPage/API.tsx @@ -181,9 +181,9 @@ export const API: React.FC = (props) => {
setIsExpand(!isExpand)}> {isExpand ? ( -
+
) : ( -
+
)}
{isExpand &&
{isExpand && }
} @@ -246,11 +246,11 @@ export const API: React.FC = (props) => {
- {selectedApi.method ? ( + {/* {selectedApi.method ? (
{selectedApi.method?.toUpperCase()}
- ) : null} + ) : null} */} {selectedApi.deprecated ? ( deprecated diff --git a/package.json b/package.json index d4d9292..8bdbae7 100644 --- a/package.json +++ b/package.json @@ -214,7 +214,7 @@ "reinstall": "rimraf node_modules && npm i", "afterinstall": "cd ../../ && lerna bootstrap", "build:ncc": "rimraf dist && ncc build ./src/extension.ts -o dist -m --license licenses.txt && mv dist/index.js dist/extension.js", - "vscode:prepublish": "npm run build:ncc", + "vscode:prepublish": "npm run build:media && npm run build:ncc", "esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node --minify", "esbuild": "npm run esbuild-base -- --sourcemap", "esbuild-watch": "npm run esbuild-base -- --sourcemap --watch", diff --git a/resources/deprecated.svg b/resources/deprecated.svg new file mode 100644 index 0000000..28b8813 --- /dev/null +++ b/resources/deprecated.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/commands.ts b/src/commands.ts index aae3823..68cef10 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -43,9 +43,11 @@ export class AlicloudApiCommands { .map((mod) => { return mod.interfaces.map((inter) => { return { - label: `${inter.method ? `[${inter.method}] ` : ""}${inter.path ? inter.path : inter.name}`, - detail: `${pontSpec.name ? pontSpec.name + "/" : ""}${inter.name}`, - description: `${inter.description || inter.summary || ""}`, + tags: inter.deprecated ? [vscode.CompletionItemTag.Deprecated] : [], + label: `${inter.name}`, + detail: `${pontSpec.name?.split("__").join(" ")}`, + info: `${pontSpec.name ? pontSpec.name + "/" : ""}${inter.name}`, + description: `${inter.deprecated ? "@deprecated\n" : ""} ${inter.description || inter.summary || ""}`, summary: `${inter.summary || ""}`, }; }); @@ -97,7 +99,7 @@ export class AlicloudApiCommands { return; } let specName: string, modName: string, apiName: string; - const detailItems = item.detail.split("/"); + const detailItems = item.info.split("/"); if (hasSpecName) { specName = detailItems[0]; diff --git a/src/explorer.ts b/src/explorer.ts index 2f0c411..c944abe 100644 --- a/src/explorer.ts +++ b/src/explorer.ts @@ -59,9 +59,11 @@ export class PontAPIExplorer { contextValue: "API", resourceUri: vscode.Uri.parse(`pontx-manager://spec/${spec.name}/apis/${dir}`), label: `${apiName}`, - iconPath: vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, "resources/api-outline.svg"), - description: api?.title || api?.summary, - tooltip: api?.description || api?.summary, + iconPath: api.deprecated + ? vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, "resources/deprecated.svg") + : vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, "resources/api-outline.svg"), + description: ` ${api?.title || api?.summary || ""}`, + tooltip: `${api.deprecated ? `@deprecated\n\n` : ""}${api?.description || api?.summary || api.name}`, collapsibleState: vscode.TreeItemCollapsibleState.None, command: { command: "alicloud.api.openDocument", @@ -117,9 +119,11 @@ export class PontAPIExplorer { contextValue: "API", resourceUri: vscode.Uri.parse(`pontx-manager://spec/${specName}/apis/${api.name}`), label: `${api.name}`, - iconPath: vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, "resources/api-outline.svg"), - description: api?.title || api?.summary, - tooltip: api?.description || api?.summary, + iconPath: api.deprecated + ? vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, "resources/deprecated.svg") + : vscode.Uri.joinPath(alicloudAPIMessageService.context.extensionUri, "resources/api-outline.svg"), + description: api?.title || api?.summary || "", + tooltip: api?.description || api?.summary || api?.name, collapsibleState: vscode.TreeItemCollapsibleState.None, command: { command: "alicloud.api.openDocument", @@ -258,7 +262,7 @@ export class AlicloudApiExplorer implements vscode.TreeDataProvider { - const {product, version} = getSpecInfoFromName(spec.name || "") + const { product, version } = getSpecInfoFromName(spec.name || ""); return { specName: spec.name, @@ -285,7 +289,7 @@ export class AlicloudApiExplorer implements vscode.TreeDataProvider getSpecInfoFromName(item.name || "").product === product && getSpecInfoFromName(item.name || "").version === version)?.length) { + if ( + pontxConfig.origins?.filter( + (item) => + getSpecInfoFromName(item.name || "").product === product && + getSpecInfoFromName(item.name || "").version === version, + )?.length + ) { vscode.window.showInformationMessage("该产品及其版本号已订阅,您可以使用 cmd + ctrl + p 来搜索该产品下的API。"); } else { pontxConfig.origins = [ @@ -389,10 +399,9 @@ export class AlicloudApiExplorer implements vscode.TreeDataProvider { const language = vscode.window.activeTextEditor?.document.languageId; - const {product, version:versionAPI} = getSpecInfoFromName(item?.detail); - const [version, apiName] = versionAPI?.split("/"); + const [product, version] = item?.detail?.split(" "); + const apiName = item?.label?.toString().replace("(java-async)", ""); let asyncFetchedCode = ""; + let asyncImportList = []; if (product && apiName && version) { return new Promise(async (resolve) => { const snippets = await codeSampleProvider({ @@ -79,17 +82,22 @@ class CompletionItemProvider { product: product, version: version, apiName: apiName, - simplify:true + simplify: true, }); - - if (item.label.toString().includes("(java-async)")) { - asyncFetchedCode = snippets?.find((item) => item.language === "java-async")?.code; - } else if(snippets?.find((item) => item.language === language)){ - asyncFetchedCode = snippets?.find((item) => item.language === language)?.code; - }else{ - item.documentation = "暂不支持该语言的 SDK" + + const curLanguage = item.label.toString().includes("(java-async)") ? "java-async" : language; + + const snippet = snippets?.find((item) => item.language === curLanguage); + if (snippet) { + asyncFetchedCode = snippet?.code; + asyncImportList = snippet?.importList; + } else { + item.documentation = "暂不支持该语言的 SDK"; } // 设置补全项的实际插入文本 + item.additionalTextEdits = [ + vscode.TextEdit.insert(new vscode.Position(0, 0), `${asyncImportList?.join("\n")} \n`), + ]; item.insertText = asyncFetchedCode; resolve(item); });