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

Support for managing imports #733

Open
SimonCockx opened this issue Mar 13, 2024 · 0 comments
Open

Support for managing imports #733

SimonCockx opened this issue Mar 13, 2024 · 0 comments
Labels
enhancement New feature or request subject: model validation This issue is about validation of Rosetta models, such as the type system subject: UI This issue is about UI features, such as content assist, auto-completion, etc

Comments

@SimonCockx
Copy link
Contributor

Right now, managing imports is a manual process. E.g., if a modeller needs a symbol from another namespace, they will manually add an import to.my.namespace.* at the top of the file. This results in a series of issues:

  • A lot of wildcard imports, even though a single identifier is needed.
  • Duplicate imports to the same namespace which aren't detected. (there should be a warning)
  • The imports are ordered arbitrarily, making it difficult to see whether or not a particular namespace is imported or not.

I would propose to add the following features:

  • Import symbol action to automatically add an import to a symbol at the top of the file.
  • Add warning on duplicate imports.
  • Optimize imports action.

The Optimize imports action would do the following:

  • If the number of symbols from an imported namespace is greater than a threshold (let's say 3), then replace those imports with a wildcard import. Otherwise, replace a wildcard import with the actual individual symbol imports.
  • Sort the imports.
  • Group the imports per top-level namespace. (e.g., drr.foo is a different group from cdm.foo, but the same as drr.bar)

Related: (resolving these issues will also help with managing imports)

@SimonCockx SimonCockx added enhancement New feature or request subject: model validation This issue is about validation of Rosetta models, such as the type system subject: UI This issue is about UI features, such as content assist, auto-completion, etc labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request subject: model validation This issue is about validation of Rosetta models, such as the type system subject: UI This issue is about UI features, such as content assist, auto-completion, etc
Projects
None yet
Development

No branches or pull requests

1 participant