Skip to content

VSCode TS autoimport is most of the times wrong #7704

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

Open
PeterStaev opened this issue Aug 21, 2019 · 2 comments
Open

VSCode TS autoimport is most of the times wrong #7704

PeterStaev opened this issue Aug 21, 2019 · 2 comments

Comments

@PeterStaev
Copy link
Contributor

PeterStaev commented Aug 21, 2019

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.0.3
  • Cross-platform modules: 6.0.0
  • Android Runtime: 6.0.0
  • iOS Runtime: 6.0.0
  • Plugin(s):

Describe the bug
Most of the time when I use the auto-import in vscode the import is a total mess and does not represent the actual path. This on a newly started project with NS 6.0 and using long import paths.

To Reproduce

  • Observable is imported from tns-core-modules/ui/page/page.
    Correct one is tns-core-modules/data/observable
  • ObservableArray is imported from tns-core-modules/data/observable-array/observable-array.
    Correct one is tns-core-modules/data/observable-array
  • View is imported from tns-core-modules/ui/page/page
    Correct one is tns-core-modules/ui/core/view
  • GridLayout isn't even recognized for auto import

Expected behavior
Objects to be auto-imported from their correct locations instead of their aliased/exported paths.

Sample project

Additional context
May be something that can be fixed together with moving to scoped packages (#4041 )

@shirakaba
Copy link
Contributor

This is a real pain-point for me as a developer, and makes React Native far more ergonomic to work with. In React NativeScript, I re-export many key modules from one file (just like #4041) to improve Intellisense, but it would be great if the NativeScript team could do the suggested refactor from #4041 to improve the developer experience for everyone.

@charsleysa
Copy link
Contributor

One issue that causes this is that a lot of the submodules in tns-core-modules actually re-export items when they shouldn't.

For instance, Observable is re-exported in tns-core-modules/ui/page/page when it really should only be imported by that module and only exported by tns-core-modules/data/observable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants