Table of contents
problem background
I want to customize a comment template in goland, input /**+Enter can be completed as shown in the figure below
/**
* @description TODO
* @param null
* @return
* @author user
* @date 2023/7/4 15:24
*/
func main() {
print("hello world\n")
}
So I set the following template in File -> Settings -> Live Template,
where the template is filled as follows
/**
* @description TODO
* $params$
* @return $return$
* @author $user$
* @date $data$ $time$
*/
The variable setting is as follows,
but it still fails after setting, and the input /**+Enter is displayed as follows
/**
*/
func main() {
print("hello world\n")
}
Cause Analysis
The templates customized by GoLand have a higher priority than our own templates. When the template keyword /** conflicts, the templates of GOLand will be used first.
problem solved
I did not find a way to modify GoLand’s custom template after consulting the information, so I can only modify our template
Here we change the keyword /** to /att, which means that after attention,
the test can be tested again after the test is successful.
Input /att+Enter can be completed As shown below
/**
* @description TODO
* @param null
* @return
* @author user
* @date 2023/7/4 15:24
*/
func main() {
print("hello world\n")
}