- 后缀ts的排序优先级最高
- 我需要js文件在git中,同时如果可能 find file 直接从配置忽略掉js文件
第2个可以尝试设置completion-ignored-extensions,但也看你用的什么框架,用vertico的话没问题。
看一下 project-find-file
源代码,不难发现可以在哪里排序,关键的是排序算法:
(defun project-find-file (&optional include-all)
"Visit a file (with completion) in the current project.
The filename at point (determined by `thing-at-point'), if any,
is available as part of \"future history\".
If INCLUDE-ALL is non-nil, or with prefix argument when called
interactively, include all files under the project root, except
for VCS directories listed in `vc-directory-exclusion-list'."
(interactive "P")
(let* ((pr (project-current t))
(root (project-root pr))
(dirs (list root)))
(project-find-file-in ;; <<----
(or (thing-at-point 'filename)
(and buffer-file-name (file-relative-name buffer-file-name root)))
dirs pr include-all)))
没看明白你的需求描述。