I see errors in the log when editing the user preferences file manually in the preference widget's editor:
root ERROR TypeError: Cannot read property 'startLineNumber' of null
at TextModel.validateRange (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65306:55)
at TextModel._applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65513:47)
at TextModel.applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65504:29)
at MonacoEditorModel.push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:1308:31)
at MonacoEditorModel.<anonymous> (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:1399:50)
at step (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:919:23)
at Object.next (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:900:53)
at fulfilled (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:891:58)
root ERROR TypeError: Cannot read property 'startLineNumber' of null
at TextModel.validateRange (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65306:55)
at TextModel._applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65513:47)
at TextModel.applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65504:29)
at MonacoEditorModel.push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:1308:31)
at MonacoEditorModel.<anonymous> (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:1399:50)
at step (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:919:23)
at Object.next (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:900:53)
at fulfilled (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:891:58)
root ERROR TypeError: Cannot read property 'startLineNumber' of null
at TextModel.validateRange (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65306:55)
at TextModel._applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65513:47)
at TextModel.applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/vs/editor/editor.main.js:65504:29)
at MonacoEditorModel.push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.applyEdits (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:1308:31)
at MonacoEditorModel.<anonymous> (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:1399:50)
at step (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:919:23)
at Object.next (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:900:53)
at fulfilled (file:///Users/akos.kitta/git/theia/examples/electron/lib/31.bundle.js:891:58)
The broken preferences file:
{
"workbench.iconTheme": "theia-file-icons",
"workbench.colorTheme": "Visual Studio Dark",
"yaml.schemas": {
"kubernetes: "a.yaml"
}
}
Note: auto-save was on.
OS and Theia version:
Diagnostics:
I think i fixed it in https://github.com/eclipse-theia/theia/pull/7110. Could you try? The issue was that vscode extensions can provide edits with range as null indicating that the full range should be covered. We did not respect it and passed null as range to Monaco.
Could you try?
Sure.
Could you try?
If I have auto-save on, I can see the following error in the browser console. I got this when editing the workspace preferences:
root ERROR Failed to update the value of 'editor.autoSave' in 'file:///workspace/theia/.theia/settings.json'. Error: Can not add index to parent of type property
at Module.setProperty (https://3000-a6d802f0-bdbd-43d4-9a4f-bbf647e8a32f.ws-eu01.gitpod.io/3.bundle.js:150:15)
at Module.modify (https://3000-a6d802f0-bdbd-43d4-9a4f-bbf647e8a32f.ws-eu01.gitpod.io/3.bundle.js:1575:66)
at FolderPreferenceProvider.<anonymous> (https://3000-a6d802f0-bdbd-43d4-9a4f-bbf647e8a32f.ws-eu01.gitpod.io/39.bundle.js:224:64)
at step (https://3000-a6d802f0-bdbd-43d4-9a4f-bbf647e8a32f.ws-eu01.gitpod.io/39.bundle.js:79:23)
at Object.next (https://3000-a6d802f0-bdbd-43d4-9a4f-bbf647e8a32f.ws-eu01.gitpod.io/39.bundle.js:60:53)
at fulfilled (https://3000-a6d802f0-bdbd-43d4-9a4f-bbf647e8a32f.ws-eu01.gitpod.io/39.bundle.js:51:58)
If I have auto-save off, I can see this when editing the user preferences:
1:25:52.243 logger-protocol.ts:112 root ERROR onWillSave listeners should provide edits, not directly alter the document.
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
r @ backend.js:6
(anonymous) @ monaco-editor-model.js:560
step @ monaco-editor-model.js:58
(anonymous) @ monaco-editor-model.js:39
fulfilled @ monaco-editor-model.js:30
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
(anonymous) @ monaco-editor-model.js:520
(anonymous) @ event.ts:228
step @ event.ts:15
(anonymous) @ event.ts:15
fulfilled @ event.ts:15
Promise.then (async)
step @ event.ts:15
fulfilled @ event.ts:15
Promise.then (async)
step @ event.ts:15
(anonymous) @ event.ts:15
../../packages/core/lib/common/event.js.__awaiter @ event.ts:15
../../packages/core/lib/common/event.js.Emitter.sequence @ event.ts:225
(anonymous) @ monaco-editor-model.js:520
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.fireWillSaveModel @ monaco-editor-model.js:514
(anonymous) @ monaco-editor-model.js:488
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:480
(anonymous) @ monaco-editor-model.js:429
(anonymous) @ monaco-editor-model.js:316
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:310
Promise.then (async)
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.run @ monaco-editor-model.js:310
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.scheduleSave @ monaco-editor-model.js:429
push.../../packages/monaco/lib/browser/monaco-editor-model.js.MonacoEditorModel.save @ monaco-editor-model.js:306
(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:1561
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:1560
execute @ common-frontend-contribution.ts:589
../../packages/core/lib/browser/keybinding.js.KeybindingRegistry.executeKeyBinding @ keybinding.ts:552
../../packages/core/lib/browser/keybinding.js.KeybindingRegistry.run @ keybinding.ts:609
(anonymous) @ frontend-application.ts:193
Note: both the user and the workspace JSON was invalid.
@kittaakos do you use standard setup and only edit to introduce invalid json file?
I can see similar errors at editing tasks.json file on each save.

My steps to reproduce:
do you use standard setup
I am not sure what you mean, @akosyakov. I verified the behavior with #7110 in Gitpod.
@kittaakos ok, i meant you did not add new VS Code extensions or something like that
you did not add
Correct. No, I did not change anything.
@RomanNikitenko can you reproduce it against https://github.com/eclipse-theia/theia/pull/7110? Could you specify how do you edit? What do you enter and where?
Can not add index to parent of type property
I cannot reproduce this issue.
onWillSave listeners should provide edits, not directly alter the document.
It's expected in case if there are some save participants mutating documents directly, it is just logging to bring attention. It does not break saving control flow.
I cannot reproduce the original issue in #7110, so will mark it as fixed.
@akosyakov
I just edit a label for a task, the error occurs when I press ctrl+s to save

please give me 10 min to check it for the defined PR
@akosyakov
Checked, I can not reproduce my use case for https://github.com/eclipse-theia/theia/pull/7110