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

Imports are updated for all my files with the wrong path #52675

Closed
inkubux opened this Issue Jun 22, 2018 · 14 comments

Comments

Projects
None yet
10 participants
@inkubux

inkubux commented Jun 22, 2018

Since yesterday my vscode is trying to hard to update my imports but it ends up failing and puts a a path to a typescript cache.

I'll be glad to help provide useful information but the behavior seems quite random. It happened to me 3 times yesterday. It even gos as far to update require from my webpack files...

capture d ecran 2018-06-22 a 07 26 29

I did not change these 173 files.. only one or 2..

capture d ecran 2018-06-22 a 07 30 00

I also see a bunch of insider helpers running.. there might be a rogue one in there that does nasty stuff in the background.

capture d ecran 2018-06-22 a 07 34 38

Even though it should not try to update imports on file I haven't touched and certainly not on npm dependencies.

  • VSCode Version: Version 1.25.0-insider (1.25.0-insider) c5c7d43

  • OS Version: OSX 10.13.4

Steps to Reproduce:
The first time I did.

  1. Open vscode play with files
  2. git pull from the command line
  3. All pulled files imports a rewritten with a path like this import React, { PureComponent } from '../../../../../../../Library/Caches/typescript/2.9/node_modules/@types/react';

Does this issue occur when all extensions are disabled?: Yes/No
It does not happen enough to be able to tell (enough is pretty relative here as 3 times last day)

@vscodebot vscodebot bot added the javascript label Jun 22, 2018

@inkubux

This comment has been minimized.

inkubux commented Jun 23, 2018

It happened again after a complete new install no plugins just by renaming a file on my project, it did rename all my imports in the project with "'../../../../../../../Library/Caches/typescript/2.9/node_modules/@types/*"

I disabled auto import renaming for now.

@mjbvz

This comment has been minimized.

Contributor

mjbvz commented Jun 25, 2018

Duplicate of Microsoft/TypeScript#24914

Will add workaround to prevent this on the VS Code side

@mjbvz mjbvz added this to the June 2018 milestone Jun 25, 2018

@mjbvz mjbvz added the bug label Jun 25, 2018

@mjbvz mjbvz closed this in 8829182 Jun 25, 2018

@JacksonKearl

This comment has been minimized.

Contributor

JacksonKearl commented Jun 29, 2018

@mjbvz do you have a good set of verification steps?

@SMotaal

This comment has been minimized.

SMotaal commented Jul 7, 2018

This is happening for me since updateImportsOnFileMove with latest public release.

@JacksonKearl
Here is the closest thing to a repo which I know will cause import express from 'express' to become from '../../../../Library/Caches/typescript/2.9/node_modules/@types/express' when you move "http-server" in and out of "modules/server/lib" affecting "types.d.ts" and others under "modules/server".

sample-workspace-v0.0.0.zip

@rikur

This comment has been minimized.

rikur commented Jul 8, 2018

Keeps happening to me as well, horrible! I'll figure out how to downgrade.

@JacksonKearl

This comment has been minimized.

Contributor

JacksonKearl commented Jul 8, 2018

@mjbvz is this expected?

@pushbuttons

This comment has been minimized.

pushbuttons commented Jul 9, 2018

Same behaviour since updating to 1.25.0 in macOS 10.12.6

@ZSkycat

This comment has been minimized.

ZSkycat commented Jul 9, 2018

This is the problem I have encountered.

tsconfig.json

{
    "compilerOptions": {
        "rootDir": ".",
        "outDir": "./dist",
        "target": "esnext",
        "module": "esnext",
        "moduleResolution": "node",
        "baseUrl": ".",
        "paths": {
            "src/*": ["./src/*"]
        },
        "sourceMap": true,
        "jsx": "preserve",
        "experimentalDecorators": true,
        "strict": true,
        "suppressImplicitAnyIndexErrors": true,
        "types": [],
    },
    "file": [
        "./node_modules/vue-router/types/vue.d.ts",
        "./node_modules/vuex/types/vue.d.ts",
    ],
    "include": [
        "./src/**/*",
    ],
}

image
image

I modified this file and it has nothing to do with them.
.\src\script\notify.ts

@mjbvz

This comment has been minimized.

Contributor

mjbvz commented Jul 9, 2018

Duplicate of Microsoft/TypeScript#24914

Let me know if you see this in VSCode insiders when using TS 3.0

@mjbvz mjbvz closed this Jul 9, 2018

@JacksonKearl

This comment has been minimized.

Contributor

JacksonKearl commented Jul 9, 2018

@mjbvz should we add another workaround/do we know why the previous one isn't catching these cases?

@twhoff

This comment was marked as resolved.

twhoff commented Jul 10, 2018

yeah this is making me crazy... how do we fix it?

@scottmas

This comment was marked as resolved.

scottmas commented Jul 10, 2018

Yeah, this just happened. Updated all my React imports everywhere in my project to

import React from "../../../../Library/Caches/typescript/2.9/node_modules/@types/react/../../Library/Caches/typescript/2.9/node_modules/@types/react";

And my lodash import to

import _ from "../../../../../Library/Caches/typescript/2.9/node_modules/@types/lodash../../../Library/Caches/typescript/2.9/node_modules/@types/lodash";

Had to manually go through and revert the changes. Was a super pain.

@mikecargal

This comment was marked as resolved.

mikecargal commented Jul 13, 2018

Seeing the same issue (I'm not even using typescript. (other than some obvious implicit thing with VSCode)) . Every few minutes, dozens of files (sometimes 100+) show up as opened and changed in VSCode. Most (oddly, not all) have this breaking change on the import statements.

Very frustrating, VSCode just about unusable with this behavior.

@Microsoft Microsoft locked as resolved and limited conversation to collaborators Jul 13, 2018

@mjbvz

This comment has been minimized.

Contributor

mjbvz commented Jul 13, 2018

This should be fixed in VS Code insiders. You can also upgrade your workspace to use TypeScript 3.0 (or TS 2.9.1) by following these instructions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.