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

bug: extra ] gets added on attribute binding completion #2137

Closed
eneajaho opened this issue Jan 20, 2025 · 2 comments · Fixed by #2142
Closed

bug: extra ] gets added on attribute binding completion #2137

eneajaho opened this issue Jan 20, 2025 · 2 comments · Fixed by #2142
Labels

Comments

@eneajaho
Copy link

🐞 bug report

Is this a regression?

No

Description

A clear and concise description of the problem...

  • Press enter

Produces -> <p [title]=""]>

Reproduction

CleanShot.2025-01-20.at.21.02.18.mp4
@eneajaho eneajaho added the bug label Jan 20, 2025
@eneajaho
Copy link
Author

It happens for events too

@ivanwonder
Copy link
Contributor

@eneajaho Setting editor.suggest.insertMode to Replace can fix the problem, but this is not the correct approach.

The Angular extension should prevent developers from altering this behavior. but InsertReplaceEdit provides developers with options. Therefore, we can remove the branch and use TextEdit instead.

I don't have time to fix this now, but I think it's easy.

Maybe @atscott can take a moment to look at this.

https://code.visualstudio.com/updates/v1_51#_status-bar-for-suggestions
microsoft/vscode#10266 (comment)

ivanwonder added a commit to ivanwonder/vscode-ng-language-service that referenced this issue Feb 9, 2025
The Angular Language Service does not return `InsertReplaceEdit`.
There is no need to allow the developer to choose how to insert the completion.

For example, `<button (c|) />`.
                      ^^__________Insert edit
                      ^^ ^________Replace edit

If the LS returns the `InsertReplaceEdit` as shown above, selecting "Insert" by the developer
results in `(click)="")`, and selecting "Replace" results in `(click)=""`.

Now in the vscode, the default `editor.suggest.insertMode` value for HTML is `Replace`, for
ts is `Insert`, So this leads to a bug in the ts file.

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

Successfully merging a pull request may close this issue.

2 participants