Trigger completion in all src and href attributes by gustavnikolaj · Pull Request #117 · microsoft/vscode-html-languageservice (original) (raw)
This PR addresses #101
I went with a slightly different approach than the two suggestions I outlined in the issue.
I decided not to alter the existing logic, which is enabling it in specific attributes where it makes sense by the HTML spec as laid out in the PATH_TAG_AND_ATTR
object (referring to this stackoverflow comment: https://stackoverflow.com/questions/2725156/complete-list-of-html-tag-attributes-which-have-a-url-value/2725168#2725168).
Instead, I added a check before that, such that isPathAttribute
will return true
whenever the name of the attribute is src
or href
.
I could have cleaned up the PATH_TAG_AND_ATTR
object, as the href
attribute on the a
tag is already covered by the early return, but I kept it in there for completeness sake.
I added a test which shows that the completion is now triggered in both href
and src
attributes on a fictitious custom element.