vim-codequery
vim-codequery copied to clipboard
扩展额外的 db 存储路径
使用 export codequery_base_db_path 指定自定义路径 默认为 $HOME/.doctype 默认也是只识别 前缀为支持的文件类型 并且 后缀为 .db 的生成文件 使用不同的目录存相同名称的 db 文件 CodeQuery 将会最后使用此存储路径进行遍历 同时使用此存储路径树中的所有 db 文件进行搜索
Hi @pmup999 我已經很久沒有改這個 repo 了,會需要久一點的時間溫習自己寫的程式碼,與審查及測試你提交的 PR,煩請稍等數天。
感謝你的 PR,很高興知道還有人使用自己做的工具 😊
Hi @pmup999 我已經瀏覽過你的 PR,整個修改方向沒有問題,但我會想要對一些細節作修改。
想請你先:
- 移除掉被註解掉的程式碼
- 統一使用空白字元進行縮排 這樣我會比較好比較程式碼更動。
另外想請你確認一下這個 PR 是否有 開放讓維護者修改 的權限? 有開放權限給我的話,我直接接續做改動可以省下一些往返的時間
Hi @pmup999 我已經瀏覽過你的 PR,整個修改方向沒有問題,但我會想要對一些細節作修改。
想請你先:
- 移除掉被註解掉的程式碼
- 統一使用空白字元進行縮排 這樣我會比較好比較程式碼更動。
另外想請你確認一下這個 PR 是否有 開放讓維護者修改 的權限? 有開放權限給我的話,我直接接續做改動可以省下一些往返的時間
The default is to allow editing I have not changed
It's up to you to modify !
It was too late yesterday. I wanted to say this to you to deal with. I just saw that it was not dealt with. I have revised it now. You can take a look.
Just learned how to add commits to your PR. I will add more in these days (or weeks). 😆
No problem, come on!
I will take this main idea from you:
- use the environment variable codequery_base_db_path to specify the db path, which is a good idea, especially for those people who work in non-git repositories (#26)
And I am still evaluating this idea: 👀
- search through multiple db files under the specified path
I would like to know more about your use cases:
- do you work on git-based repos?
- how do you move your newly-created local db file (like
python.db
) to thecodequery_base_db_path
? how do you name these customized paths? - why do you need to do searching through multiple db files? could you share your use cases?
- Have you ever encountered path issues while searching through
codequery_base_db_path
(especially when there are multiple db files)?
I use Java
language, use maven
for project building, when using Java
framework he needs a lot of dependencies, but does not need to build All the code of this framework is DB, and only a part of the source code needs to be selectively built into DB, (because the computer I use is too old, so I need this method) because most of the source code does not need to be searched, at least I am think so. Because there is no code hint when writing code with vim, I often cannot remember the package
path where Class
or Interface
is located when writing Java
code. I mainly use it to check the package
path to speed up writing.
Building multiple parts of a framework's source code into a DB is what I do.
My commit modifies the logic when querying autoload/codequery/query.vim:37
, when querying codequery_base_db_path
, he will query multiple times (multiple DB files), use .=
to concatenate multiple queries
The following is my directory structure. When querying codequery_base_db_path
, you need to judge the current file type (my submission should have) and select the corresponding type of directory.
I think it is appropriate to query multiple DBs of codequery_base_db_path
, maybe consider adding options
to handle queries in codequery_base_db_path
separately.
E.g:
(Perhaps you should consider abbreviations for commonly used commands: CQ
, CQB
)
CodeQueryBase [Symbol Text ...] [optional '.doctype/java/[optional directory]' in $codequery_base_db_path/(current file type(java)) directory)]
Consider adding options to CodeQueryMakeDB when building
E.g:
CodeQueryMakeDB [ Base | (optionally move the build file to the $codequery_base_db_path/(current file type) directory)] [Base optional specific storage path]
When no specific storage path is specified, a prompt should be given (yes/no) when replacement is required
.doctype/ ├── java │ ├── springcloud │ │ ├── commons │ │ │ │ ├── java.db │ │ │ │ ├── java_cscope.files │ │ │ │ ├── java_cscope.out │ │ │ │ └── java_tags │ │ ├── context │ │ │ │ ├── java.db │ │ │ │ ├── java_cscope.files │ │ │ │ ├── java_cscope.out │ │ │ │ └── java_tags │ │ └── loadbalancer │ │ ├── java.db │ │ ├── java_cscope.files │ │ ├── java_cscope.out │ │ └── java_tags │ └── springframework │ ├── aop │ │ ├── java.db │ │ ├── java_cscope.files │ │ ├── java_cscope.out │ │ └── java_tags │ ├── beans │ │ ├── java.db │ │ ├── java_cscope.files │ │ ├── java_cscope.out │ │ └── java_tags │ ├── context │ │ ├── java.db │ │ ├── java_cscope.files │ │ ├── java_cscope.out │ │ └── java_tags │ ├── jdbc │ │ ├── java.db │ │ ├── java_cscope.files │ │ ├── java_cscope.out │ │ └── java_tags │ ├── tx │ │ ├── java.db │ │ ├── java_cscope.files │ │ ├── java_cscope.out │ │ └── java_tags │ └── web │ ├── java.db │ ├── java_cscope.files │ ├── java_cscope.out │ └── java_tags └── test.vim
Okay.
Next month I have a couple of days, I will wrap up this PR but remove the multiple databases part.
For the multiple databases part, I will work with you to let those users in need can search through multiple databases by using a specific option.
ok, wish I had time then