-
Notifications
You must be signed in to change notification settings - Fork 15
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
Provide codelenses for endpoints of the running app #140
Conversation
This draft PR requires the draft PR redhat-developer/vscode-quarkus#146 (from vscode-quarkus): First please don't review the code, I must clean it, but you can start play with the codelens but there are several limitation:
|
Before displaying the code lens, you might want to see if the url is accessible (check for connection refused) |
try https://stackoverflow.com/a/3584332/753170 before sending codelenses |
1999f83
to
f673a3a
Compare
d4ff83c
to
4240573
Compare
I must write tests but you can play with PR. Please note this PR requires redhat-developer/vscode-quarkus#146 |
works quite well on my end |
56737fa
to
3693ab6
Compare
4171685
to
9278aff
Compare
44c9568
to
04edecf
Compare
...hat.quarkus.jdt.core/src/main/java/com/redhat/quarkus/jdt/core/JDTQuarkusManagerForJava.java
Outdated
Show resolved
Hide resolved
b7c7869
to
983c939
Compare
After adding |
} | ||
IJavaElement[] elements = typeRoot.getChildren(); | ||
Collection<CodeLens> lenses = new LinkedHashSet<>(elements.length); | ||
if (params.isUrlCodeLensEnabled()) { |
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.
check for server available should happen here, only 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.
If I do that I check the server for any Java file. In my case I check the server only once for Java class bound with JAX-RS Path (just for the class not for the method), that's to say, the server check is done 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.
there's no need to iterate on all members if the server is not even started
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.
there's no need to iterate on all members if the server is not even started
I would like to avoid checking the server state of Java class which is not a JAX-RS resource (class which is not annotated with @path).
Given this java file:
@Path
public class A {
public void f()
public void g()
}
One check is done (only on A java element IType not for the methods)
Given this java file
class B {
}
None check on server state is done since B is no bound to @path.
...hat.quarkus.jdt.core/src/main/java/com/redhat/quarkus/jdt/core/JDTQuarkusManagerForJava.java
Show resolved
Hide resolved
dc65b92
to
28d2f6e
Compare
It should work now, but please check that URL is available because sometimes when I change the value of port, the server is not restarted and keep the old port? |
You are right, after playing with JAX-RS, the rule is:
|
c0229c2
to
c64c0d1
Compare
It's an issue for Quarkus I think quarkusio/quarkus#5864 |
Fixes redhat-developer#114 Signed-off-by: azerr <azerr@redhat.com>
Provide codelenses for endpoints of the running app
Fixes #114
Signed-off-by: azerr azerr@redhat.com