clojure-lsp / clojure-lsp-intellij

Intellij Plugin for Clojure & ClojureScript development via Language Server (LSP) made in Clojure
https://clojure-lsp.io
MIT License
76 stars 5 forks source link

Rename file does not work #48

Closed mtsbarbosa closed 2 months ago

mtsbarbosa commented 2 months ago

Describe the bug When trying to rename a file, if that's a clojure file, no rename is available, if not clj, rename fails sometimes

To Reproduce Steps to reproduce the behavior: for clj:

  1. Right click clj file
  2. no rename options available anywhere, not even on refactor

for non-clj:

  1. Right click a file
  2. Click rename
  3. Occasionally nothing happens, or an error is thrown Errors warned on my intellij (I'm not sure which is one is the cause of this issue):
    java.net.SocketException: The transport's socket appears to have lost its connection to the nREPL server
    at nrepl.transport$bencode$fn__583$fn__584.invoke(transport.clj:122)
    at nrepl.transport$bencode$fn__583.invoke(transport.clj:122)
    at nrepl.transport$fn_transport$fn__549.invoke(transport.clj:50)
    at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)
    at clojure.lang.AFn.call(AFn.java:18)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
java.lang.NullPointerException: Cannot invoke "com.intellij.openapi.editor.Editor.getCaretModel()" because "editor" is null
    at com.github.ericdallo.clj4intellij.util$editor__GT_cursor_position.invokeStatic(util.clj:12)
    at com.github.ericdallo.clj4intellij.util$editor__GT_cursor_position.invoke(util.clj:11)
    at com.github.clojure_lsp.intellij.extension.rename$_invoke.invokeStatic(rename.clj:52)
    at com.github.clojure_lsp.intellij.extension.rename$_invoke.invoke(rename.clj:46)
    at com.github.clojure_lsp.intellij.extension.rename$_invoke.invokeStatic(rename.clj:49)
    at com.github.clojure_lsp.intellij.extension.rename$_invoke.invoke(rename.clj:46)
    at com.github.clojure_lsp.intellij.extension.RenameHandler.invoke(Unknown Source)
    at com.intellij.refactoring.actions.BaseRefactoringAction.performRefactoringAction(BaseRefactoringAction.java:163)
    at com.intellij.refactoring.rename.RenameHandler2Renamer.lambda$performRename$0(RenameHandler2Renamer.java:38)
    at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:194)
    at com.intellij.refactoring.rename.RenameHandler2Renamer.performRename(RenameHandler2Renamer.java:36)
    at com.intellij.refactoring.actions.RenameElementAction.actionPerformed(RenameElementAction.java:88)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:333)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:307)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:356)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:307)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$performAction$5(ActionMenuItem.java:299)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:225)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.performAction(ActionMenuItem.java:292)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$new$0(ActionMenuItem.java:67)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$4(ActionMenuItem.java:114)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:114)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:526)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:558)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6656)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3385)
    at java.desktop/java.awt.Component.processEvent(Component.java:6421)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5026)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2804)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:790)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:763)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:761)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:760)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:667)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.kt:615)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:570)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:995)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:995)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:829)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Expected behavior Rename should be available for clj files, and should work for all files

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Add any other context about the problem here.