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

feat: generate the import declaration for the completion item code ac… #2031

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

ivanwonder
Copy link
Contributor

…tions

In the completion item, the additionalTextEdits can only be included the changes about the current file, the other changes should be inserted by the vscode command.

For example, when the user selects a component in an HTML file, the extension inserts the selector in the HTML file and auto-generates the import declaration in the TS file.

@ivanwonder ivanwonder force-pushed the generate-import-for-autocompletion branch 3 times, most recently from d057ecd to be1a229 Compare May 6, 2024 14:48
@ivanwonder ivanwonder marked this pull request as ready for review May 6, 2024 14:52
@ivanwonder
Copy link
Contributor Author

Blocked by PR

@ivanwonder ivanwonder force-pushed the generate-import-for-autocompletion branch from be1a229 to 6950674 Compare May 7, 2024 13:04
@dylhunn dylhunn self-requested a review May 16, 2024 17:11
@dylhunn
Copy link
Collaborator

dylhunn commented May 16, 2024

@ivanwonder Looks like the CI is failing, due to the new test:

Error: Recevied parameters by name but param is not an object literal.

@dylhunn dylhunn added cleanup Cleanup needed before PR could be merged target: minor This PR is targeted for the next minor release labels May 16, 2024
@angular-robot angular-robot bot requested a review from dylhunn May 19, 2024 04:07
@ivanwonder
Copy link
Contributor Author

@ivanwonder Looks like the CI is failing, due to the new test:

Error: Recevied parameters by name but param is not an object literal.

The two new tests depend on the code of the language service PR. I remember there was a snapshot version for every PR before. I want to update the @angular/language-service version to it, but I can't find it.

@ivanwonder
Copy link
Contributor Author

template-in-html.mov
template-in-ts.mov

Now the format is not perfect. For example, when the imports array has multi-line, the indentation of the identifier in the array is wrong because I only print the PropertyAssignment node, and the indentation of the object is lost. We can optimize it later.

image

@ivanwonder ivanwonder force-pushed the generate-import-for-autocompletion branch from d4fe906 to 7e01a79 Compare June 13, 2024 11:49
@ivanwonder
Copy link
Contributor Author

ivanwonder commented Jun 13, 2024

error @angular/[email protected]: The engine "node" is incompatible with this module. Expected version "^18.19.1 || ^20.11.1 || >=22.0.0". Got "18.13.0"

@dylhunn The node in the docker needs to be updated

I have updated the node version.

pnpm-lock.yaml Outdated Show resolved Hide resolved
@dylhunn
Copy link
Collaborator

dylhunn commented Jun 21, 2024

The substance of the change looks good. But I'm also not sure why changing the language-service version has generated the changes to pnpm lock. @atscott Do you know if this is expected?

@atscott
Copy link
Collaborator

atscott commented Jun 21, 2024

changes to pnpm lock. @atscott Do you know if this is expected?

Yea, this happens when doing yarn bazel run @npm//:sync. You have to instead use global bazel bazel run @npm//:sync to do it...

@ivanwonder ivanwonder force-pushed the generate-import-for-autocompletion branch from b1196a3 to 33b10d1 Compare June 22, 2024 01:48
…tions

In the completion item, the `additionalTextEdits` can only be included the changes about the
current file, the other changes should be inserted by the vscode command.

For example, when the user selects a component in an HTML file, the extension inserts the
selector in the HTML file and auto-generates the import declaration in the TS file.
@ivanwonder ivanwonder force-pushed the generate-import-for-autocompletion branch from 33b10d1 to a2cab20 Compare June 26, 2024 11:38
@ivanwonder ivanwonder requested a review from atscott June 26, 2024 11:47
@dylhunn
Copy link
Collaborator

dylhunn commented Jun 27, 2024

@ivanwonder Is this ready for merge, or do you want Andrew's review also? If so, I'll tag it to be merged

@ivanwonder
Copy link
Contributor Author

@ivanwonder Is this ready for merge, or do you want Andrew's review also? If so, I'll tag it to be merged

Yes, It's ready. It would be better if Andrew had time to take a look.

Copy link
Collaborator

@atscott atscott left a comment

Choose a reason for hiding this comment

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

Really cool! Great work!

@atscott atscott merged commit 68f0d60 into angular:main Jun 27, 2024
5 checks passed
@ivanwonder ivanwonder deleted the generate-import-for-autocompletion branch June 28, 2024 00:23
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cleanup Cleanup needed before PR could be merged detected: feature target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants