Skip to content

Commit 5800457

Browse files
committed
Fix file path completion when projectile is used
When projectile is being used, `projectile-project-files' already returns file paths relative to the project root directory.
1 parent b8a8404 commit 5800457

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

gdscript-completion.el

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,24 @@ first."
6363
(let ((has-projectile (featurep 'projectile)))
6464
(when has-projectile
6565
(projectile-maybe-invalidate-cache arg))
66-
(let* ((project-root
67-
(if has-projectile
68-
(projectile-ensure-project (projectile-project-root))
69-
(gdscript-util--find-project-configuration-file)))
70-
(file
71-
(if has-projectile
72-
(projectile-completing-read
73-
"Find file: "
74-
(projectile-project-files project-root))
75-
(read-file-name
76-
"Find file: "
77-
project-root))))
78-
(when file
79-
(insert
80-
(concat "\"res://"
81-
(gdscript-util--get-godot-project-file-path-relative file)
82-
"." (file-name-extension file) "\""))))))
66+
(when-let* ((project-root
67+
(if has-projectile
68+
(projectile-ensure-project (projectile-project-root))
69+
(gdscript-util--find-project-configuration-file)))
70+
(file
71+
(if has-projectile
72+
(projectile-completing-read
73+
"Find file: "
74+
(projectile-project-files project-root))
75+
(read-file-name
76+
"Find file: "
77+
project-root)))
78+
(resource-path
79+
(if has-projectile
80+
file
81+
(concat (gdscript-util--get-godot-project-file-path-relative file)
82+
"." (file-name-extension file)))))
83+
(insert (concat "\"res://" resource-path "\"")))))
8384

8485

8586
(provide 'gdscript-completion)

0 commit comments

Comments
 (0)