Commit Graph

221 Commits

Author SHA1 Message Date
JINNOUCHI Yasushi
a7ebbb485d
fix: avoid errors caused by echoing messages (#242)
This error below occurs when it takes long time to init the plugin.

E5560: nvim_echo must not be called in a lua loop callback
2024-08-16 13:12:28 +09:00
JINNOUCHI Yasushi
58c0089414
fix!: register realpath for consistency (#240)
Now it uses realpath for registering and validating DB. This means, if you have entries that has filenames differing only for case, it can deal with them as they exist.

Before this, it has miscalculated scores for such cases. For example, in case you have `/path/to/foo.lua` and `/path/to/Foo.lua`, it registers entries for each file. Now it detects accurate filename for the specified one, and removes it in validation.

* test: separate logic for utils

* fix!: register realpath for consistency

* refactor: convert fs module from class

* refactor: move db initialization phase to start()

* fix: run database:start() truly asynchronously

* fix: call each functions with async wrapping

* refactor: add types for args in command

* fix: run register() synchronously

Because vim.api.nvim_* cannot be used in asynchronous functions.

* docs: add note for calling setup() twice

* fix: run non-fast logic on next tick
2024-08-15 17:40:03 +09:00
JINNOUCHI Yasushi
39f70a87a2
fix: use 0 as the current winid (#238) 2024-08-11 16:36:41 +09:00
JINNOUCHI Yasushi
7303f126c7
fix: do not load frecency in Neovim starting (#237) 2024-08-11 12:21:17 +09:00
JINNOUCHI Yasushi
25d01edae8
docs: add note for disabling the dialog (#235)
See https://www.reddit.com/r/neovim/comments/1egczrs/how_to_sort_files_in_telescope_by_showing_the/
2024-08-02 18:20:41 +09:00
JINNOUCHI Yasushi
87ccbae5d2
feat: call init process before telescope loading (#234)
* 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
2024-08-01 17:12:43 +09:00
Rizky Ilham Pratama
cef01dee8b
fix(icons): improve fallback for multi-part file extensions (#233) 2024-07-26 11:38:49 +09:00
JINNOUCHI Yasushi
bb2c63ee53
docs: fix typo (#228) 2024-07-15 10:58:00 +09:00
JINNOUCHI Yasushi
8241382c53
docs: add doc for config.setup() and ignore_* (#227) 2024-07-15 10:47:51 +09:00
JINNOUCHI Yasushi
be5add7248
feat: add an option for a function to ignore files (#223)
* refactor: use vim.pesc instead of implementing

* feat: add optional func to ignore in registering

* test: add tests for ignore_register function

* docs: add note for `ignore_register` option

* docs: add note for use case of `ignore_patterns`
2024-07-14 23:11:14 +09:00
JINNOUCHI Yasushi
03d43510d0
docs: fix typo and formatting (#226)
* style: fix formatting

* test: fix options to construct FS

* test: add cspell.json to validate doc

* docs: fix typo
2024-07-14 22:33:44 +09:00
JINNOUCHI Yasushi
1154548e61
refactor: remove unnecessary opts (#225) 2024-07-14 22:22:06 +09:00
JINNOUCHI Yasushi
316474c183
fix!: config.setup always reset the config (#224)
Before this commit, config.setup() always succeeded the config values.
With this, it uses the default values in calling.
2024-07-14 22:04:42 +09:00
JINNOUCHI Yasushi
880e89eadb
fix: delay setup not to avoid bg color detection (#213)
Fix #210
2024-07-13 23:21:01 +09:00
Matthew Grossman
631bf1af1d
fix: exclude .git for default fd command (#221)
* Update help file for `fd`

* Update finder.lua

* Also change for `fdfind`

* Update doc/telescope-frecency.txt

Co-authored-by: JINNOUCHI Yasushi <delphinus35+github@me.com>

* Update lua/frecency/finder.lua

Co-authored-by: JINNOUCHI Yasushi <delphinus35+github@me.com>

---------

Co-authored-by: JINNOUCHI Yasushi <delphinus35+github@me.com>
2024-07-08 13:48:43 +09:00
JINNOUCHI Yasushi
a03eb9b78a
fix!: show debug msg only when debug is true (#220)
* docs: fix the format for some docs

* fix!: show debug msg only when `debug` is `true`

Fix #212

* test: enable debug logging in tests
2024-07-06 19:13:39 +09:00
JINNOUCHI Yasushi
82c41acfbf
docs: add doc about workspace for query() (#219) 2024-07-06 16:44:31 +09:00
JINNOUCHI Yasushi
8f593064f7
feat: add frecency.query() to query DB (#217)
* 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()
2024-07-06 15:35:59 +09:00
Rizky Ilham Pratama
f3f9325379
feat: support for multi-part file extensions (#215)
* feat: support for multi-part file extensions

* chore: fix for linting

---------

Co-authored-by: JINNOUCHI Yasushi <delphinus35+github@me.com>
2024-06-21 18:02:20 +09:00
JINNOUCHI Yasushi
78570e237c
test: test on 0.10 and macOS (#214) 2024-06-19 17:18:50 +09:00
JINNOUCHI Yasushi
1f2e9b07ac
fix: use the original sorter again (#209)
Fix #36

telescope.nvim's latest release 0.1.8 does not include the changes in
https://github.com/nvim-telescope/telescope.nvim/pull/2950.
So use again the original implementation.

TODO: remove this when the commit will be included in any release.
2024-06-01 13:05:47 +09:00
JINNOUCHI Yasushi
14cb823ec2
docs: add note for FrecencyOpts (#208)
* docs: add lacked help tags

* docs: add FrecencyOpts and its explanation
2024-06-01 11:46:19 +09:00
JINNOUCHI Yasushi
8783a062f7
fix: make the path for file_lock unless it exists (#205) 2024-05-25 21:24:30 +09:00
JINNOUCHI Yasushi
865f51a611
feat!: set the default DB path to XDG_STATE_HOME (#204)
* feat: access user opts from config.ext_config

* feat!: set the default DB path to XDG_STATE_HOME

* feat: add fallback logic to detect old DB path

* docs: add note for this change
2024-05-25 17:27:08 +09:00
JINNOUCHI Yasushi
08e3ad80fc
docs: add doc and slim down README (#203)
* chore: add .gitignore entries to ignore `tags`

* docs: add doc

* docs: slim down the README
2024-05-25 16:14:23 +09:00
Zheng PiaoDan
1a05e58014
fix: highlight loaded buffers every time (#202) 2024-05-24 19:26:46 +09:00
JINNOUCHI Yasushi
328452afcc
feat: use fd over than rg because fd is faster (#199)
Fix #198
2024-05-20 14:16:28 +09:00
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