-
Notifications
You must be signed in to change notification settings - Fork 167
Refactoring Rename strange behaviour #244
Comments
Still occurs on rls-preview 0.128.0-nightly. |
I've seen a similar bug, but I made sure that my files were saved before performing the rename, so I suspect that it's in RLS. Basically, I had something like this: #[derive(Debug, Serialize, Deserialize)]
pub(crate) enum JobStatus {
Queued,
Running,
Completed,
Failed,
}
pub(crate) fn new_job_instance(state: &AppState, job: &JobDefinition) -> Result<String, SubmitJobError> {
if pipeline_exists(state, &job.pipeline)? {
insert_job_instance(state, job)
} else {
Err(SubmitJobError::UnknownPipelineError {
name: job.pipeline.clone(),
})
}
} When I renamed pub(crate) fn new_job_instance(state: &AppState, job: &JobDefinition) -> Result<StNewJobInstanceErrorbError> {
if pipeline_exists(state, &job.pipeline)? {
insert_job_instance(state, job)
} else {
Err(SubmitJobError::UnknownPipelineError {
name: job.pipeline.clone(),
})
}
} Notice that it also didn't rename references to variants of the enum. |
@suhr or @doxxx Can you reproduce this reliably or does it only sometimes happen? @doxx was the RLS still indexing (i.e., spinner was spinning) when you did the change?
This is expected - the RLS doesn't know anything about the prefixes of paths (e.g., |
It happens sometimes. |
I was able to reproduce it multiple times for that specific case I described, as well as a few other cases. I'm fairly certain that the RLS was not indexing at the time. |
Is this rust-dev-tools/rls-analysis#109? |
yes |
@fzzr- @doxxx I could not reproduce this, is it still happening? |
Renaming an enum now works and renames all usages of that enum including usages of its variants. However, I can only rename some enums and not others. The rename action simply has no effect on the source code with no errors reported. So far the pattern appears to be that for a library project I can rename enums defined in I tested this with rust stable 1.30.0 and nightly 1.31.0 (1cf82fd9c 2018-10-30) installed. My VSCode was configured with I also tried modifying my VSCode settings to remove the |
After restarting VSCode with the channel overridden to nightly again, rename is not working anywhere in my project for any kind of symbol. |
I restarted VSCode with the env var
If I run RLS in CLI mode and try the rename there, I get the following:
|
Correction: Renaming does appear to be working for structs sometimes, but there appears to be some condition where it fails. I have not been able to determine what these conditions are yet. |
So it looks like I cannot rename a struct if it has no impl block or functions which use it. Once I add either an impl block or a function referencing it, renaming works for that struct. Enums are also affected. |
Currently the RLS is a bit broken and missing from nightly. Hopefully we'll have a new version tomorrow. On master I've added more messaging which should make this easier to debug. |
@nrc I updated to the latest rust nightly this morning, and renames are still not working in all cases. I tried setting Checking the actual versions though it looks like RLS is still old:
What's up with that? |
There's a few odd behaviours around renames, I'm working on a fix... |
Just throwing in my two cents that I saw some strange behavior, it was reproducible in that I could Nothing indexing, changing the name on a function in a struct and an unrelated function at the bottom of the file gets |
Add sysroot configuration to rls.toml
Rename
works on saved buffer instead the current buffer, I think.Steps to reproduce:
.rs
in the vscode and paste following code:12345
foo
toxx
foo);xx
because you deleted 5 symbols and length offoo);
is five too ;)versions:
The text was updated successfully, but these errors were encountered: