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

Editor preview #3373

Merged
merged 1 commit into from
Nov 20, 2018
Merged

Conversation

caseyflynn-google
Copy link
Contributor

Fix #1252 Add support for a preview code editor.

@vince-fugnitto
Copy link
Member

vince-fugnitto commented Nov 2, 2018

@caseyflynn-google you are missing the package.spec.ts which can be found in other packages.
This is used for the cli to ensure it passes.

You are also missing the @theia/editor-preview dependency in the package.json found under the example/electron folder.


I noticed you introduced a lot of code as part of your PR, but it would also be nice if you included some unit tests as to not to decrease Theia's overall test coverage.

@akosyakov
Copy link
Member

akosyakov commented Nov 2, 2018

@caseyflynn-google cool! really like that optional and not invasive

I've noticed following glitches:

  • if I pin one editor and preview another then switching between them by clicking on corresponding files in the navigator does not work
  • if I start typing in a preview editor it gets closed and a normal editor gets opened, would it be possible to reuse the preview editor?
  • not only a caption of preview editor is in italic style, but an icon as well
  • clicking on a file in the navigator activates the preview editor, it would be better if the focus stays on the navigator, otherwise, i never can select a file in the navigator by clicking on it


protected onResize(msg: Widget.ResizeMessage): void {
if (this.editorWidget_) {
if (msg.width < 0 || msg.height < 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried just to forward a message to an editor?

MessageLoop.sendMessage(this.editorWidget_, msg);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to pass the message, but we will still need to set the size until autoSizing is working. if you like we can move the code to the editor widget.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that the editor widget already handles it: https://github.com/theia-ide/theia/blob/e8dd128c25294b23741cc345067952ef7cd85864/packages/editor/src/browser/editor-widget.ts#L75-L81

autoSizing property is not for editors, but for such widgets like REPL, where the editor should be resized if content is changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I read / interpreted this is the resize will not be performed here: https://github.com/theia-ide/theia/blob/e8dd128c25294b23741cc345067952ef7cd85864/packages/monaco/src/browser/monaco-editor.ts#L291 due to autoSizing being false.

packages/navigator/src/browser/navigator-preferences.ts Outdated Show resolved Hide resolved
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not work well in diff editors and when decorations overlapping with folding decorations. - wrong PR

@caseyflynn-google
Copy link
Contributor Author

@caseyflynn-google cool! really like that optional and not invasive

I've noticed following glitches:

  • if I pin one editor and preview another then switching between them by clicking on corresponding files in the navigator does not work

Fixed.

  • if I start typing in a preview editor it gets closed and a normal editor gets opened, would it be possible to reuse the preview editor?

I believe this is the current behavior.

  • not only a caption of preview editor is in italic style, but an icon as well

Fixed.

  • clicking on a file in the navigator activates the preview editor, it would be better if the focus stays on the navigator, otherwise, i never can select a file in the navigator by clicking on it

I am not really sure how to accomplish this, any suggestions would be appreciated.

@caseyflynn-google
Copy link
Contributor Author

@caseyflynn-google you are missing the package.spec.ts which can be found in other packages.
This is used for the cli to ensure it passes.

You are also missing the @theia/editor-preview dependency in the package.json found under the example/electron folder.

I noticed you introduced a lot of code as part of your PR, but it would also be nice if you included some unit tests as to not to decrease Theia's overall test coverage.

Done.

@caseyflynn-google
Copy link
Contributor Author

@caseyflynn-google cool! really like that optional and not invasive
I've noticed following glitches:

  • if I pin one editor and preview another then switching between them by clicking on corresponding files in the navigator does not work

Fixed.

  • if I start typing in a preview editor it gets closed and a normal editor gets opened, would it be possible to reuse the preview editor?

I believe this is the current behavior.

  • not only a caption of preview editor is in italic style, but an icon as well

Fixed.

  • clicking on a file in the navigator activates the preview editor, it would be better if the focus stays on the navigator, otherwise, i never can select a file in the navigator by clicking on it

I am not really sure how to accomplish this, any suggestions would be appreciated.

Got this fixed.

@caseyflynn-google caseyflynn-google force-pushed the editor-preview branch 2 times, most recently from 68dba24 to ca26b20 Compare November 8, 2018 17:39
@akosyakov
Copy link
Member

@caseyflynn-google please look at build failures, it seems you forgot to push changes to travis file. It is auto-updated to cache a new extension by travis.

@akosyakov
Copy link
Member

@marcdumais-work @svenefftinge Is it possible to add @caseyflynn-google as a Eclipse Theia committer?

@svenefftinge
Copy link
Contributor

@marcdumais-work @svenefftinge Is it possible to add @caseyflynn-google as a Eclipse Theia committer?

Sure, would be great to have you Casey! Are you interested?

@marcdumais-work
Copy link
Contributor

@marcdumais-work @svenefftinge Is it possible to add @caseyflynn-google as a Eclipse Theia committer?

Sure, sounds like a good idea, at least eventually.

Someone would need to nominate him through the Eclipse Foundation tool for that effect, providing a solid case to justify the nomination, to the current committers' satisfaction.

Usually it means listing significant contributions to the project, and making the case of how they warrant the person being made a committer (e.g. some mix of quantity/quality/complexity/rarity of the documented contributions). I have not followed closely enough to know whether that's arguably the case, here, yet.

More details: https://wiki.eclipse.org/Development_Resources/HOWTO/Nominating_and_Electing_a_New_Committer
https://www.eclipse.org/projects/handbook/#elections-nomination

@caseyflynn-google caseyflynn-google force-pushed the editor-preview branch 2 times, most recently from d68c307 to 95b7b3f Compare November 9, 2018 23:52
@@ -0,0 +1,7 @@
# Theia - Editor Preview Extension

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a description of what this extension brings. Maybe some bits from the overview part from this comment could be copied: #1252 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcdumais-work
Copy link
Contributor

@caseyflynn-google impressive (first I think?) contribution. Good analysis of the problem in #1252. I just tried the PR on Gitpod, and I think I'll use it daily once merged. I see that beyond the immediately apparent feature, you've added infrastructure to make it easier to support preview for other widgets - even nicer. Thanks!

Just a heads-up: this PR is getting close to the 1000 LoC limit. Over that we will need to submit a CQ, which would delay a bit merging. It looks like it's almost ready to merge, in any case?

@caseyflynn-google
Copy link
Contributor Author

@caseyflynn-google impressive (first I think?) contribution. Good analysis of the problem in #1252. I just tried the PR on Gitpod, and I think I'll use it daily once merged. I see that beyond the immediately apparent feature, you've added infrastructure to make it easier to support preview for other widgets - even nicer. Thanks!

Glad to hear this is a useful feature!

Just a heads-up: this PR is getting close to the 1000 LoC limit. Over that we will need to submit a CQ, which would delay a bit merging. It looks like it's almost ready to merge, in any case?

I think this is ready to merge. I will add additional documentation in the README.md after this has merged to keep it under the 1000 LoC limit.

@caseyflynn-google
Copy link
Contributor Author

@marcdumais-work @svenefftinge Is it possible to add @caseyflynn-google as a Eclipse Theia committer?

Sure, would be great to have you Casey! Are you interested?

Absolutely.

Signed-off-by: Casey Flynn <caseyflynn@google.com>
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vince-fugnitto
Copy link
Member

vince-fugnitto commented Nov 20, 2018

@svenefftinge the build still fails due to some leftovers, should we revert?

@marcdumais-work
Copy link
Contributor

Seems related to this commit:

commit 103c95e495f5a0739e70ea6ef14fe2489e1ddfe8
Author: Anton Kosyakov <anton.kosyakov@typefox.io>
Date:   Thu Nov 15 16:24:15 2018 +0000

    [shell] get rid of WidgetTracker
    
    Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>

@marcdumais-work
Copy link
Contributor

build error:
[compile] src/browser/frontend-application-module.ts(65,10): error TS2305: Module '"/opt/ericsson-dev/theia/packages/core/src/browser/widgets/index"' has no exported member 'WidgetTracker'.

@marcdumais-work
Copy link
Contributor

Fix: #3555

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

Successfully merging this pull request may close these issues.

None yet

5 participants