Trigger completion in all src and href attributes #117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_ATTRobject (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
isPathAttributewill returntruewhenever the name of the attribute issrcorhref.I could have cleaned up the
PATH_TAG_AND_ATTRobject, as thehrefattribute on theatag 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
hrefandsrcattributes on a fictitious custom element.