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

Redhat Java Plugin > 0.78.0 has some issues in Theia #10579

Closed
safisa opened this issue Dec 23, 2021 · 7 comments
Closed

Redhat Java Plugin > 0.78.0 has some issues in Theia #10579

safisa opened this issue Dec 23, 2021 · 7 comments
Labels
vscode issues related to VSCode compatibility

Comments

@safisa
Copy link
Contributor

safisa commented Dec 23, 2021

Bug Description:

Hi,
I am still using the RedHat java plugin version 0.78.0, since all newer versions and they are many, have issues in Theia. In each new Theia upgrade, I am testing it with the latest plugin and still have issues. I tried the latest Theia 1.21 with the latest plugin 1.2.0, and again have the same issue.
I need the latest plugin version since it supports jdk 17 and fixes many other issues from the old 0.78 version.

Issues I am facing with the new plugin are usually related to code actions, like changing class package name, there is an action to fix the file path for example, and this does not work in the plugins after 0.78.0. I think also some other actions may not work too.

Another issue is this message I get after the plugin activation:
Screen Shot 2021-12-23 at 16 42 40

Note, I am using java using the Eclipse project and not maven.

Additional Information

  • Operating System: Windows 10
  • Theia Version: 1.21
  • vscode Redhat java plugin 1.2.0 (or 1.0.0/1.1.0)
@msujew
Copy link
Member

msujew commented Dec 23, 2021

@safisa, Would you please provide more technical information about the issues your experiencing? Are there any special vscode APIs which the extension relies on, which aren't provided by Theia as of now?

For the plugin activation message: I think, we need to reevaluate where we render markdown within our application. I recently added markdown rendering for preferences (#10431), and using the MarkdownRenderer introduced there, we could easily add link rendering for the [...](command: ...) format. I think both notifications and dialogs should support markdown content.

@msujew msujew added 🤔 needs more info issues that require more info from the author vscode issues related to VSCode compatibility labels Dec 23, 2021
@safisa
Copy link
Contributor Author

safisa commented Dec 25, 2021

Hi,
First, regarding the plugin activation message, I don't understand if I need to do something on my side, or it is a bug need to be fixed in Theia?
Second, for the main issue of the java plugin, I tried it also with the Theia code (latest 1.21), I built and ran the examples\browser app, I added before that the latest Redhat java plugin 1.2.0 to the plugins folder. I got the same behavior, for BOTH issues above, so this means it is not related to my custom extension that I have in my customized Theia.

To reproduce (fix package name - action issue):

  1. open some folder in Theia browser app
  2. add a java file to a root of some src folder, everything should be built correctly
  3. add package name (eg. package folder1;) to make an error in the build
  4. Now you can see the build error, and then a fix is suggested to remove the package name or move the file to folder1.
  5. both actions don't work, they DO work when using java plugin version 0.78.

Note: I have these settings for the java plugin in the workspace scope:

"java.configuration.runtimes": [
	{
		"name": "JavaSE-1.8",
		"path": "C:\\Program Files\\ojdkbuild\\java-1.8.0-openjdk-1.8.0.232-1",
		"default": true
	}
],
"java.project.referencedLibraries": [
	"C:/path1/*.jar",
	"C:/path2/*.jar",
	"relativeLibFolder/*.jar"
],
"java.project.outputPath": "bin",
"java.settings.url": ".theia/org.eclipse.jdt.core.prefs",
"java.project.sourcePaths": [
	"relativePath1/src",
	"relativePath2/src",
	"relativePath3/src"
],
"java.configuration.checkProjectSettingsExclusions": false,
"java.project.resourceFilters": [
	"node_modules",
	".git"
]

thanks

@safisa
Copy link
Contributor Author

safisa commented Jan 27, 2022

Hi,
@msujew regarding the main issue above, if the package name does not match the folder structure of the class, the suggested action to resolve it does not work, as in the steps to reproduce above. What more info is needed (since I see there is a tag on this issue - needs more info)?
Or maybe you want me to open a new ticket on this one?

If this helps, the issue as I mentioned started after vscode-java plugin 0.78, I suspect that the changes in 0.79 caused it, which are:

  • enhancement - Update language client to 7.0.0 to adopt LSP 3.16 features (enables lazy code action resolution)

Thanks

@msujew msujew removed the 🤔 needs more info issues that require more info from the author label Jan 27, 2022
@msujew
Copy link
Member

msujew commented Jan 27, 2022

@safisa Thanks for providing more info on that (I removed the label). I'm a bit confused by the issue, since language client 7.0.0/LSP 3.16 is supported by Theia.

I don't have time to look into this right now though (as in: I'm quite busy for the next few weeks). Is there a console error message that appears when trying to execute the code action? Any info might help anyone who's willing to contribute/fix this issue.

@safisa
Copy link
Contributor Author

safisa commented Jan 27, 2022

Hi,

I see this error in Theia output (could be related):
root ERROR [hosted-plugin: 16696] Response handler 'textDocument/hover' failed with message: Cannot read property 'remove' of undefined

Also, I have enabled the java.trace.server and put it on verbose, I see these messages in the language support for java output:

[Trace - 4:00:42 PM] Sending request 'workspace/executeCommand - (45)'.
Params: {
    "command": "vscode.java.resolveMainMethod",
    "arguments": [
        "file:///c%3A/K2View/Projects%20Fabric/test_6_5_demo/Implementation/LogicalUnits/Patient/Java/src/com/aa.java"
    ]
}


[Trace - 4:00:42 PM] Received response 'workspace/executeCommand - (45)' in 5ms.
Result: []


[Trace - 4:00:45 PM] Sending request 'textDocument/codeAction - (46)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/K2View/Projects%20Fabric/test_6_5_demo/Implementation/LogicalUnits/Patient/Java/src/com/aa.java"
    },
    "range": {
        "start": {
            "line": 0,
            "character": 12
        },
        "end": {
            "line": 0,
            "character": 12
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 0,
                        "character": 8
                    },
                    "end": {
                        "line": 0,
                        "character": 12
                    }
                },
                "message": "The declared package \"com1\" does not match the expected package \"com\"",
                "code": "536871240",
                "severity": 1,
                "source": "Java"
            }
        ]
    }
}


[Trace - 4:00:45 PM] Received request 'workspace/configuration - (25)'.
Params: {
    "items": [
        {
            "scopeUri": "file:///c%3A/K2View/Projects%20Fabric/test_6_5_demo/Implementation/LogicalUnits/Patient/Java/src/com/aa.java",
            "section": "java.format.tabSize"
        },
        {
            "scopeUri": "file:///c%3A/K2View/Projects%20Fabric/test_6_5_demo/Implementation/LogicalUnits/Patient/Java/src/com/aa.java",
            "section": "java.format.insertSpaces"
        }
    ]
}


[Trace - 4:00:45 PM] Sending response 'workspace/configuration - (25)'. Processing request took 0ms
Result: [
    4,
    true
]


[Trace - 4:00:45 PM] Received response 'textDocument/codeAction - (46)' in 11ms.
Result: [
    {
        "title": "Move 'aa.java' to package 'com1'",
        "kind": "quickfix",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 0,
                        "character": 8
                    },
                    "end": {
                        "line": 0,
                        "character": 12
                    }
                },
                "severity": 1,
                "code": "536871240",
                "source": "Java",
                "message": "The declared package \"com1\" does not match the expected package \"com\""
            }
        ],
        "data": {
            "pid": "0",
            "rid": "7"
        }
    },
    {
        "title": "Change package declaration to 'com'",
        "kind": "quickfix",
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 0,
                        "character": 8
                    },
                    "end": {
                        "line": 0,
                        "character": 12
                    }
                },
                "severity": 1,
                "code": "536871240",
                "source": "Java",
                "message": "The declared package \"com1\" does not match the expected package \"com\""
            }
        ],
        "data": {
            "pid": "1",
            "rid": "7"
        }
    },
    {
        "title": "Generate Constructors",
        "kind": "source.generate.constructors",
        "diagnostics": [],
        "data": {
            "pid": "2",
            "rid": "7"
        }
    },
    {
        "title": "Organize imports",
        "kind": "source.organizeImports",
        "diagnostics": [],
        "command": {
            "title": "Organize imports",
            "command": "java.action.organizeImports",
            "arguments": [
                {
                    "textDocument": {
                        "uri": "file:///c%3A/K2View/Projects%20Fabric/test_6_5_demo/Implementation/LogicalUnits/Patient/Java/src/com/aa.java"
                    },
                    "range": {
                        "start": {
                            "line": 0,
                            "character": 12
                        },
                        "end": {
                            "line": 0,
                            "character": 12
                        }
                    },
                    "context": {
                        "diagnostics": [
                            {
                                "range": {
                                    "start": {
                                        "line": 0,
                                        "character": 8
                                    },
                                    "end": {
                                        "line": 0,
                                        "character": 12
                                    }
                                },
                                "severity": 1,
                                "code": "536871240",
                                "source": "Java",
                                "message": "The declared package \"com1\" does not match the expected package \"com\""
                            }
                        ]
                    }
                }
            ]
        }
    },
    {
        "title": "Override/Implement Methods...",
        "kind": "source.overrideMethods",
        "diagnostics": [],
        "command": {
            "title": "Override/Implement Methods...",
            "command": "java.action.overrideMethodsPrompt",
            "arguments": [
                {
                    "textDocument": {
                        "uri": "file:///c%3A/K2View/Projects%20Fabric/test_6_5_demo/Implementation/LogicalUnits/Patient/Java/src/com/aa.java"
                    },
                    "range": {
                        "start": {
                            "line": 0,
                            "character": 12
                        },
                        "end": {
                            "line": 0,
                            "character": 12
                        }
                    },
                    "context": {
                        "diagnostics": [
                            {
                                "range": {
                                    "start": {
                                        "line": 0,
                                        "character": 8
                                    },
                                    "end": {
                                        "line": 0,
                                        "character": 12
                                    }
                                },
                                "severity": 1,
                                "code": "536871240",
                                "source": "Java",
                                "message": "The declared package \"com1\" does not match the expected package \"com\""
                            }
                        ]
                    }
                }
            ]
        }
    },
    {
        "title": "Generate toString()",
        "kind": "source.generate.toString",
        "diagnostics": [],
        "data": {
            "pid": "3",
            "rid": "7"
        }
    }
]


[Trace - 4:00:45 PM] Sending request 'workspace/executeCommand - (47)'.
Params: {
    "command": "vscode.java.resolveMainMethod",
    "arguments": [
        "file:///c%3A/K2View/Projects%20Fabric/test_6_5_demo/Implementation/LogicalUnits/Patient/Java/src/com/aa.java"
    ]
}


[Trace - 4:00:45 PM] Received response 'workspace/executeCommand - (47)' in 5ms.
Result: []

Thanks

@safisa
Copy link
Contributor Author

safisa commented Feb 28, 2022

Hi @msujew,
I think the last Theia 1.23.0 fixed the code action issue above (I saw that there was a PR on code actions as part of 1.23). You can close this ticket.

Thanks very much

@vince-fugnitto
Copy link
Member

Hi @msujew, I think the last Theia 1.23.0 fixed the code action issue above (I saw that there was a PR on code actions as part of 1.23). You can close this ticket.

Closing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility
Projects
None yet
Development

No branches or pull requests

3 participants