vim-codequery icon indicating copy to clipboard operation
vim-codequery copied to clipboard

扩展额外的 db 存储路径

Open pmup999 opened this issue 2 years ago • 11 comments

使用 export codequery_base_db_path 指定自定义路径 默认为 $HOME/.doctype 默认也是只识别 前缀为支持的文件类型 并且 后缀为 .db 的生成文件 使用不同的目录存相同名称的 db 文件 CodeQuery 将会最后使用此存储路径进行遍历 同时使用此存储路径树中的所有 db 文件进行搜索

pmup999 avatar Oct 10 '22 19:10 pmup999

Hi @pmup999 我已經很久沒有改這個 repo 了,會需要久一點的時間溫習自己寫的程式碼,與審查及測試你提交的 PR,煩請稍等數天。

感謝你的 PR,很高興知道還有人使用自己做的工具 😊

devjoe avatar Oct 11 '22 11:10 devjoe

Hi @pmup999 我已經瀏覽過你的 PR,整個修改方向沒有問題,但我會想要對一些細節作修改。

想請你先:

  • 移除掉被註解掉的程式碼
  • 統一使用空白字元進行縮排 這樣我會比較好比較程式碼更動。

另外想請你確認一下這個 PR 是否有 開放讓維護者修改 的權限? 有開放權限給我的話,我直接接續做改動可以省下一些往返的時間

devjoe avatar Oct 24 '22 16:10 devjoe

Hi @pmup999 我已經瀏覽過你的 PR,整個修改方向沒有問題,但我會想要對一些細節作修改。

想請你先:

  • 移除掉被註解掉的程式碼
  • 統一使用空白字元進行縮排 這樣我會比較好比較程式碼更動。

另外想請你確認一下這個 PR 是否有 開放讓維護者修改 的權限? 有開放權限給我的話,我直接接續做改動可以省下一些往返的時間

The default is to allow editing I have not changed

pmup999 avatar Oct 24 '22 16:10 pmup999

It's up to you to modify !

pmup999 avatar Oct 24 '22 16:10 pmup999

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.

pmup999 avatar Oct 25 '22 03:10 pmup999

Just learned how to add commits to your PR. I will add more in these days (or weeks). 😆

devjoe avatar Oct 25 '22 16:10 devjoe

No problem, come on!

pmup999 avatar Oct 26 '22 04:10 pmup999

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 the codequery_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)?

devjoe avatar Oct 30 '22 12:10 devjoe

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

pmup999 avatar Oct 30 '22 15:10 pmup999

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.

devjoe avatar Nov 13 '22 09:11 devjoe

ok, wish I had time then

pmup999 avatar Nov 17 '22 04:11 pmup999