Nope, you can’t extend a syntax (just clone it or inject new scopes into its cracks) – we’ve kinda gone full circle on that. But, and that is the gist of what I was trying to tell you: there is absolutely nothing wrong with defining Perch syntax scopes more specialised than HTML scopes, not if completions are what worries you.
Syntax and completions are different concerns, they should be treated separately: define your syntax so that it works first, define completions complementing that syntax second.
I specialize in running circles around things!
I should have said that up front. Can’t thank you enough fro your help.
Yes, I’m going to concentrate on getting the syntax working correctly first, then make sure my completions work. – Monty
I think I got it! It’s working really well. I finally understood what you were saying and I think I have the right balance of scopes. Thank you so much for getting me there. I wouldn’t have made it without your help. Most grateful as you’ve helped me create a much more usable workspace for what I do.
The only think I would like to figure out now is how to get some completions to open up the selection automatically without the user interaction. The bootstrap 5 extension does that on a <h1 class=“[cursor]”, but I can’t see how they are doing that. It would be very helpful in a couple places where Perch is expecting one of several possible values. Thanks, Martin!
You can’t, and neither can the Bootstrap extension. What that extension does is to anchor its completions on the opening quote of attributes, so the user does not need to type any letter of the attribute‘s value at all. Look at its provider:
and note the
[a-zA-Z0-9-_]* part of the
<expression> anchor: zero or more ASCII word characters. It might look like no user interaction, but it is not – just an early anchoring making sure you get completions as soon as you type the quote.