Skip to content

Commit

Permalink
detect gradle kotlin DSL files
Browse files Browse the repository at this point in the history
convert `project-types` local variable to a custom variable for
extendability
include build.gradle.kts to detect all gradle projects
update glob patterns to watch these files
  • Loading branch information
lmmarsano committed May 7, 2019
1 parent 8b9f7c8 commit 4d8cd0c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lsp-java.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ Use http://download.eclipse.org/che/che-ls-jdt/snapshots/che-jdt-language-server
"face for activity message"
:group 'lsp-java)

(defcustom lsp-java-project-types '("pom.xml" "build.gradle" "build.gradle.kts" ".project")
"File names of possible project configuration files found at project root."
:group 'lsp-java
:type '(repeat file))

(defcustom lsp-java-workspace-dir (expand-file-name (locate-user-emacs-file "workspace/"))
"LSP java workspace directory."
:group 'lsp-java
Expand Down Expand Up @@ -472,9 +477,8 @@ The current directory is assumed to be the java project’s root otherwise."
((string= default-directory lsp-java-workspace-cache-dir) default-directory)
((and (featurep 'projectile) (projectile-project-p)) (projectile-project-root))
((vc-backend default-directory) (expand-file-name (vc-root-dir)))
(t (let ((project-types '("pom.xml" "build.gradle" ".project")))
(or (seq-some (lambda (file) (locate-dominating-file default-directory file)) project-types)
default-directory)))))
(t (or (seq-some (lambda (file) (locate-dominating-file default-directory file)) lsp-java-project-types)
default-directory))))

(defun lsp-java--language-status-callback (workspace params)
"Callback for client initialized.
Expand Down Expand Up @@ -1122,7 +1126,7 @@ PROJECT-URI uri of the item."
("registerOptions" (ht ("watchers"
(vector (ht ("globPattern" "**/*.java"))
(ht ("globPattern" "**/pom.xml"))
(ht ("globPattern" "**/*.gradle"))
(ht ("globPattern" "**/*.gradle{,.kts}"))
(ht ("globPattern" "**/.project"))
(ht ("globPattern" "**/.classpath"))
(ht ("globPattern" "**/settings/*.prefs"))))))))))
Expand Down

0 comments on commit 4d8cd0c

Please sign in to comment.