idea编辑器中修改代码tagert一直不变解决方案

今天我把写好的工程修改了xml文件,但是tagert就一直改不了,在maven中clean了,然后自己把tagert删除了重新更新就是不变tagert里面的代码,最后我清除缓存重启就好了
在这里插入图片描述

点击上面红色箭头就可以清除缓存自动重启了!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您可以使用IDEA插件开发提供的`EditorFactoryListener`接口来监听代码编辑器修改,然后在`EditorFactoryListener`的实现类添加`DocumentListener`,以便在代码编辑器文本发生更改时收到通知。具体步骤如下: 1. 创建一个实现`EditorFactoryListener`接口的类,实现`editorReleased(EditorFactoryEvent event)`方法。 2. 在`editorReleased(EditorFactoryEvent event)`方法获取`Editor`对象并为其添加`DocumentListener`。 3. 在`DocumentListener`的实现类实现`documentChanged(DocumentEvent event)`方法,以便在代码编辑器文本发生更改时执行所需的操作。 示例代码如下: ```java import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.event.EditorFactoryEvent; import com.intellij.openapi.editor.event.EditorFactoryListener; public class MyEditorFactoryListener implements EditorFactoryListener { @Override public void editorReleased(EditorFactoryEvent event) { Editor editor = event.getEditor(); Document document = editor.getDocument(); document.addDocumentListener(new MyDocumentListener()); } } class MyDocumentListener implements DocumentListener { @Override public void documentChanged(DocumentEvent event) { // 在代码编辑器文本发生更改时执行所需的操作 } } ``` 然后在插件的`plugin.xml`添加以下配置,以便在插件加载时注册`MyEditorFactoryListener`: ```xml <extensions defaultExtensionNs="com.intellij"> <editorFactoryListener implementation="com.example.MyEditorFactoryListener"/> </extensions> ``` 注意,`EditorFactoryListener`不会在新建或打开的文件上触发,只有在编辑器已经打开的情况下,关闭编辑器时才会触发`editorReleased`事件。如果您需要在打开或创建文件时监听,请参考`VirtualFileListener`的使用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值