Commit Graph

194 Commits

Author SHA1 Message Date
JINNOUCHI Yasushi
6b6565e658
fix: avoid calling non API-fast funcs in Lua loop (#197) 2024-05-01 18:45:29 +09:00
JINNOUCHI Yasushi
f8a89691c8
fix: respect telescope's path_display (#196) 2024-05-01 17:05:29 +09:00
JINNOUCHI Yasushi
46c5358929
Support path_display: filename_first (#195)
* feat:support path style

* chore: add types and comments to be readable

* fix: do not use the logic without 'filename_first'

---------

Co-authored-by: zhaogang <zhaogang@dustess.com>
2024-05-01 13:17:49 +09:00
JINNOUCHI Yasushi
62534e2479
fix: deal with the pattern when score is -1 (#193)
* fix: deal with the pattern when score is -1

* docs: fix the default value in README
2024-04-29 12:53:44 +09:00
JINNOUCHI Yasushi
42b6421061
feat: add fuzzy matching sorter experimentally (#166)
* feat: add fuzzy matching sorter experimentally

* feat: add an option to select matcher logic

* feat: separate logic to match: fuzzy, fuzzy_full

* Revert "feat: separate logic to match: fuzzy, fuzzy_full"

This reverts commit 64c022904871143ab12c7d6ba29c89fbabdbe15e.

* feat: use fzy sorter and combine recency scores

* feat: enable to change logic to calculate scores

* feat: change the view for scores by config.matcher

* docs: add note in README

* docs: add note for `scoring_function`
2024-04-28 17:58:45 +09:00
JINNOUCHI Yasushi
94a532cb9c
docs: add more notes & fix type annotations (#191)
Use `T[]` instead of `table<integer, T>` for consistency.
2024-04-06 21:24:30 +09:00
Mr.Z
08a28ec511
feat(recency_values): customize recency_values (#190)
Co-authored-by: zhaogang <zhaogang@dustess.com>
2024-04-06 20:49:45 +09:00
JINNOUCHI Yasushi
2a22815b09
Simplify code with using frecency.config (#189)
* chore: change the position of `?`

* fix: use config module to simplify code

* test: fix tests to use frecency.config

* test: remove macOS with nightly Neovim temporarily
2024-03-25 18:45:45 +09:00
JINNOUCHI Yasushi
9f4b0faae4
docs: add instructions to launch frecency via Lua (#188)
fix #185
2024-03-24 16:50:08 +09:00
JINNOUCHI Yasushi
9126d6bc0c
fix: fix type names to avoid conflicting (#186) 2024-03-23 16:49:39 +09:00
JINNOUCHI Yasushi
dde0b71e40
feat: access to DB as lazily as possible (#180)
* 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.
2024-03-21 16:23:45 +09:00
JINNOUCHI Yasushi
747894efd1
feat: use improved telescope's matcher (#184)
ref #177
ref https://github.com/nvim-telescope/telescope.nvim/pull/2950

Now telescope has the same matcher as the one #177 has introduced. This
commit makes it use that.
2024-03-20 18:15:20 +09:00
JINNOUCHI Yasushi
8e3e5ba645
fix: detect nullable config values (#183)
The previous logic makes it ignore nullable config values.
2024-03-18 16:28:11 +09:00
JINNOUCHI Yasushi
ebf22789f6
fix!: disable registration for floating windows (#181)
Due to performance, now it disables registration process in floating
windows.
2024-03-17 18:46:42 +09:00
JINNOUCHI Yasushi
bd52772bf2
fix!: change timing for initialization (#179)
* fix!: change timing for initialization

fix #109
fix #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
2024-03-14 20:28:06 +09:00
JINNOUCHI Yasushi
771726f7d6
feat: match like 'smartcase' (#177)
* feat: match like 'smartcase'

Fix #36

* docs: add note for 'smartcase'

* docs: emphasize requirements
2024-02-25 14:25:40 +09:00
JINNOUCHI Yasushi
4f3e007ec2
feat: hide_current_buffer option (#176)
* feat: `hide_current_buffer` option

* docs: add `hide_current_buffer` option
2024-02-16 14:36:04 +09:00
Teppei Taguchi
5c5302372b
docs: fix typo (#174) 2024-02-12 18:13:12 +09:00
JINNOUCHI Yasushi
a61ede8740
feat: add healthcheck for rg/fdfind/fd (#173) 2024-01-31 08:45:26 +09:00
JINNOUCHI Yasushi
ada91ca486
feat!: remove code for SQLite (#172)
* 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
2024-01-30 18:26:07 +09:00
JINNOUCHI Yasushi
a3e818d001
fix: fix joining paths in Windows (#168)
* fix: use plenary.path to manage paths in Windows

* fix: filter out paths validly in Windows

* fix: detect default `ignore_patterns` in Windows

fix: #169

* fix: join paths validly in Windows

* docs: fix value for `ignore_patterns` in Windows

* fix: avoid duplication of separators in paths

Fix: #171
This fixes only in native logic. The one with SQLite has still bugs.
……but that may not be fixed.
2024-01-28 15:52:47 +09:00
JINNOUCHI Yasushi
1189184484
fix!: no confirm always when db_safe_mode is off (#162)
* fix!: no confirm always when `db_safe_mode` is off

Fix: #50
Fix: #167

Before this, `db_safe_mode = false` makes it no confirmation in
`:FrecencyValidate!`, but it still does in `:FrecencyValidate` and the
auto validation in Neovim's startup.

After this commit, `db_safe_mode = false` makes it no confirmation
always when you see.

And `force` option in `Frecency:validate_database(force)` now means
weather it should remove files less than threshold.

* docs: add notes for lacked options
2024-01-22 22:34:02 +09:00
JINNOUCHI Yasushi
9c18474d0a
feat: expand cwd param (#161)
Now you can use `expand()` string to show up entries by `cwd` param.

```vim
:Telescope frecency workspace=CWD cwd=~
:Telescope frecency workspace=CWD cwd=%:p:h
```
2024-01-01 08:08:02 +09:00
JINNOUCHI Yasushi
6e2c1df245
fix: add hack for showing entries immediately (#160) 2024-01-01 02:10:50 +09:00
JINNOUCHI Yasushi
b57930bfaa
fix: add fallback for v0.9 that has no vim.system (#159)
* fix: add fallback for v0.9 that has no vim.system

* docs: remove note for NUL character delimiters
2024-01-01 01:24:46 +09:00
JINNOUCHI Yasushi
da7c724e3c
List up entries for workspace files by rg or fd (#156)
* feat: read workspace files by external commands

* fix: avoid errors when it manages invalid buffers

* feat: add workspace_scan_cmd to select a way

* docs: describe `workspace_scan_cmd` option
2024-01-01 00:12:17 +09:00
JINNOUCHI Yasushi
de41070181
fix: get file lock forcibly (#153)
* fix: get file lock forcibly

When Neovim ends without removing file locks, it will fail to open
frecency ever because file locks remain. This fix makes it remove file
locks when all attempts fail forcibly.

* test: avoid error in Windows

In Windows, unclosed file cannot be removed, so close it before
unlinking.

* feat: retry to unlink when it fails
2023-12-03 12:55:37 +09:00
JINNOUCHI Yasushi
ca5fa5326f
feat: add an command to delete an entry from DB (#152)
* feat: add an command to delete an entry from DB

Fix #151

* test: add tests for frecency:delete()

* docs: add note for FrecencyDB
2023-11-24 10:51:36 +09:00
JINNOUCHI Yasushi
daf59744f6
feat!: make use_sqlite = false be the default (#148)
* refactor: load lazily sqlite to get filename

* feat: add logic to start migration automatically

* feat: make use_sqlite = false be the default

* docs: update README for removing dependencies

* feat: migrate silently when use_sqlite = false

* chore: remove `SQLite3` from messages

* test: run again max to 5 times in Windows
2023-10-10 18:17:08 +09:00
Will Hopkins
4bdd9bafc7
fix: workspace filtering (#150)
* fix: call `finder:start()` separately from finder init

fixes #149

* fix: show filter column for default workspace if enabled
2023-10-01 16:20:33 +09:00
JINNOUCHI Yasushi
eaaabc90ed
fix: deal with the case that bufname is nil (#147)
ref https://github.com/nvim-telescope/telescope.nvim/issues/2552#issuecomment-1722543221
2023-09-18 08:01:00 +09:00
JINNOUCHI Yasushi
2119da4e3d
feat: add max_timestamps option (#145)
To set recency count. Fix #144
2023-09-17 17:02:58 +09:00
JINNOUCHI Yasushi
767fbf074f
feat: check DB file has been changed (#143)
* refactor: unite logic for finder & async_finder

* chore: fix types

* chore: add sleep to show results at first

* refactor: fix to find results separatedly

* test: remove unnecessary ones and fix others

* test: add matrix for 0.9.x & Windows

* test: use forked plenary.log for Windows

* test: fix to use strptime in Windows

* test: run again if segmentation fault in Windows

* test: loosen timeout for Perl

* test: use the latest plenary.nvim again

* chore: fix types

* chore: change variable name

* feat: watch changes of DB to reload

* chore: add comments to steps

* test: copy whole modules for testing in Windows

* fix: make valid paths for Windows

* test: add tests for Native

* test: use robust way to calculate time

vim.fn.strptime cannot be used in Lua loop

* chore: fix comments

* refactor: simplify the code

* test: loosen condition to detect failures

* test: disable some logging

Many loggings make the test fail.

* test: run tests sequentially in Windows

* test: loosen timeout not to fail on Windows
2023-09-17 15:21:01 +09:00
JINNOUCHI Yasushi
fbda5d91d6
docs: fix link (#139) 2023-08-27 19:06:43 +09:00
JINNOUCHI Yasushi
9037d696e6
feat: add logic to store data by native code (#130)
* 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
2023-08-27 18:51:16 +09:00
JINNOUCHI Yasushi
5d1a01be63
fix: use more gentle one for TelescopeBufferLoaded (#136) 2023-08-26 06:43:01 +09:00
JINNOUCHI Yasushi
e7825aaf57
feat: set default highlights (#135) 2023-08-25 23:17:04 +09:00
JINNOUCHI Yasushi
2e9cbda5cf
fix: use the default filetype for the prompt (#134) 2023-08-25 20:49:45 +09:00
Dmitrii
484ee36613
docs(readme): devicons_disabled -> disable_devicons (#132) 2023-08-25 17:52:34 +09:00
JINNOUCHI Yasushi
3aee7e0c6b
feat: deal with configs in setup() (#127) 2023-08-13 23:58:17 +09:00
JINNOUCHI Yasushi
07e0f87ebd
refactor: remove logic for caching feature (#126)
It can get candidates sufficiently fast with the current logic. Remove logic
for caching feature that still remained.

----

NOTE: My box has a DB containing 1284 files and 2973 timestamps.
`:Telescope frecency` takes around 20 milliseconds on average.
2023-08-13 15:15:35 +09:00
JINNOUCHI Yasushi
2ac311a266
fix: reflow results to show valid ones (#123)
* fix: clear non-matched results in results buffer

* fix: show high-scored results in the first view

This is for sorting_strategy = 'descending'
2023-08-12 15:30:25 +09:00
JINNOUCHI Yasushi
9b17c17744
refactor: make joinpath more simple (#121) 2023-08-12 08:32:24 +09:00
JINNOUCHI Yasushi
1acb245b01
fix: deal with files that have no timestamps (#120)
* test: add tests for removing timestamps

I had a doubt when removing entries from timestamps, it could remove
ones for other files. I added tests but it was a needless fear.

* fix: deal with files that have no timestamps

I do not know why this case occurs. But care it.
2023-08-11 09:52:28 +09:00
JINNOUCHI Yasushi
509288ef3d
fix: add fs.joinpath to work in v0.9.0 (#118)
* test: work tests for async_finder

I noticed these tests do not work because of vim.fs.joinpath lacking. I
will enable these tests and fix the bug.

* feat: implement vim.fs.joinpath to work in v0.9.0
2023-08-10 18:40:02 +09:00
JINNOUCHI Yasushi
251fdb32d2
fix: do nothing when v:oldfiles are empty (#116) 2023-08-09 09:31:10 +09:00
JINNOUCHI Yasushi
54de6e45b9
chore: add types for plenary.async (#115) 2023-08-07 17:46:32 +09:00
delphinus
c87b76f6ef
chore: add more delay not to lock Neovim 2023-08-07 10:25:04 +09:00
JINNOUCHI Yasushi
2ffcfd00ed
fix: deal with default_workspace option (#114) 2023-08-07 07:38:21 +09:00
JINNOUCHI Yasushi
0615dd6343
fix: deal with the case called with no opts (#113) 2023-08-07 07:19:29 +09:00