Use when-let in gdscript-completion-insert-file-path-at-point

This commit is contained in:
Nicolas Petton
2024-04-17 15:26:05 +02:00
parent b8a840448a
commit d25f778f02

View File

@@ -63,23 +63,22 @@ first."
(let ((has-projectile (featurep 'projectile)))
(when has-projectile
(projectile-maybe-invalidate-cache arg))
(let* ((project-root
(if has-projectile
(projectile-ensure-project (projectile-project-root))
(gdscript-util--find-project-configuration-file)))
(file
(if has-projectile
(projectile-completing-read
"Find file: "
(projectile-project-files project-root))
(read-file-name
"Find file: "
project-root))))
(when file
(insert
(concat "\"res://"
(gdscript-util--get-godot-project-file-path-relative file)
"." (file-name-extension file) "\""))))))
(when-let* ((project-root
(if has-projectile
(projectile-ensure-project (projectile-project-root))
(gdscript-util--find-project-configuration-file)))
(file
(if has-projectile
(projectile-completing-read
"Find file: "
(projectile-project-files project-root))
(read-file-name
"Find file: "
project-root))))
(insert
(concat "\"res://"
(gdscript-util--get-godot-project-file-path-relative file)
"." (file-name-extension file) "\"")))))
(provide 'gdscript-completion)