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

Solution-style tsconfig breaks quick fix and auto import #39488

Closed
jtsom opened this issue Jul 6, 2020 · 7 comments
Closed

Solution-style tsconfig breaks quick fix and auto import #39488

jtsom opened this issue Jul 6, 2020 · 7 comments
Assignees
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@jtsom
Copy link

jtsom commented Jul 6, 2020

Issue Type: Bug

In Angular 10, they introduced "solution-style" tsconfig files: https://angular.io/guide/migration-solution-style-tsconfig

This, however, seems to break auto importing of files and classes, and the quick-fixes for adding imports:

image

image

Note that it's showing "no quick fixes available" .. that should be, and it used to be (something like) "... add import of Contact ...". Or ideally, it would have automatically added the import line as soon as I typed line 13.

In the tsconfig.app.json, a standard Angular 10 app has:

{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

Once I changed the include like to be:

  "include": [
    "src/**/*.d.ts",
    "src/**/*.ts"
  ]

The quick fix now works, as well as the auto-import of the file:

image

ALSO AN ISSUE ON Code - Insiders
VS Code version: Code - Exploration 1.48.0-exploration (8ac8b3ab28f8687fbd491bbe24cd9ad52514da55, 2020-07-06T06:45:05.955Z)
OS version: Darwin x64 19.5.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 1, 2, 2
Memory (System) 32.00GB (4.26GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (17)
Extension Author (truncated) Version
ng-template Ang 0.1000.2
path-intellisense chr 2.2.1
vscode-eslint dba 2.1.5
githistory don 0.6.5
retroassembler Eng 1.3.5
auto-close-tag for 0.5.8
output-colorizer IBM 0.1.2
csharp ms- 1.22.1
hexeditor ms- 1.0.1
js-debug-companion ms- 1.0.2
js-debug-nightly ms- 2020.7.317
vscode-typescript-next ms- 4.0.20200705
vscode-typescript-tslint-plugin ms- 1.2.3
debugger-for-chrome msj 4.12.9
material-icon-theme PKi 4.2.0
msbuild-project-tools tin 0.3.8
vscodeintellicode Vis 1.2.9

(5 theme extensions excluded)

@mjbvz mjbvz transferred this issue from microsoft/vscode Jul 7, 2020
@DanielRosenwasser DanielRosenwasser added Needs Investigation This issue needs a team member to investigate its status. and removed Needs Investigation This issue needs a team member to investigate its status. labels Jul 8, 2020
@mjbvz mjbvz removed their assignment Jul 8, 2020
@DanielRosenwasser
Copy link
Member

I think there might be a call stack on #39048 (comment)

@DanielHTpg
Copy link

This is more likely an issue in the VSCode angular language service extensions then a TypeScript issue

@IllusionMH
Copy link
Contributor

IllusionMH commented Jul 14, 2020

Had same issue when tried to configure TS to follow Webpack entry points, and it shouldn't be related to solution style config because this behavior can be achieved with single tsconfig.json and without any Angular related extensions.

If you only have files config then only files that are imported somewhere in imports trees starting from files will be considered part of the project and support all project related suggestions/auto-imports.
On the other hand files that aren't part of imports trees yet should be part of inferred project (Project '/dev/null/inferredProject1*' (Inferred)) and not of expected project, therefore no suggestions for/from files in different projects.

More broad include makes sure that these files are included in expected project and therefore will contribute to suggestions.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Jul 14, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.1 milestone Jul 14, 2020
@sheetalkamat
Copy link
Member

The issue here seems to be that tsconfig.app.json does not include new file into the configured project as it explicitly lists files that should be and till you import new file it wont be part of the configured project. The issue is with configuration file and how it is structured.
Is new file suppose to go to tsconfig.app.json or tsconfig.spec.json or something else is not clear to derive either so there isnt much we can do.

@sheetalkamat sheetalkamat added External Relates to another program, environment, or user action which we cannot control. and removed Needs Investigation This issue needs a team member to investigate its status. labels Jul 15, 2020
@bradennapier
Copy link

I think this issue is also due to the example I provide here:

https://github.com/microsoft/vscode/issues/103087

WIth a repro of the problem here: https://github.com/bradennapier/typescript-auto-import-bug

tl;dr - outDir is used for auto imports instead of the src directory and that breaks things - especially when using paths and rootDir

@jtsom
Copy link
Author

jtsom commented Jul 28, 2020

Is there ANY work being done to fix the auto-import / import issue? I've seen this problem referenced in a half dozen issues, but nothing is happening, and everyone pointing fingers (It's Angular's problem, it's VSCode's problem, it's Typescript's problem)

@cgarrovillo
Copy link

microsoft/vscode#111986 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

9 participants