Comments (21)
hey guys, I experienced similar issue and I believe I found the solution - find "editor.detectIndentation" setting and set it to 'false', it will cause to apply indents from settings rather than detect it based on the file you opened. After that just go to file and use Format Code feature, it worked for me and hopefully will work for you.
from editorconfig-vscode.
I am having a similar issue, I don't know if it is the same thing though. When I format an html file the editor config definition that says 'indent_style: space' is not respected. Oddly enough this only seems to affect html files.
I have a gif below that reproduces the issue, the leading spaces ('.') turn into tabs ('->'). I have the .editorConfig file open to the right, and you can see the status bar shows spaces:2 on the indent settings yet when I do the format it still converts to tabs.
Also I am not sure this is an issue with editor config or vs code itself (not sure if editorconfig handles the formatting or if vs code does), I apologize if this is in the wrong place.
from editorconfig-vscode.
In my case, I disabled the JS-CSS-HTML-formatter and it started working. Hope it helps.
from editorconfig-vscode.
In my case the problem was caused by the Prettier - code formatter plugin, because it respects prettier configuration files before .editorconfig files. So if you have this plugin enabled and have a .prettierrc.json file, it will overwrite the .editorconfig settings.
In my case disabling formatOnSave for specific file types helped.
"editor.formatOnSave": true,
"[json]": {
"editor.formatOnSave": false
}
from editorconfig-vscode.
Disabling all other extensions changes nothing and the issue still applies.
from editorconfig-vscode.
Have found a relevant issue for VS Code: microsoft/vscode#13563
from editorconfig-vscode.
@Adeynack you saved my day!
from editorconfig-vscode.
I have to disable EditorConfig.EditorConfig extention on vscode. It auto format files which cause cursor move suddenly even though editor.formatOnSave
is false.
from editorconfig-vscode.
Can you be more specific? Which setting? What does your .editorconfig
file look like? If you use an EditorConfig CLI utility like editorconfig
, does the file in question have the expected settings?
from editorconfig-vscode.
I experience same issue! Here is my .editorconfig:
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
[*.md]
trim_trailing_whitespace = false
# Matches the exact files package.json and .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
[Makefile]
indent_style = tab
Here is my VSCode settings:
{
"editor.fontSize": 14,
"editor.renderWhitespace": "all",
"editor.tabSize": 4,
"editor.insertSpaces": true
}
When I open package.json
file and use auto formating (OPTION+SHIFT+F) it correctly format based on my settings in .editorconfig
, but then when I save the file, it fall into a loop. I think two rules fighting to override each other, one try to make it 2 space (.editorconfig) and the other one 4 space (VSCode settings)!
from editorconfig-vscode.
Actually that works perfectly fine here. I thought #76 was the thing causes the extension to fail, but it actually still works as expected on my system.
It might be caused by another plugin though. Care to disable all the installed plugins and only use this one? Just to make sure it's not another extension interferring with this one.
Also all the tests still pass (I know, not always accurate but still).
from editorconfig-vscode.
@SEGEEK I don't think this is an issue with EditorConfig but rather with the autoformatter. Try disabling this extension and save that file again. If it still fails, it's something else. Do you have other extensions installed? If so, try disabling them all and try formatting again. And if that still fails, open an issue in the VS Code repository.
from editorconfig-vscode.
I have to confirm that @SEGEEK's explanation is the most clear and correct. The issue seems to have nothing to do with file saving, but rather with using the "Format Code" feature.
from editorconfig-vscode.
The main question is, is it our extension or is it VS Code. Although less likely, it seems to me that it's a bug in VS Code as the EditorConfig settings are being applied correctly (hence the lower right corner). Don't have the time to look into it though but like I said, try without this plugin (and without any plugins) and try again.
from editorconfig-vscode.
If I uninstall EditorConfig, the issue still applies. Another important note is that the issue seems to apply only to working with *.html files, but not *.js or *.vb files
from editorconfig-vscode.
Do you have an html formatter extension installed or something? If not, just file an issue in the VS Code repository.
from editorconfig-vscode.
I believe @Maximaximum is correct ... just to try it out I disabled all of my extensions and it still occurred.
I appreciate you looking into this @SamVerschueren, sorry if I took you off task with the distraction, hopefully it will help others running into the same issue.
from editorconfig-vscode.
Glad we figured out the cause of this. Hopefully the VS Code team will fix this asap.
from editorconfig-vscode.
Well ... almost. The keyboard shortcut works, but then some config like insert_final_newline = true
are ignored.
from editorconfig-vscode.
In my case, .editorconfig was ignored because it was at the root of my repo, but not at the root of the VS Code Folder I had open. I had assumed it would honor the "root" editor config in the repo, but it did not.
from editorconfig-vscode.
from editorconfig-vscode.
Related Issues (20)
- Space indent size is not working in VSCode version 1.74 HOT 3
- after restart vscode, the opened file in view is not work at the beginning HOT 1
- `indent_size` overrides `tab_size` for tab characters HOT 2
- VSCode Makefile `spaces` not converted to `tab` on save HOT 1
- editoconfig doesn't work on mac HOT 2
- `insert_final_newline = false` not working HOT 6
- editorconfig was forcing up changes
- Feature request: `trim_trailing_whitespace` only on modified lines
- csharp_new_line_before_open_brace not working
- Feature request: Ability to set a .editorconfig to use
- Plugin is disabled when using an SSH FS workspace
- It is non-obvious when editorconfig is overriding my chosen tab/indent settings
- auto input enter
- Removes spaces in template literal strings (JS/TS)
- EditorConfig doesn't work well in VSCode (in specific files) HOT 1
- Feature request: Disable automatic cursor transfer when adding the last line. HOT 3
- Impossible to manually change indent style/size HOT 1
- insert_final_newline will open all files when using `Search & Replace`
- recoil doesn't work HOT 1
- cursor jumps to next line while writing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from editorconfig-vscode.