Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.6.5 does not honor tab size settings #135

Closed
zgoda opened this issue Apr 10, 2017 · 25 comments
Closed

0.6.5 does not honor tab size settings #135

zgoda opened this issue Apr 10, 2017 · 25 comments

Comments

@zgoda
Copy link

zgoda commented Apr 10, 2017

editorconfig-vscode version: 0.6.5

Expected behavior

Tab size settings applied to editor in workspace

Actual behavior

Invalid tab size in editor

Steps to reproduce the behavior

root = true

[*]
indent_style = space
indent_size = 4

[*.{c,cpp,h,hpp,proto}]
indent_style = tab
indent_size = 2

indent_style is tab but I still see indent_size = 4 in editor:

zrzut ekranu z 2017-04-10 09-30-12

@zgoda
Copy link
Author

zgoda commented Apr 10, 2017

Moreover, for new files it does not honor neither indent_style nor indent_size, everything is indented by 4 spaces. It does not matter if the configuration is local to workspace directory or placed in one of parent dirs.

Standalone editorconfig shows valid configuration:

$ editorconfig include/websrv.h 
indent_style=tab
indent_size=2
tab_width=2

@kalinchernev
Copy link

kalinchernev commented Apr 10, 2017

I also feel pain about this.
In the project folder:

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

Every file starts with 4 spaces ... (it's really annoying to be honest)

@Guillaumez
Copy link

Same problem ! I now have 4 spaces instead of 2

@jednano
Copy link
Member

jednano commented Apr 10, 2017

Having issues reproducing. If someone can tell me the following:

  1. Both your user and workspace settings for the following:
  • editor.insertSpaces
  • editor.tabSize
  1. Your .editorconfig file (the whole thing).
  2. The file path of the file in question.
  3. What the EditorConfig output window is printing out.

@jednano
Copy link
Member

jednano commented Apr 10, 2017

@zgoda by "new files" do you mean untitled documents? EditorConfig works off of the full file path, including extension, so that would make some kind of sense. That said, I just published v0.7.0 to assume untitled documents live at the workspace root. That should help at least get the default EditorConfig settings in there.

@guzart
Copy link

guzart commented Apr 10, 2017

Updating to v0.7.0 solved this issue for me. Thank you

@jednano
Copy link
Member

jednano commented Apr 10, 2017

@guzart, v0.7.0 only added a feature to apply EditorConfig to new/untitled documents. There were no specific fixes to this issue, so I'm a bit confused how that would be true.

@marcincichocki
Copy link

marcincichocki commented Apr 10, 2017

My config wasn't working on vs code 1.11.1 and editorconfig for vs code 0.7. I've downgraded to vs code 1.10.2 and editorconfig for vs code 0.6.2 and everything is working again.

# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false

user settings:

{
    "typescript.check.tscVersion": false,
    "stylelint.enable": true,
    "scss.validate": false,
    "files.associations": {
        "*.vue": "vue"
    },
    "workbench.iconTheme": "vs-seti",
    "css.validate": false,
    "keyboard.dispatch": "keyCode"
}

EDIT:

I'm using ubuntu 16

@guzart
Copy link

guzart commented Apr 11, 2017

@jedmao I mistakenly thought it fixed the issue but it doesn't, apologize for any confusion

@strothj
Copy link

strothj commented Apr 11, 2017

I'm also experiencing the same issue as @marcincichocki. My tab setting in new and existing is not being honored. Problem started after a recent update to VSCode. I've tried removing and reinstalling the extension. I've also made sure the corresponding extension folder was removed.
I'm also using Ubuntu 16.04 and VSCode 1.11.1.
For now I've had to set the default in VSCode settings: "editor.tabSize": 2

@jednano
Copy link
Member

jednano commented Apr 11, 2017

Is anyone experiencing this issue who is NOT on Linux?

@jednano
Copy link
Member

jednano commented Apr 11, 2017

Still cannot reproduce on Windows 10. Here's my .editorconfig:

root = true

[*]
indent_style = space
indent_size = 4

[*.ts]
indent_style = tab
indent_size = 2

And here's what I see printed in the EditorConfig output window when I switch to foo.ts:

Applying configuration to foo.ts...
Using configuration map...
foo.ts: {"insertSpaces":false,"tabSize":2}

I really want to fix this ASAP, guys, but I can't repro. Nobody can provide better repro steps? Please refer to the new ISSUE_TEMPLATE.md for guidance.

Also, @zgoda, you realize you can set tab_width = 2 too, right?

@ianlini
Copy link

ianlini commented Apr 11, 2017

Hi, @jedmao. In my case, there is no any output (no EditorConfig option in the output window). I think the extension fails to start.
I also found that there are some error messages at the developer tools:

[Extension Host] Activating extension `EditorConfig.EditorConfig` failed: Cannot find module './InsertFinalNewline'.
[Extension Host] Activating extension `EditorConfig.EditorConfig` failed:  Cannot find module './InsertFinalNewline'
[Extension Host] Here is the error stack:  Error: Cannot find module './InsertFinalNewline'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Function.J.i._load (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:4:374825)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/bist/.vscode/extensions/EditorConfig.editorconfig-0.7.0/out/src/transformations/index.js:2:28)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Function.J.i._load (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:4:374825)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/bist/.vscode/extensions/EditorConfig.editorconfig-0.7.0/out/src/DocumentWatcher.js:14:27)
    at Module._compile (module.js:556:32)
Activating extension `EditorConfig.EditorConfig` failed: Cannot find module './InsertFinalNewline'.

@ianlini
Copy link

ianlini commented Apr 11, 2017

I can reproduce this error with empty project.

@jednano
Copy link
Member

jednano commented Apr 11, 2017

@ianlini thank you! I know exactly what's going on now. I must have done a rename on that particular file at some point and because I already had insertFinalNewline.js in my compiled out/ folder, every time I ran the TypeScript compiler w/ the tsc command it just overwrote it w/o changing it to InsertFinalNewline.js. Notice the capital "I" at the beginning! I'm going to publish a patch right now.

@jednano jednano mentioned this issue Apr 11, 2017
@jednano
Copy link
Member

jednano commented Apr 11, 2017

I believe it's fixed in #142, published as v0.9.1. Please, let me know if that fixes it or if y'all continue to experience issues. Such a weird bug today! Be happy to reopen the issue if it's not solved.

@ianlini
Copy link

ianlini commented Apr 11, 2017

Thank you @jedmao! v0.9.1 fixed my problem.

@JimiC
Copy link

JimiC commented Apr 11, 2017

@jedmao Case-sensitivity is a bitch when developing on Windows and targeting Unix-style OS. Maybe you should add "forceConsistentCasingInFileNames": true in your tsconfig.json.

@zgoda
Copy link
Author

zgoda commented Apr 11, 2017

Works fine, thank you.

@jednano
Copy link
Member

jednano commented Apr 11, 2017

@JimiC that wouldn't solve the problem. It's a bit hard to explain, but a long time ago in Windows history I used to have this scenario in which I would have a file, say, named foo.js on my file system. I hit F2 to rename the file to Foo.js and hit ENTER, only to find that the new case was not assigned to the file name. Nowadays, with Windows 10, this is no longer a problem, however, when running the tsc compiler, with a file named foo.ts, it creates an output file of foo.js, which I never cleaned up. So I rename foo.ts to Foo.ts and the next time I run tsc it attempts to write the new Foo.js file to output, but according to Windows, the file already exists. It writes the new file contents, but doesn't change the "existing" file name. I have to delete the damn file before tsc will output the correct case! Crazy, right?

@JimiC
Copy link

JimiC commented Apr 11, 2017

@jedmao I always use a precompile npm script with rimraf ./outDir. Saves the hassle.

@jednano
Copy link
Member

jednano commented Apr 11, 2017

I do too, on most projects. I've never had this specific problem before though.

@jednano
Copy link
Member

jednano commented Apr 11, 2017

@JimiC I just created a TypeScript issue at microsoft/TypeScript#15129 that might better illustrate what's going on.

@jednano jednano mentioned this issue Apr 11, 2017
@bmacnaughton
Copy link

bmacnaughton commented Apr 11, 2017

I don't know that this is related but EditorConfig stopped working for me altogether. I believe it is when I updated to vs code 1.11.1 but am not positive.

My .editorconfig file is in the git root of the project.

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js, vue, scss}]
indent_size = 2

There is not another .editorconfig file in that file hierarchy. I'm running on Linux and it seems as if the .editorconfig file is being ignored altogether. Is there some way to check if it is found?

@jednano
Copy link
Member

jednano commented Apr 11, 2017

@bmacnaughton please file a separate issue w/ the new issue template filled in. I think that'll help the most. I need to know what extension version you have too. Really need to be thorough to fix issues like this one.

If the extension loads at all, you should be able to see changes in the EditorConfig output window. In vscode, select View -> Output to see the output window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants