I just recently started working with flask and jinja. I installed Better Jinja for templating and it works fine after I set the Language Mode to Jinja HTML, but it's annoying to have to change that setting every time. Is there a way to make that the default (not sure if there's a problem with having files with Jinja set to Jinja HTML) or to have it change automatically when I enter that code?
use the setting
"files.associations": {
"*.html": "jinja"
}
You can change this setting on workspace level.
Related
I am developing a VSCode extension that register a custom editor, this editor uses a webview to show the file.
I am using "Buffer.toString" to read the text part of the file, I would like use the setting "file.encoding" to use the current encoding but the values looks does not correspond to nodejs ones.. there is some package I can use for this? maybe I miss some VSCode API methods?
I would like also add the possibility of "reopen with encoding" on my editor. Is it possible use the already exists menu?
I see that VSCode uses iconv-lite to support different encoding, and I must do from scratch the support for "reopen with encoding"
Is there any way to get another editor, like VSCode, to format code ( JavaScript in my case, if it matters ) like the WebStorm IDE formats code by default? I'm not familiar with that IDE, but I'm hoping that it uses a config of some sort that can maybe be exported and imported in another editor. I tried looking for one, but couldn't find anything.
The core problem, if it matters, is that all of our team members use WS to write code and they use the built in formatter, so if I use another one it creates inconsistencies and long commits when editing already written files. As you are probably guessing by now, I would like to use another editor, because I find IDE's bloated and slow.
I don't know if there is a way to import Webstorm formatting rules into VS Code, but I think there is another solution:
I remember in one of the projects i worked on, we used a linter which also auto-formatted code. The advantage is that Webstorm and VSCode can pick pick the linter rules automatically, and then you have same formatting on both.
The downside is that you would need to agree with the team on what does rule will be and then configure them on the linter.
I want to use prettier for formatting my ejs files by adding custom rules.
Right now I am using files associations of html for ejs files.
I have added the following code in the settings.json file:
"files.associations": {
"*.ejs": "html"
},
Unfortunately Prettier does not currently support EJS. The list of supported languages are listed in their docs https://prettier.io/docs/en/index.html
However, they do support plugins so someone could add support https://prettier.io/docs/en/plugins.html
Very late to the party, I know, but I have just installed this https://marketplace.visualstudio.com/items?itemName=j69.ejs-beautify, added the necessary properties to the settings.JSON file and upon reload, it works beautifully.
EDIT
This now formats the EJS file, with all indentation correct, resulting in a much easier to read and edit EJS file.
I'm using p(...) as a shortcut for console.log(...) in JavaScript. And every time I use it VSCode auto-comlete it into package(...).
Seems like there are couple of different code generation and JS variables auto-comlete support. Is there a way to know where that package come from and how to disable it? Visually it looks like that:
I've been using PhpStorm for awhile, for PHP as well as JS. I would love, however, to switch to VSCode since it's lighter, open source and free. But one feature that I cannot quite carry over with extensions is Code Style settings.
PhpStorm has a sweet visual interface in settings that allows you to set up detailed code style rules with live examples right there. ESLint, unfortunately, doesn't have anything similar - it's all text rules (which is a drag and takes forever to set up).
So I'm wondering if there's any way at all to export PhpStorm code style settings as ESLint rules? Or if there's an app that has a similar interface to set up ESLint? Or maybe there's a VScode extension that I am missing that has a similar interface?