Go Swagger Comment is a Visual Studio Code extension that simplifies the process of generating Swagger comments for Go code. The extension allows developers to highlight a block of Go code and generate API comments automatically based on the selected code snippet.
Features
Automatic Swagger Comment Generation: Quickly generate Swagger comments for highlighted Go code snippets.
Go Language Support: Designed specifically for Go programming language files.
Easy-to-use Commands: Use the command palette or keyboard shortcuts to trigger comment generation.
Installation
From the Visual Studio Code Marketplace
Open Visual Studio Code.
Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or pressing Ctrl+Shift+X.
Search for "go-swagger-comment".
Click the "Install" button.
Manual Installation
Download the extension package from the releases page.
Open Visual Studio Code and go to the Extensions view.
Click on the three dots at the top-right corner and choose "Install from VSIX...".
Select the downloaded .vsix file to install.
Usage
Open any Go (.go) file in Visual Studio Code.
Highlight the Go code block you want to generate a Swagger comment for.
Use the Keyboard Shortcut: Press Ctrl+Shift+F to generate a Swagger comment.
Alternatively, open the command palette (Ctrl+Shift+P or Cmd+Shift+P on macOS), search for Gen Swagger Comment, and press Enter.
Keybindings
Ctrl+Shift+F : Generate Swagger Comment for the highlighted Go code block.
Commands
go-swagger-comment.genComment: Generates a Swagger comment for the highlighted Go code block.
Requirements
Visual Studio Code version 1.88.1 or higher.
Go extension for Visual Studio Code (recommended for Go development).
Configuration
This extension does not require any specific configuration. However, to customize the generated comments or enhance the functionality, you may modify the SnippetMapper in ./src/constants.ts or the identifyCodeBlock function in ./src/helper.ts.
Development
If you want to contribute to the development of this extension, follow these steps to set up the project locally: