vscode-twig-language-2
vscode-twig-language-2 copied to clipboard
Does not allow all HTML intellisense to pass through
Even though I added the configuration settings specified in the ReadMe, I am not able to trigger intellisense for all HTML attributes when editing a Twig file.
Example:
In an HTML
file, I can type <div role
, and I will get a nice list of possible values for the role
attribute.
If I type the same string into a HTML (Twig)
file, the intellisense dropdown only contains the closest twig-specific match: requirelogin
.
I have the same issue : making this extension work properly with HTML IntelliSense when working with twig files. In my HTML files I can type <div>
and have the autocomplete add </div>
while indenting properly aswell. In my twig file typing <div>
just won't do anything. Also typing any attributes on any tag has no autocomplete.
I have added the : "files.associations": { "*.html": "twig" }, "emmet.includeLanguages": { "twig": "html" }
In my preference file, but I cannot make it work. I have tried on two different environment (here at home, on my PC/Windows 10 fresh install to test it without any extensions) and at work (Mac OSX High Sierra).
Any suggestions ?
i have the same issue with @wonkeythemonkey , is there any solution for this?
I am also having this issue - I have been fighting it in both Twig and Smarty. The best I have come up with is this, and it's a hack, and I would love for this to just work.
Always working in a twig file *.html.twig
I have the settings as
"files.associations": {
"*.html.twig": "html"
},
This drops all Twig related highlighting and intellisense but treats the file as html
giving me all the actions and behaviours we expect when coding in html. When I am coding heavy in twig stuff, or just want to see better syntax highlighting, I just comment out the line
"files.associations": {
// "*.html.twig": "html"
},
Is there a way to "passthrough" the default html
file associated behaviours and just add to them the twig extras?
FYI, I just installed the "other" Twig Language v0.2.9 and html intellisense does work!
I agree with @webmasterMeyers it works perfectly with Twig Language extension version 1 and not this one (version 2). Which is odd. I'm glad something works because in order to have CSS Peek support, which is a huge workflow improvement, you have to able to associate .twig
files as html
.
Also having this issue, is it best to revert back to Version 1 until resolved?
I would since it seems to work better.
Yep you guys a spot on, simply install Twig Language 1 instead of Twig Language 2 to get all the benefits of HTML Intellisense. Just make sure to change your file associations in the VS Code settings to:
"files.associations": {
"*.twig": "html",
},
The primary issue I had with my own extension was that on the odd occasion, HTML would take precedence over Twig which would break some of the plugins features. Therefore the trade-off with Twig Language 2 is that there is no HTML Intellisense and the trade-off with Twig Language 1 is that sometimes comments aren't working. Take your pick 😄
(Or hopefully someone with more VS Code extension experience can submit a pull request and save the day 🙏 )
Ok thank you, will stick with V1 for now. 😄
Stale issue message
Is there a way in this great plugin to include the HTML auto-complete in the TWIG files?
Or in other words: Is this still a planned feature?
Any updates? I have to switch between extension names .html and .twig in order for one or the other intellisense to work.
I've recently moved to using VSCode for symfony development, and found that the emmet expansions don't work with this extension. I followed the directions to add the recommended configuration to the settings.json.
Since coding twig is 98% coding html most of the time, I was forced to uninstall.
Currently im using Twig Langauge 2 from mblode with this solution: https://stackoverflow.com/a/74107867/11592836.
Copy from above SO answer:
Just go to your VSCode Settings > in User tab > Extensions > Emmet. All you have to do is adding an item in "Include languages".
Item : twig Value : html
So in VSC you do: ctrl + shift + p
, write user settings
select the first one, go to extensions
, go to emmet
and add the item under include langauges
.
Or you could also manually do this by adding the following to your setting.json (get there by doing ctrl
+ shift
+ p
and write settings
, then select the settings (JSON). It should open settings.json
):
"emmet.includeLanguages": {
"twig": "html"
},
Make sure to remove the following from your settings.json:
"files.associations": {
"*.twig": "html"
},
It can be usefull to go to your twig file and do ctrl
+ shift
+ p
and write Change Langauge Mode
and then click Auto Detect
. This will detect the correct file assossiation in case you messed things up.