Skip to content
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

Renaming a javascript file causes (lots of) unrelated files to be updated #51970

Closed
thomasmichaelwallace opened this issue Jun 15, 2018 · 5 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@thomasmichaelwallace
Copy link

Issue Type: Bug

If a file is renamed in my javascript project almost all files (including those in node_modules) are opened and have their imports changed. The majority of these are unaffected by the rename, and the resulting changes are incorrect.

For example:

# /src/.../query.js
import moment from 'moment';
import 'moment-timezone';
import { runQuery } from './adapters/asyncQuery';

becomes:

# /src/.../query.js
import moment from '../../../../../Library/Caches/typescript/2.9/node_modules/moment/moment../../../Library/Caches/typescript/2.9/node_modules/moment/moment';
import '../../../../../Library/Caches/typescript/2.9/node_modules/@types/moment-timezone/indexLibrary/Caches/typescript/2.9/node_modules/@types/moment-timezone/index';
import { runQuery } from '@/api/adapters/asyncQueryuery';

after renaming a test file that does not reference/import it at all.

Note that not only are the imports replaced with references back to the types, but the local import to asyncQuery is also changed to asyncQueryuery.

I have confirmed this still happens with code-insiders --disable-extensions, so it seems to be part of the build. It started happening yesterday (14th of June).

VS Code version: Code - Insiders 1.25.0-insider (7dc9539, 2018-06-15T05:12:05.222Z)
OS version: Darwin x64 17.6.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz (4 x 3100)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 2, 3
Memory (System) 16.00GB (5.38GB free)
Process Argv /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron -psn_0_229432
Screen Reader no
VM 0%
@vscodebot
Copy link

vscodebot bot commented Jun 15, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the javascript JavaScript support issues label Jun 15, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 15, 2018

Duplicate of microsoft/TypeScript#24914

Try upgrading to typescript@next by following these instructions: https://code.visualstudio.com/docs/languages/typescript#_using-newer-typescript-versions

@mjbvz mjbvz closed this as completed Jun 15, 2018
@mjbvz mjbvz added upstream Issue identified as 'upstream' component related (exists outside of VS Code) *duplicate Issue identified as a duplicate of another issue(s) labels Jun 15, 2018
@thomasmichaelwallace
Copy link
Author

thomasmichaelwallace commented Jun 15, 2018

I've updated to typescript@next and this is still happening... maybe upstream hasn't updated yet. I'll try again tomorrow with the next insider build.

@thomasmichaelwallace
Copy link
Author

(n.b. for anyone else coming across this, deleting the setting key: "javascript.updateImportsOnFileMove.enabled": "always", will allow you to switch off the auto-move import, which stops the error.)

@thomasmichaelwallace
Copy link
Author

Confirmed that the altering unrelated files is fixed by @next now that the latest build is Version 3.0.0-dev.20180616.

However the presumably related butchering of imports is still happening, which I think is reported as #52022.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants