Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file path completion when projectile is used #145

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions gdscript-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,24 @@ 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)))
(resource-path
(if has-projectile
file
(concat (gdscript-util--get-godot-project-file-path-relative file)
"." (file-name-extension file)))))
(insert (concat "\"res://" resource-path "\"")))))


(provide 'gdscript-completion)
Expand Down
Loading