You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/01/03 17:33:17 UTC
[GitHub] [netbeans] entlicher opened a new pull request #3400: Be able to resolve project problems in VSCode extension.
entlicher opened a new pull request #3400:
URL: https://github.com/apache/netbeans/pull/3400
When a project problem is detected, there is no way to resolve it from within VSCode extension.
This PR introduces `java.project.resolveProjectProblems` command, which attempts to resolve the project problems and when they are not resolved, it displays the resolution error.
`JavaErrorProvider` displays a dull `error(0): null` message, which we change to `error(1): <line:column range>`
The gradle project needs to be adapted to provide the resolution error message.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] entlicher merged pull request #3400: Be able to resolve project problems in VSCode extension.
Posted by GitBox <gi...@apache.org>.
entlicher merged pull request #3400:
URL: https://github.com/apache/netbeans/pull/3400
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] entlicher commented on a change in pull request #3400: Be able to resolve project problems in VSCode extension.
Posted by GitBox <gi...@apache.org>.
entlicher commented on a change in pull request #3400:
URL: https://github.com/apache/netbeans/pull/3400#discussion_r778006787
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java
##########
@@ -485,6 +491,61 @@
.thenApply(avoid -> completionFutures.stream().flatMap(c -> c.join().stream()).collect(Collectors.toList()));
return (CompletableFuture<Object>) (CompletableFuture<?>) joinedFuture;
}
+ case Server.JAVA_PROJECT_RESOLVE_PROJECT_PROBLEMS: {
+ CompletableFuture<Object> result = new CompletableFuture<>();
+ List<Object> arguments = params.getArguments();
+ if (!arguments.isEmpty()) {
+ String fileStr = ((JsonPrimitive) arguments.get(0)).getAsString();
+ FileObject file;
+ try {
+ file = URLMapper.findFileObject(URI.create(fileStr).toURL());
+ } catch (MalformedURLException ex) {
+ result.completeExceptionally(ex);
+ return result;
+ }
+ Project project = FileOwnerQuery.getOwner(file);
+ if (project != null) {
+ ProjectProblemsProvider ppp = project.getLookup().lookup(ProjectProblemsProvider.class);
+ if (ppp != null) {
+ Collection<? extends ProjectProblemsProvider.ProjectProblem> problems = ppp.getProblems();
+ if (!problems.isEmpty()) {
+ List<Pair<ProjectProblemsProvider.ProjectProblem, Future<ProjectProblemsProvider.Result>>> resolvers = new LinkedList<>();
+ for (ProjectProblemsProvider.ProjectProblem problem : ppp.getProblems()) {
+ if (problem.isResolvable()) {
+ resolvers.add(Pair.of(problem, problem.resolve()));
Review comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #3400: Be able to resolve project problems in VSCode extension.
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3400:
URL: https://github.com/apache/netbeans/pull/3400#discussion_r777619352
##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java
##########
@@ -485,6 +491,61 @@
.thenApply(avoid -> completionFutures.stream().flatMap(c -> c.join().stream()).collect(Collectors.toList()));
return (CompletableFuture<Object>) (CompletableFuture<?>) joinedFuture;
}
+ case Server.JAVA_PROJECT_RESOLVE_PROJECT_PROBLEMS: {
+ CompletableFuture<Object> result = new CompletableFuture<>();
+ List<Object> arguments = params.getArguments();
+ if (!arguments.isEmpty()) {
+ String fileStr = ((JsonPrimitive) arguments.get(0)).getAsString();
+ FileObject file;
+ try {
+ file = URLMapper.findFileObject(URI.create(fileStr).toURL());
+ } catch (MalformedURLException ex) {
+ result.completeExceptionally(ex);
+ return result;
+ }
+ Project project = FileOwnerQuery.getOwner(file);
+ if (project != null) {
+ ProjectProblemsProvider ppp = project.getLookup().lookup(ProjectProblemsProvider.class);
+ if (ppp != null) {
+ Collection<? extends ProjectProblemsProvider.ProjectProblem> problems = ppp.getProblems();
+ if (!problems.isEmpty()) {
+ List<Pair<ProjectProblemsProvider.ProjectProblem, Future<ProjectProblemsProvider.Result>>> resolvers = new LinkedList<>();
+ for (ProjectProblemsProvider.ProjectProblem problem : ppp.getProblems()) {
+ if (problem.isResolvable()) {
+ resolvers.add(Pair.of(problem, problem.resolve()));
Review comment:
is the `.resolve()` called in the LSP message thread ? If so, should be called in a RequestProcessor, since it may eventually trigger a project build.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists