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

Import fix suggestions are traversing upwards after #21398 #22249

Closed
alextreppass opened this issue Mar 1, 2018 · 2 comments
Closed

Import fix suggestions are traversing upwards after #21398 #22249

alextreppass opened this issue Mar 1, 2018 · 2 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@alextreppass
Copy link

alextreppass commented Mar 1, 2018

TypeScript Version: 2.7.2

Search Terms: autoimport import fix relative paths baseUrl

Code

In our codebase, we have the compiler option baseUrl set to ./src. We have no other path-related settings.

Given the following files:

  • src/some/path/to/consumer.ts
  • src/some/other/path/util.ts

When editing consumer.ts to import a member of util.ts, VSCode will suggest and import the following:

Expected behavior:

Actual behavior:

It looks like the change by @andy-ms was to fix #19920, but I am unable to configure paths and/or rootDirs in a way that brings back the old behaviour here.

Restrictions:

  • I can't change the baseUrl to "./" as we don't want to see src/ prepended to our imports
  • We need the full path (just without src/) for easy grepping and refactoring

I've tested a revert of d333d88 against current TypeScript master (ec249f7 at the time of writing) and can confirm the old behaviour comes back.

If it's by design, any chance this logic could be tweaked to take into account some combination of "baseUrl": "./src" with paths and/or rootDirs? Or the behaviour made configurable via some other mechanism?

Working with ../../../../... in a large and fast-moving codebase is hard.

Related Issues:
#19920
microsoft/vscode#44699

Thanks

@alextreppass alextreppass changed the title Auto imports are Import fix suggestions are traversing upwards since #21398 Mar 1, 2018
@alextreppass alextreppass changed the title Import fix suggestions are traversing upwards since #21398 Import fix suggestions are traversing upwards after #21398 Mar 1, 2018
@mhegazy mhegazy added the Bug A bug in TypeScript label Mar 1, 2018
@mhegazy mhegazy assigned ghost Mar 1, 2018
@mhegazy mhegazy added this to the TypeScript 2.8 milestone Mar 1, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Mar 1, 2018

Related to #20619

@alextreppass
Copy link
Author

alextreppass commented Mar 2, 2018

May also be a duplicate (or just related to) #21860

@ghost ghost mentioned this issue Mar 12, 2018
@ghost ghost added the Fixed A PR has been merged for this issue label Mar 12, 2018
@ghost ghost closed this as completed in #22236 Mar 20, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants