Theia: editorconfig not working as expected

Created on 11 Feb 2019  路  10Comments  路  Source: eclipse-theia/theia

The .editorconfig file at the top of my workspace has no effect on any file.
See this screenshot, foo.tsx is not getting the indentation right:
image
My package.json:

{
  "private": true,
  "dependencies": {
    "@theia/callhierarchy": "latest",
    "@theia/editorconfig": "^0.3.19",
    "@theia/file-search": "latest",
    "@theia/git": "latest",
    "@theia/json": "latest",
    "@theia/markers": "latest",
    "@theia/merge-conflicts": "latest",
    "@theia/messages": "latest",
    "@theia/mini-browser": "^0.3.19",
    "@theia/navigator": "latest",
    "@theia/outline-view": "latest",
    "@theia/preferences": "latest",
    "@theia/preview": "latest",
    "@theia/python": "latest",
    "@theia/search-in-workspace": "latest",
    "@theia/terminal": "latest",
    "@theia/textmate-grammars": "latest",
    "@theia/typescript": "latest",
    "typescript": "latest"
  },
  "devDependencies": {
    "@theia/cli": "latest"
  }
}
bug editorconfig

All 10 comments

It is completely broken with 34e35a90.

Thanks @kittaakos, what changes (In my package.json) should I do to have a working version? Could you post a nice package.json?

Could you post a nice package.json?

I cannot. I think it is broken in general. I built and started a Theia instance from the source, and I experienced the same defect.

I am still on 34e35a90 and I can see the following errors in the browser's console:

logger-protocol.ts:112 root ERROR Error: onWillSave listener loop timeout
    at http://localhost:3000/20.bundle.js:448:36
log @ logger-protocol.ts:112
(anonymous) @ logger-frontend-module.ts:41
(anonymous) @ logger.ts:312
(anonymous) @ logger.ts:304
Promise.then (async)
../../packages/core/lib/common/logger.js.Logger.log @ logger.ts:299
log @ logger.ts:45
(anonymous) @ monaco-editor-model.js:501
step @ monaco-editor-model.js:58
(anonymous) @ monaco-editor-model.js:39
rejected @ monaco-editor-model.js:31
Promise.then (async)
step @ monaco-editor-model.js:32
(anonymous) @ monaco-editor-model.js:33
push.../../packages/monaco/lib/browser/monaco-editor-model.js.__awaiter @ monaco-editor-model.js:29
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.fireWillSaveModel @ monaco-editor-model.js:427
(anonymous) @ monaco-editor-model.js:402
step @ monaco-editor-model.js:58
(anonymous) @ monaco-editor-model.js:39
(anonymous) @ monaco-editor-model.js:33
push.../../packages/monaco/lib/browser/monaco-editor-model.js.__awaiter @ monaco-editor-model.js:29
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.doSave @ monaco-editor-model.js:394
(anonymous) @ monaco-editor-model.js:348
(anonymous) @ monaco-editor-model.js:242
step @ monaco-editor-model.js:58
(anonymous) @ monaco-editor-model.js:39
(anonymous) @ monaco-editor-model.js:33
push.../../packages/monaco/lib/browser/monaco-editor-model.js.__awaiter @ monaco-editor-model.js:29
(anonymous) @ monaco-editor-model.js:236
Promise.then (async)
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.run @ monaco-editor-model.js:236
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.scheduleSave @ monaco-editor-model.js:348
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.save @ monaco-editor-model.js:232
(anonymous) @ saveable.ts:69
step @ saveable.ts:15
(anonymous) @ saveable.ts:15
(anonymous) @ saveable.ts:15
../../packages/core/lib/browser/saveable.js.__awaiter @ saveable.ts:15
save @ saveable.ts:66
(anonymous) @ application-shell.ts:1341
step @ application-shell.ts:15
(anonymous) @ application-shell.ts:15
(anonymous) @ application-shell.ts:15
../../packages/core/lib/browser/shell/application-shell.js.__awaiter @ application-shell.ts:15
../../packages/core/lib/browser/shell/application-shell.js.ApplicationShell.save @ application-shell.ts:1340
execute @ common-frontend-contribution.ts:423
../../packages/core/lib/browser/keybinding.js.KeybindingRegistry.tryKeybindingExecution @ keybinding.ts:486
../../packages/core/lib/browser/keybinding.js.KeybindingRegistry.run @ keybinding.ts:534
(anonymous) @ frontend-application.ts:165
14:16:23.781 logger-protocol.ts:112 root ERROR onWillSave listeners should provide edits, not directly alter the documen

@svenefftinge, can you please clarify what the expected behavior is? After changing the JS/TS indentation from 4 to 20 and saving the .editorconfig, I would have expected that the indentations will be adjusted in the JS/TS editor onWillSave. Thank you!

@kittaakos if editorconfig is not working how can I set the indent style for all files? Is it still possible? Can I set indentation style by type file? Thanks a lot.

@adrienrenaud you can configure indentation per a language in Theia settings, for instance: https://github.com/theia-ide/theia/blob/master/.theia/settings.json Use content assist to discover more settings.

If this should be configured in the settings.json why do we have the .editorconfig?

.editorconfig for editor agnostic settings, i.e. if someone does not use Theia or VS Code for development

There seems to be a bug indeed in Theia editoconfig extension that it is not capable to pick up language specific settings.

I think I just got bitten by this bug. I also noticed that my .editorconfig file was not taken into account to set the editor whitespace settings.

The properties for a file are supposed to be applied to a given editor by EditorconfigDocumentManager.applyProperties. However, there are no calls to that method outside of tests, so it's not surprising it doesn't work.

@svenefftinge, commit 260d7949982311fe425e91135ad9251beb212dea removed the call to applyProperties.

Was this page helpful?
0 / 5 - 0 ratings