日常使用-IDEA&Goland

一、常用插件及配置

导入GoLand配置: File -> Manage IDE Settings -> Import Settings…

1. 常用插件

1)IdeaVim - 集成vim基础操作

2)Maven Helper - 查看依赖树,便于排除依赖等

3)Maven Dependency Helper - 便捷查询maven坐标

4)Free Mybaits puglin - 支持接口和mapper跳转等

5)Translation - 翻译

6)SequenceDiagram - 生成时序图

7)Rainbow Brackets - 括号着色

8)GrepConsole - 日志着色

9)FindBugs-IDEA - 代码审查

10)Java Stream Debugger - Stream可视化Debug

11)GenerateAllSetter

12)leetcode editor

13)gittoolbox

14)Awesome Console - 控制台增强,如文件地址可以点击打开

2. 常用配置

1)配置maven目录

image-20210204114405336

2)配置编辑器的tab栏

image-20210204114533239

image-20210204114557699

3)配置keymap为eclipse

image-20210204115704273

4)设置常用快捷键

image-20210204121243789

快速打开最近项目

5)设置字体大小

image-20210204131440206

6)打开内存使用器

View | Appearance | Members in Navigation Bar

7)设置用户信息

1
2
3
4
/**
* @author wangqiwei
* @date ${YEAR}/${MONTH}/${DAY} ${HOUR}:${MINUTE}
*/

image-20210303111335857

8)社区版Git的View中显示Local Changes

取消勾选:Settings | Preferences | Version Control |CommitUse non-modal commit interface

image-20210319112412511

二、常见问题

1. cannot find symbol

尝试:1)删除.idea/ 2)执行mvn idea:module

2. External Libraries下出现Libraray root

如果IDEA的”External Libraries”下出现”Libraray root”,那么其有可能和项目的pom文件的依赖有冲突,此时需要执行以下操作:
1)删除.idea/
2)删除xxx.iml
3)重新导入工程

3. 替换tab为空格

1)取消勾选 Preferences - Editor - Code Style - Java页面的Use tab character

image-20210128231941809

2)对已有的文件进行替换tab替换(如粘贴代码后可执行本操作)

Edit | Convet Indents | To Spaces

4. idea的terminal中切换输入法卡死

1)goto Help | Edit Custom VM options…

2)Add -Drecreate.x11.input.method=true to a new line

3)restart IDEA

参考:https://youtrack.jetbrains.com/issue/JBR-2444

5. Fix unresolved reference in GoLand
  1. 方法一 >> See More

img.png

  1. 方法二

img.png

6. 含中文的文件无法显示/无法创建

原因:当前系统字符集问题
第一步:查看当前字符集

1
echo $LANG

第二步:如果不是zh_CN.UTF8,则Google安装中文字符集

第三步:按照完成后,重启IDE即可

7. Goland中的System Environment与Terminal不一致

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000497650/comments/360000793320

If you set the variable in a terminal inside the IDE, those won’t be automatically sent to the run configurations.

You have to use the way mentioned above to set environment variables. Go to Run | Edit Configurations… | Templates | Go Build and set the environment variables there. Then all new run configurations will inherit those.

If you wish to set the variables for the terminal specifically, then go to Settings/Preferences | Tools | Terminal | Environment Variables. Note: the environment variables set here will only affect the GoLand terminal after it’s closed and started again. And they will not affect the Run Configurations.

如果你使用的是zsh,那么你可以把变量配置到/etc/zsh/zshenv,然后source ~/.zshrc。具体原因可查看命令解释man zsh

评论