@@ -375,6 +375,16 @@ FULL specify whether full or incremental build will be performed."
375375 , lsp-java-workspace-dir
376376 ,@java-9-args )))
377377
378+ (defun lsp-java--is-root (dir-or-project )
379+ " Return whether DIR-OR-PROJECT is root of a project."
380+ (let ((dir (if (stringp dir-or-project)
381+ dir-or-project
382+ (treemacs-project->path dir-or-project))))
383+ (-some-> dir
384+ lsp-java--find-workspace
385+ lsp-java--get-project-uris
386+ (-contains? (lsp--path-to-uri dir)))))
387+
378388(defun lsp-java--get-root ()
379389 " Retrieves the root directory of the java project root if available.
380390
@@ -417,10 +427,11 @@ ACTION is the action to execute."
417427WORKSPACE is the currently active workspace.
418428PARAMS the parameters for actionable notifications."
419429 (let* ((project-root (lsp-java--get-root))
420- (classpath-incomplete-p (cl-find-if (lambda (command )
421- (string= (gethash " command" command)
422- " java.ignoreIncompleteClasspath.help" ))
423- (gethash " commands" params)))
430+ (classpath-incomplete-p (unless (lsp-java--is-root (lsp-java--get-root))
431+ (cl-find-if (lambda (command )
432+ (string= (gethash " command" command)
433+ " java.ignoreIncompleteClasspath.help" ))
434+ (gethash " commands" params))))
424435 (choices (list (format " Import project \" %s .\" " project-root)
425436 " Import project by selecting root directory interactively."
426437 (format " Do not ask more for the current project(add \" %s \" to lsp-project-blacklist) " project-root)
0 commit comments