Intellij Plugin

Introduction

A plug-in tool that supports go-zero api language structure syntax highlighting, detection, and quick generation of api, rpc, and model.

Idea version requirements

  • IntelliJ 2019.3+ (Ultimate or Community)
  • Goland 2019.3+
  • WebStorm 2019.3+
  • PyCharm 2019.3+
  • RubyMine 2019.3+
  • CLion 2019.3+
  • api syntax highlighting
  • api syntax and semantic detection
  • struct, route, handler repeated definition detection
  • type jump to the type declaration position
  • Support api, rpc, mode related menu options in the context menu
  • Code formatting (option+command+L)

Install

Find the latest zip package in the GitHub release, download it and install it locally. (No need to unzip)

Thw way two

In the plugin store, search for to install

Preview

Quickly generate api/rpc service

In the target folder

preview

Api/Rpc/Model Code generation

The way one(Project Panel)

Corresponding files (api, proto, sql) right click->New->Go Zero-> Api/Rpc/Model Code, as shown in the figure:

Thw way two(Editor Panel)

Corresponding files (api, proto, sql)

Error message

Live Template

Live Template can speed up our writing of api files. For example, when we enter the main keyword in the go file, press the tip and press Enter and insert a piece of template code.

In other words, you will be more familiar with the picture below. Once upon a time, you still defined the template here. context menu

Let’s enter the instructions for using the template in today’s api grammar. Let’s take a look at the effect of the service template.

First of all, in the previous picture, take a look at several template effective areas in the api file (psiTree element area) context menu

Default template and effective scope

For the corresponding content of each template, you can view the detailed template content in , for example, the json tag template content is

  1. json:"$FIELD_NAME$"