GithubHelp home page GithubHelp logo

Comments (24)

dustinmichels avatar dustinmichels commented on May 25, 2024 81

Update: These settings seem to work for my needs.

  "files.associations": {
    "*.html": "html",
    "**/templates/**/*.html": "django-html"
  },

Would this be a better configuration to include in the README?

from vscode-django.

washie254 avatar washie254 commented on May 25, 2024 49

Update: These settings seem to work for my needs.

  "files.associations": {
    "*.html": "html",
    "**/templates/**/*.html": "django-html"
  },

Would this be a better configuration to include in the README?

This Totally worked for me. -> in case you're lost

  1. access settings use Ctrl+,
  2. search file.association on the search bar
  3. select ' edit in settings.json '
  4. append this section in "files.associations":
 "*.html": "html",
"**/templates/**/*.html": "django-html"

from vscode-django.

Pixelshot avatar Pixelshot commented on May 25, 2024 6

I thought at last i got the answer.BUT,
"files.associations" comes up when i search it in settings but, ' edit in settings.json ' option is not present for this one.
It just shows:
image

You can insert them individually as below

Screenshot 2020-11-15 230057

from vscode-django.

Bishwas-py avatar Bishwas-py commented on May 25, 2024 5

I want this problem in my VSCODE. How to get this problem, please?

from vscode-django.

enricoreich avatar enricoreich commented on May 25, 2024 5

So, after vscode is recognizing django templates as django templates, how do I get all the html and emmet feature back? I mean features like html intellisense, code completion and formatting etc...

for formatting I tried in settings.json:

"[django-html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  }

but it does not work. I don't want to install additional extensions like beautify or prettier because they don't support django templates and are making formatting even worse. But it would be enough for me to get IntelliSense and code completion back. Any ideas? Thanks!

from vscode-django.

VladIftime avatar VladIftime commented on May 25, 2024 5

So, after vscode is recognizing django templates as django templates, how do I get all the html and emmet feature back? I mean features like html intellisense, code completion and formatting etc...

for formatting I tried in settings.json:

"[django-html]": {
    "editor.defaultFormatter": "vscode.html-language-features"
  }

but it does not work. I don't want to install additional extensions like beautify or prettier because they don't support Django templates and are making formatting even worse. But it would be enough for me to get IntelliSense and code completion back. Any ideas? Thanks!

I found that you have to add the following line to VSCode's settings.json:
"emmet.includeLanguages": {"django-html": "html"}

This fixed it for me, hope it helps.

from vscode-django.

eykanal avatar eykanal commented on May 25, 2024 3

Solved in this thread. In summary:

  1. Install Beautify by HookyQR (to allow modifying file type formatters)
  2. Add the following to your user settings file:
"beautify.language": {
    "html": [
        "htm", "html", "django-html"
    ]
},

from vscode-django.

Fate1405 avatar Fate1405 commented on May 25, 2024 2

*.html
**/templates/**/*.html

In case you were too lazy to type it out lmao.

from vscode-django.

Ritik-Creates avatar Ritik-Creates commented on May 25, 2024 1

Thanks.... I was getting messed up in my server due to this

from vscode-django.

fedepuleio avatar fedepuleio commented on May 25, 2024 1

I thought at last i got the answer.BUT,
"files.associations" comes up when i search it in settings but, ' edit in settings.json ' option is not present for this one.
It just shows:
image

You can insert them individually as below

Screenshot 2020-11-15 230057

you made my day, THANKS!!!!

from vscode-django.

sammanamgain avatar sammanamgain commented on May 25, 2024 1

just uninstall Django in extension problem solved

from vscode-django.

batisteo avatar batisteo commented on May 25, 2024 1

Thanks for your patience. I found the undocumented filenamePatterns key (see commit) and it should work as expected now.

🗑️ You can remove the file associations in your settings, for both django-html and html, as this extensions shouldn’t be that eager with HTML files.

I hope it will reduce the frustration of you guys and new comers.

from vscode-django.

dustinmichels avatar dustinmichels commented on May 25, 2024

I am having problems with this, too.

Configuring the "file.associations" settings seems like the right approach, but even when I add the suggested snippet to my settings, all HTML files get recognized as "django-html."

"files.associations": {
    "**/templates/*.html": "django-html",
    "**/templates/*": "django-txt",
    "**/requirements{/**,*}.{txt,in}": "pip-requirements"
},

Shouldn't this snippet cause only html files in a templates/ folder to be recognized as "django-html"? Am I missing something?

from vscode-django.

Networkqueen avatar Networkqueen commented on May 25, 2024

Thank you so much this worked for me

from vscode-django.

PianoHallvard avatar PianoHallvard commented on May 25, 2024

Excellent! This has bugged me for months
I just uninstalled django

from vscode-django.

antonygatua avatar antonygatua commented on May 25, 2024

Thanks works for me too!

from vscode-django.

AlessandroCF avatar AlessandroCF commented on May 25, 2024

Thank you for your very valuable advice, it helped me a lot.
Best regards

from vscode-django.

zia-ashraf avatar zia-ashraf commented on May 25, 2024

I thought at last i got the answer.BUT,
"files.associations" comes up when i search it in settings but, ' edit in settings.json ' option is not present for this one.
It just shows:
image

from vscode-django.

eriker75 avatar eriker75 commented on May 25, 2024

Thank you very much

from vscode-django.

Seek4samurai avatar Seek4samurai commented on May 25, 2024

Update: These settings seem to work for my needs.

  "files.associations": {
    "*.html": "html",
    "**/templates/**/*.html": "django-html"
  },

Would this be a better configuration to include in the README?

This is the perfect solution. Hands down.

from vscode-django.

michael-hll avatar michael-hll commented on May 25, 2024

Update: These settings seem to work for my needs.

  "files.associations": {
    "*.html": "html",
    "**/templates/**/*.html": "django-html"
  },

Would this be a better configuration to include in the README?

This worked for me... Thanks a lot.

This worked for me... Thanks a lot.

from vscode-django.

batisteo avatar batisteo commented on May 25, 2024

@michael-hll Have you updated the extension and tried to remove the html file associations?

from vscode-django.

DanSiGo avatar DanSiGo commented on May 25, 2024

Update: These settings seem to work for my needs.

  "files.associations": {
    "*.html": "html",
    "**/templates/**/*.html": "django-html"
  },

Would this be a better configuration to include in the README?

this worked for me, but wrote "/templates//*.html": "html" instead

don't know why to use "django-html", but didn't get intellisense with it

from vscode-django.

vedika-gupta avatar vedika-gupta commented on May 25, 2024

This Totally worked for me. -> in case you're lost

  1. access settings use Ctrl+,
  2. search file.association on the search bar
  3. select ' edit in settings.json '
  4. append this section in "files.associations":
 "*.html": "html",
"**/templates/**/*.html": "django-html"

Hey! This worked for me but I am still not able to use doctype file using shift + 1.

from vscode-django.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.