Skip to content

feat(language-service): support auto-import for attribute completions #62797

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ivanwonder
Copy link
Contributor

@ivanwonder ivanwonder commented Jul 24, 2025

Add logic to provide code actions for auto-importing directives that
are out of scope.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: language-service Issues related to Angular's VS Code language service labels Jul 24, 2025
@ngbot ngbot bot added this to the Backlog milestone Jul 24, 2025
@ivanwonder ivanwonder force-pushed the support-auto-import-for-attribute branch 2 times, most recently from 20ecdc5 to 286e034 Compare July 25, 2025 08:34
);
if (info === null) {
return undefined;
break;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to use break than return. After the switch statement, there is logic for the code action.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, there is a bug in the function getTsSymbolDisplayInfo; if the symbol is a "get" accessor declaration, the function returns null, which causes the logic of the code action to be skipped.

@@ -831,8 +831,7 @@ describe('completions', () => {
expect(ts.displayPartsToString(details.documentation!)).toEqual('This is another component.');
});

// TODO: check why this test is now broken
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken because the completion item for the attribute only includes the directive in the component scope.

Add logic to provide code actions for auto-importing directives that
are out of scope.
@ivanwonder ivanwonder force-pushed the support-auto-import-for-attribute branch from 286e034 to 451f83f Compare July 30, 2025 13:16
@ivanwonder ivanwonder marked this pull request as ready for review July 30, 2025 13:24
@pullapprove pullapprove bot requested a review from crisbeto July 30, 2025 13:24
@ivanwonder
Copy link
Contributor Author

@atscott PTAL

@ivanwonder
Copy link
Contributor Author

attribute-completion.mov

@crisbeto crisbeto requested review from atscott and removed request for crisbeto July 30, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: language-service Issues related to Angular's VS Code language service detected: feature PR contains a feature commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy