angular / vscode-ng-language-service

Angular extension for Visual Studio Code
MIT License
781 stars 117 forks source link

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

Closed ivanwonder closed 4 months ago

ivanwonder commented 6 months ago

…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 commented 6 months ago

Blocked by PR

dylhunn commented 5 months ago

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

Error: Recevied parameters by name but param is not an object literal.
ivanwonder commented 5 months ago

@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 commented 5 months ago

https://github.com/angular/vscode-ng-language-service/assets/15815660/02382282-8c3e-4a71-815b-67e7966d5e65

https://github.com/angular/vscode-ng-language-service/assets/15815660/e8879515-4f0e-4738-b360-bf87da6095b8

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 commented 4 months ago

error @angular/language-service@18.1.0-next.2: 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.

dylhunn commented 4 months ago

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 commented 4 months ago

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...

dylhunn commented 4 months ago

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

ivanwonder commented 4 months ago

@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.

angular-automatic-lock-bot[bot] commented 3 months ago

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.