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

Handle markdown in LSP doc popups #10645

Merged

Conversation

tsmaeder
Copy link
Contributor

@tsmaeder tsmaeder commented Aug 3, 2018

What does this PR do?

Adds handling of markdown in the widgets that show additional doc (i.e. javadoc) for completions and signature help in LSP editors.

What issues does this PR fix or reference?

#10499

Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
} else {
callback.onSuccess(createAdditionalInfoWidget());
}
MarkedOverlay.getMarkedPromise()
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you should provide some sort of abstraction instead using MarkedOverlay directly.
It's OK to use MarkedOverlay in Orion module, but in this module we shouldn't have direct dependency on Orion .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, architecturally, but I would propose to merge it like that and to open an issue for it:

  1. I'm on PTO in around 2 hours and I'd like to get this merged
  2. Investing in architectural integrity of the gwt ide seems low prio.

*/
package org.eclipse.che.ide.editor.orion.client.jso;

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, place javadoc after imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strange that the formatter does not reorder that.


protected MarkedOverlay() {}

public static Promise<MarkedOverlay> getMarkedPromise() {
Copy link
Contributor

Choose a reason for hiding this comment

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

'getReady()` sounds better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other classes use this pattern, see org.eclipse.che.ide.editor.orion.client.EditorInitializePromiseHolder.getInitializerPromise()

*/
package org.eclipse.che.ide.editor.orion.client.jso;

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be before class declaration

@@ -566,9 +566,7 @@ public void runActionForTabFromContextMenu(TabActionLocator tabAction) {
* @param text text which should be typed
*/
public void typeTextIntoEditor(String text) {
loader.waitOnClosed();
Copy link
Contributor

Choose a reason for hiding this comment

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

loader.waitOnClosed(); is needed here to be sure the loader is not displayed in front of editor, or it is gone after the text has been pasted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

loader.waitOnClosed() does at least a one second wait. On this one, I am not sure, but I'd like to try removing it. We can reenable it if the test start failing.
Generally, I think this is the wrong approach. We should be testing for conditions that we need, for example we want the editor to have keyboard focus.

@@ -897,7 +894,7 @@ public void selectItemIntoAutocompleteAndPerformDoubleClick(String item) {
*/
public void selectAutocompleteProposal(String item) {
seleniumWebDriverHelper.waitAndClick(
By.xpath(format(AUTOCOMPLETE_CONTAINER + "/li/span[text()='%s']", item)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you, please, explain what text() was replaced by . in xpath "/li/span[text()='%s']" for?

Copy link
Contributor Author

@tsmaeder tsmaeder Aug 3, 2018

Choose a reason for hiding this comment

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

. recursively takes the text in all subelements ("foo <span>bar</span>" is "foo bar", whereas in "text()" it woudl be "foo ".

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thank you for explanation.

webDriverWaitFactory
.get(timeout)
.withMessage(
() -> {
return "expected \n'" + expectedText + "'\nbut was \n'" + actual[0] + "'\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

Great idea!

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 introduced this in order to see why the teste failed. It makes fixing much more convenient.

@@ -290,8 +290,6 @@ public void waitItem(String path) {
* @param timeout waiting timeout in seconds
*/
public void waitItem(String path, int timeout) {
loader.waitOnClosed();
Copy link
Contributor

@dmytro-ndp dmytro-ndp Aug 3, 2018

Choose a reason for hiding this comment

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

We need to ensure that there is no loader in front of IDE to make the tests more stable.

Copy link
Contributor Author

@tsmaeder tsmaeder Aug 3, 2018

Choose a reason for hiding this comment

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

No, that makes no sense! In Pseudocode, this would read:

  1. wait for condition x
  2. wait for condition y.

if we never do anything with "x", we can just remove the first wait. If the wait is too short, then, we should increase the timeout.

Copy link
Contributor

Choose a reason for hiding this comment

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

This method is being called from other tests which rely on loader.waitOnClosed(). If you are removing this wait from the method, you should add loader.waitOnClosed() to the callers.

@tsmaeder tsmaeder merged commit 66f7bfd into eclipse-che:5730_java_ls_poc Aug 3, 2018
tolusha pushed a commit that referenced this pull request Aug 7, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
@benoitf benoitf added the target/branch Indicates that a PR will be merged into a branch other than master. label Aug 9, 2018
tsmaeder added a commit that referenced this pull request Aug 22, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Aug 29, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tolusha pushed a commit that referenced this pull request Sep 5, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Sep 13, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Sep 20, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Sep 26, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 1, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 5, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 12, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 16, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 17, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 17, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 17, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 17, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
tsmaeder added a commit that referenced this pull request Oct 17, 2018
* Use Orion's "marked" to support markdown in doc popups

Signed-off-by: Thomas Mäder <tmader@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/branch Indicates that a PR will be merged into a branch other than master.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants