-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track file renamed/moved events #7325
base: mkondratek/chore/withServer
Are you sure you want to change the base?
Conversation
|
||
override fun elementRenamed(p0: PsiElement) = notifyAgent(p0) | ||
|
||
private fun notifyAgent(p0: PsiElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you name that p0
meaningfully?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
private fun notifyAgent(p0: PsiElement) { | ||
val uriAfter = uriFor(p0.containingFile.virtualFile) | ||
assert(uriBefore != uriAfter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to crash if they are the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I put
val uriBefore = uriFor(element.containingFile.virtualFile)
inside notifyAgent
.
It turns out that at the moment we run that expression it evaluates to the same thing as uriAfter
.
I do not see any other scenario for this assert to fail than a careless refactor. This assert is a safeguard.
6290fcf
to
699dba8
Compare
Fixes sourcegraph/jetbrains#2360.
This PR adds missing handling for
onDidRenameFiles
events.Test plan
Note: It refers to JB Client.
Test Case 1: File Rename Operation
Setup:
Steps:
foo.txt
in editorfoo.txt
tobar.txt
Test Case 2: File Move Operation
Setup:
Steps:
src/foo.txt
in editorfoo.txt
fromsrc/
todest/
folderExpected Behavior