Commit Graph

234 Commits

Author SHA1 Message Date
JINNOUCHI Yasushi
1b63e9453d
feat!: validate DB before execution only if needed (#257)
With this commit, it validates DB in its init phase only if it is
invoked by `:Telescope frecency` or `:FrecencyDelete`.
2024-09-05 23:12:25 +09:00
JINNOUCHI Yasushi
7634ec0d2d
fix: show validation message validly (#258)
In loading frecency at Neovim startup, `vim.ui.select`'s dialog does not
show message on the first line. This fixes it.
2024-09-02 15:41:18 +09:00
JINNOUCHI Yasushi
5a80665fa7
chore: remove unnecessary types (#256) 2024-09-01 12:12:08 +09:00
JINNOUCHI Yasushi
03ebefef88
feat: enable to load without { main = "frecency" } (#255)
With this, we can load telescope-frecency.nvim without `main =
"frecency"` option in lazy.nvim.
2024-08-31 17:11:09 +09:00
JINNOUCHI Yasushi
a6482c2fbf
feat: separate bootstrap logic to launch faster (#250)
* chore: track setup() time

* feat: avoid setup() to be called twice

* chore: track time between Database:start()

* feat: add bootstrap option to load DB in advance

* feat: initialize DB before frecency class starts

* chore: add more logging

* feat!: load DB in Neovim starting

only if the plugin is loaded non-lazily.

* fix: simplify logic for timer

* fix: detect error and safely finish

* chore: remove unnecessary method
2024-08-31 15:02:15 +09:00
JINNOUCHI Yasushi
38f2a2207e
fix: detect async context more robustly (#254) 2024-08-28 21:58:36 +09:00
Turiiya
476f70e1b0
fix: icon colors (#253) 2024-08-28 14:25:59 +09:00
JINNOUCHI Yasushi
a75b403ea0
feat: pretty print timer (#251)
* feat: store times for duplicated keys

* feat: add func for pretty print timer
2024-08-27 14:49:05 +09:00
JINNOUCHI Yasushi
db32047232
feat: use lazy.nvim to measure times if usable (#249) 2024-08-25 20:31:15 +09:00
JINNOUCHI Yasushi
c140e6ff9c
feat: make query() faster and more lazier (#241)
* refactor: simplify logic to load web_devicons

* refactor: make register() asynchronous

* fix: load lazily modules outside this plugin

* refactor: simplify logic to wait initialization

* refactor: use uv.hrtime() instead of os.clock()

* fix: avoid errors in calling plenary.log in async

* test: store elapsed time to check in tests

* test: fix module names

This becomes a problem only in Ubuntu because macOS and Windows does not
care cases in filenames.

* test: fix types and unused modules

* style: fix by stylua

* refactor: make recency / entry_maker loaded lazily
2024-08-25 19:28:52 +09:00
JINNOUCHI Yasushi
673585ee99
fix: delay calling vim.ui.select to avoid errors (#246)
Fix #243

It occurs an error E5560 when UI to select `y/n` by the user in
validating DB. This delays it until the next tick to avoid errors.
2024-08-20 15:46:15 +09:00
JINNOUCHI Yasushi
9d4d8d21f6
refactor: follow up #244 to reduce calling funcs (#245) 2024-08-19 17:06:37 +09:00
JINNOUCHI Yasushi
ee2af42d5f
fix: avoid errors occurred by async.util.join (#244) 2024-08-18 22:33:26 +09:00
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