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

LSP: Html4J UI modified work over LSP. #4040

Merged
merged 10 commits into from
Aug 24, 2022

Conversation

dbalek
Copy link
Contributor

@dbalek dbalek commented Apr 27, 2022

An attempt to rewrite html4j based refactoring UI for VSCode to work over LSP.

@dbalek dbalek added the do not merge Don't merge this PR, it is not ready or just demonstration purposes. label Apr 27, 2022
@dbalek dbalek requested a review from jtulach April 27, 2022 16:38
@dbalek dbalek requested a review from sdedic May 19, 2022 15:20
@dbalek dbalek added LSP [ci] enable Language Server Protocol tests do not merge Don't merge this PR, it is not ready or just demonstration purposes. and removed do not merge Don't merge this PR, it is not ready or just demonstration purposes. labels May 19, 2022
@jtulach
Copy link
Contributor

jtulach commented May 31, 2022

With be02cff one should be able to stop the Java execution before sending a message to VSCode:

image

And just by setting pause = true in the evaluation window the execution will then stop in chrome dev tools in VSCode:

image

@JaroslavTulach
Copy link

The Change Refactoring UI seems to be working with generic and ko4j modules from apache/netbeans-html4j@f031ed4 - I'll prepare a release 1.8.1.

@jtulach jtulach added this to the NB15 milestone Jul 14, 2022
@jtulach
Copy link
Contributor

jtulach commented Jul 14, 2022

HTML/Java 1.8.1 is available on Maven central. @dbalek please replace 6c9ab9a with proper external binaries. I hope this will make it into NetBeans 15.

@neilcsmith-net neilcsmith-net modified the milestones: NB15, NB16 Jul 18, 2022
@dbalek dbalek removed the do not merge Don't merge this PR, it is not ready or just demonstration purposes. label Jul 18, 2022
@dbalek dbalek requested a review from jtulach July 18, 2022 11:36
Copy link
Contributor

@jtulach jtulach left a comment

Choose a reason for hiding this comment

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

Looks great and if it works for VSCode, then perfect!

In addition I'd like to see usage of resources in the JavaFX WebView implementation to load the refactoring.css. Probably the implementation shall create a temporary directory and copy the resources there to get file protocol URL. Right now the SPI returns URL[] and I am afraid it it is going to be of little use - possibly String[] of relative paths to main page would be better. The JavaFX WebView implementation may wait for another PR, but we don't want to create an SPI that is wrong to begin with.

private void emitScript(StringBuilder sb, String id) throws IOException {

sb.append("<script id='exec' type='text/javascript'>\n"
+ "const vscode = acquireVsCodeApi();\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a potential security threat. VSCode team tries hard not to allow untrusted scripting code access the API. However, right now your are only running trusted code - but avoid downloading any HTML file or JS file from network.

java/java.lsp.server/vscode/package.json Show resolved Hide resolved
@jtulach jtulach merged commit 2038295 into apache:master Aug 24, 2022
Chris2011 pushed a commit to Chris2011/netbeans that referenced this pull request Dec 15, 2022
* LSP: Html4J UI modified work over LSP.
* Updating HTML4J to version 1.8.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LSP [ci] enable Language Server Protocol tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants