Commit Graph

14 Commits

Author SHA1 Message Date
JINNOUCHI Yasushi
ee2af42d5f
fix: avoid errors occurred by async.util.join (#244) 2024-08-18 22:33:26 +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
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
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
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
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
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
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
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
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
251fdb32d2
fix: do nothing when v:oldfiles are empty (#116) 2023-08-09 09:31:10 +09:00
JINNOUCHI Yasushi
1f32091e2b
refactor!: use OO & add tests (#100)
* 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)
2023-08-06 16:02:37 +09:00