* feat: call init process before telescope loading
Fix#231
This changes enable to load frecency without telescope's loading itself.
This is needed when you want to load telescope lazily, but want to start
registering process as soon as Neovim has started.
```lua
{
"nvim-telescope/telescope-frecency.nvim",
main = "frecency",
---@type FrecencyOpts
opts = {
db_safe_mode = false,
},
},
{
"nvim-telescope/telescope.nvim",
-- `cmd` opts makes lazy.nvim load telescope.nvim lazily.
cmd = { "Telescope" },
config = function()
local telescope = require "telescope"
telescope.setup {
extensions = {
other_extension = {
foo_bar = true,
},
-- Here you need no configuration opts for frecency because
-- you've already done.
}
}
-- This is still needed.
telescope.load_extension "frecency"
end,
},
```
* docs: add note for loading telescope.nvim lazily
* feat: add function to query the DB
* docs: add documentation for frecency.query()
* test: fix tests to run with `timestamps` property
* test: add tests for frecency.query()
* fix: fix prop attributes and names
* feat: load DB as lazily as possible
* fix: move util function to test module
* feat: use one coroutine to access DB
* test: fix to wait the table to be ready
* fix: avoid race conditions
Before this, it can run require("frecency").new() duplicatedly to wait
until frecency:setup() finishes.
* fix!: change timing for initialization
fix#109fix#59
This fixes problems below.
* Auto-validation feature is called at Neovim starting.
- → Now it starts at `:Telescope frecency` called at the first time.
* `frecency.setup()` is called every when `:Telescope frecency` is
called.
- → Now it is called only once.
* `telescope.setup()` calls `frecency.new()` and it reads the database.
This causes time in executing `init.lua`.
- → Now it reads the database lazily. It reads at the first time when
needed.
* test: change logic to initialize config
* test: make Neovim version newer in CI
* feat!: remove code for SQLite
ref [Introduce revised telescope-frecency.nvim : neovim](https://www.reddit.com/r/neovim/comments/174m8zu/introduce_revised_telescopefrecencynvim/)
I have deprecated SQLite features 4 months ago. It is the time to remove
code for them.
* test: fix test to load telescope validly
* test: remove sqlite.lua from CI settings
* test: test database as native
* fix: add lacked type from old database/sqlite.lua
* docs: remove description for SQLite3 logic
* chore: fix types
* chore: add types for Database:raw_table
* refactor: make logic for Database be abstract
* feat: add logic for DB by string.dump
* fix: run with async.void to run synchronously
* test: add tests for native feature
* feat!: sort candidates by path when score is same
This is needed because candidates from SQLite is sorted by id, but ones from native is sorted by path.
* chore: clean up types
* feat: add lock/unlock feature to access DB
* test: use async version of busted
And disable benchmark tests (fix later)
* test: add tests for file_lock
* chore: use more explicit names
* chore: use plenary.log instead
* fix: wait async functions definitely
* feat: add migrator
* chore: fix logging
* fix: detect emptiness of the table
* fix: deal with buffer with no names
* test: loosen the condition temporarily
* test: add tests for migrator
* fix: return true when the table is not empty
* feat: load sqlite lazily not to require in start
* chore: add logging to calculate time for fetching
* feat: add converter from native code to SQLite
* feat: warn when sqlite.lua is not available
* feat: add FrecencyMigrateDB to migrate DB
* docs: add note for native code logic
* test: ignore type bug
* I did an overhall for all codes and added typing by Lua-language-server and tests. It also works on CI.
* Now it searches files on the workspace completely asynchronously. It does not block your text input. (Fix#106)
Make count = 1 when you open a file you've never opened (Fix#107)
* refactor(db): use new sql.nvim api
* refactor(*): create const, algo and add more util
* refactor(picker): try to cleanup and make it easy to read
FIXME: it seems that I didn't refactor the entry maker right.
* refactor(*): move util to lua/frecency
* misc(db): flag possible bug
* refactor(db): reflect changes introduced in https://github.com/tami5/sql.nvim/pull/96
* refactor(db): move set_config to frecency.lua
* new(db): ignore term and octo paths
This may possibly fix the issue with entry.count being nil.
* misc(picker): move health out of export
* refactor(util)
* refactor(db): general
* misc(*): nothing major
* refactor(db): abbreviate table namespace access
* refactor(picker): working-ish
* fix(*): general
* refactor(picker): move fd function to the end of the file
* refactor(*): remove the need for db.init
* new(db): use foreign keys
* sync with sqlite.lua@#105
* feat: add settings for StyLua
* fix: detect the valid module in healthcheck
See #65
* style: fix by StyLua
* fix: detect CWD tag to cut paths
See #66
* fix: show icon before directory
See #67
* fix: deal with show_filter_column option validly
* feat: support opts.workspace (#68)
* doc(readme): update config example (#33)
remove comma causing error.
* doc(readme): fix packer install instructions (#34)
Co-authored-by: tami5 <65782666+tami5@users.noreply.github.com>
* doc: follow sqlite new release (#40)
* refactor(sql_wrapper): follow sqlite new release
* update readme
* refactor: follow telescope's interface changes
See #46
* feat: add default_workspace tag
See #43
* fix: fetch workspaces in addition to completing
See #72
* Update url for sqlite dependency (#64)
The old repository on github redirects to this one.
* fix: use vim.notify not to block outputs
See #75
* feat: opts.path_display to customize
See #76
* Enable to specify tags to show the tails (#77)
* Enable to specify tags to show the tails
* Add doc for show_filter_column
* feat: use more reasonable matcher to sort
See #73
* Fix broken Frecency Algorithm link in README.md (#82)
MDN appear to have removed the Frecency Algorithm page linked in the README document. Updating link to use archived version.
* fix: set the telescope default filetype in prompt
See #81
* feat: use the newer API to define autocmds
See #79
* refactor: use new API and add check for devicons
* feat: detect entries when it has added new ones
See #87
* fix: use valid widths to show entries
* fix: use substr matcher to use sorting by scores
See #94
* Revert "fix: set the telescope default filetype in prompt"
This reverts commit 4937f7045438412e31a77374f91230bdbcbeb34d.
* fix: enable to filter by valid paths
* refactor: do nothing until calling setup()
See #80
* fix: fix typo for `workspaces`
* fix: show `0` score for unindexed instead of `nil`
* style: fix by StyLua
* fix: return a valid entry with get()
It have used where() to get the entry and where() uses get() to fetch
from DB. But this table has been customized by overwriting get(), so it
has a bug to return the same entry every time it calls. This fixes it.
* refactor: get the buffer name explicitly
* fix: clean up logic to validate DB
* feat: enable to work db_root option
* fix: show no msg when no need to validate in auto
---------
Co-authored-by: Tami <65782666+tami5@users.noreply.github.com>
Co-authored-by: Munif Tanjim <hello@muniftanjim.dev>
Co-authored-by: premell <65544203+premell@users.noreply.github.com>
Co-authored-by: Anshuman Medhi <amedhi@connect.ust.hk>
Co-authored-by: Lucas Hoffmann <lucc@users.noreply.github.com>
Co-authored-by: Rohan Orton <rohan.orton@gmail.com>
* Use Lua function to complete tags
* Use Lua func to define validating command
* Use new API's to define options & mappings
* Add not for usage of `FrecencyValidate`
* draft implementation of tags/filters
* .
* add filtering:
- extended substring sorter to have modes:
- when current string is prefixed by `:foo`, results are tag_names that
come from tags/workspaces table. (if `:foo ` token is incomplete it is
ignored)
- when a complete workspace tag is matched ':foobar:', results are
indexed_files filtered by if their parent_dir is a descendant of the
workspace_dir
- a recursive scan_dir() result is added to the :foobar: filter
results; any non-indexed_files are given a score of zero, and are
alphabetically sorted below the indexed_results
- tab completion for tab_names in insert mode`:foo|` state: cycles
through available options
* add completion file
* use attach_mappings for <CR> map
* stop completion being enabled multiple times
* improve keys
* improve completion cancellation
* add dynamic `lsp` tag
* add dynamic `lsp` tag
* fix empty lsp workspaces
* remove hardcoded workspaces and allow config from ext_config
* add filter highlight and some fixes
* .
* add workspace filters to readme
* wip LSP workspace filter
* merge ignore_patterns fix
* change LSP_ROOT tagname to LSP
* fix setting default values
* .
* update readme with filter instructions
* remove debug message
* improve relative paths
* improve relative paths
* WIP dynamic column sizes
* WIP filter_column_width
* fix keymaps
* .
* feat: persistent filters
* refactor config creation
* fix: filter directory column autosize
* improve LSP workspace paths
* .
* remove workspace filter output
* cache persistent filter results
* fix cached results
* .
* remove results cache; sorting is the expensive part
* respect ignore patterns for non-indexed files.
* return table on on_input_filter_cb