-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Set active editor on startup #6152
Conversation
@@ -43,6 +43,7 @@ export class TextEditorServiceImpl implements TextEditorService { | |||
constructor(@inject(EditorManager) private editorManager: EditorManager) { | |||
editorManager.onCurrentEditorChanged(this.onEditorChanged); | |||
editorManager.onCreated(w => this.onEditorCreated(w)); | |||
editorManager.all.forEach(w => this.onEditorCreated(w)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tolusha thanks for tackling this! 🙏
in general this should work, but we could actually clean up the editorManager.onCurrentEditorChanged(this.onEditorChanged)
here, no?
WDYT of renaming onEditorCreated
to connectEditor
or something like that, adjusting onCurrentEditorChanged
handler, and now calling connectEditor
for editorManager.currentEditor
once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a bit off topic as this is not related to the issue in scope of this PR, but before I forget to mention it: I think we should remove this.editors
map which holds references to MonacoEditor
instances without a real reason.
e.g. getActiveEditor
uses editorManager
an so could listTextEditors
be implemented as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexTugarev
I've done some refactoring as you mentioned.
I am not sure if changes regarding connectEditor
make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok with me. let's test with many opened editors to see how it works with many events being fired.
@@ -38,25 +38,19 @@ export class TextEditorServiceImpl implements TextEditorService { | |||
onTextEditorAdd: Event<MonacoEditor> = this.onTextEditorAddEmitter.event; | |||
onTextEditorRemove: Event<MonacoEditor> = this.onTextEditorRemoveEmitter.event; | |||
|
|||
private editors = new Map<string, MonacoEditor>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always nice to remove duplicate state! 😊
@AlexTugarev please finish the review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as advertised! Thanks!
I am going to squash commits and merge... |
Signed-off-by: Anatoliy Bazko <abazko@redhat.com>
6691758
to
6a753bf
Compare
Signed-off-by: Anatoliy Bazko abazko@redhat.com
Reference issue
#6101
What it does
When Thiea is started the editors which had been created were not taking into account. Which leads to setting
window.activeTextEditor
to undefined and impossibility to add a new python configuration [2][1] https://github.com/theia-ide/theia/blob/ab/fixActiveEditor/packages/plugin/src/theia.d.ts#L2985
[2] https://github.com/Microsoft/vscode-python/blob/master/src/client/debugger/extension/configuration/launch.json/updaterService.ts#L26
How to test
plugins
folderlaunch.json
and try to add any python configurationlaunch.json
[1] https://github.com/microsoft/vscode-python/releases/download/2019.5.18875/ms-python-release.vsix
Review checklist
Reminder for reviewers