Commit graph

61 commits

Author SHA1 Message Date
aca63430ec chore: add issue templates 2022-12-28 11:03:45 +00:00
f483fc4992 ci: add required version param to stylua-action
This is getting set to latest. The docs say this could break CI due to
changes in stylua bit right now I think that is better than maintain the
version manually.
2022-12-07 20:34:41 +00:00
dependabot[bot]
238d9d184e chore: bump JohnnyMorganz/stylua-action from 1.1.2 to 2.0.0
Bumps [JohnnyMorganz/stylua-action](https://github.com/JohnnyMorganz/stylua-action) from 1.1.2 to 2.0.0.
- [Release notes](https://github.com/JohnnyMorganz/stylua-action/releases)
- [Commits](https://github.com/JohnnyMorganz/stylua-action/compare/v1.1.2...v2.0.0)

---
updated-dependencies:
- dependency-name: JohnnyMorganz/stylua-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-07 20:34:41 +00:00
dependabot[bot]
8635cf81ee chore: bump rayon from 1.5.3 to 1.6.0
Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.5.3 to 1.6.0.
- [Release notes](https://github.com/rayon-rs/rayon/releases)
- [Changelog](https://github.com/rayon-rs/rayon/blob/master/RELEASES.md)
- [Commits](https://github.com/rayon-rs/rayon/compare/v1.5.3...rayon-core-v1.6.0)

---
updated-dependencies:
- dependency-name: rayon
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-07 20:33:34 +00:00
864b9c8821 fix: exscpe test when passing it to vim syntax match
This was causing an issue an invalid regex. Now we are escapeing the
text to make it a valid regex.

There is also a small improvement where we no longer try and highlight
matched words if the "text" is empty.

Ref: #26
2022-10-06 07:57:57 +01:00
1e34a7fe74 test: add more mocks 2022-10-06 07:57:57 +01:00
b255d91e6d test: improve style of the test output
Add more space around the text, also make the text a readable color on
dark backgrounds.
2022-10-06 07:57:57 +01:00
84bf581a31 test: fix the after_each hook not getting called
When writing tests the `after_each` function was never getting called
due to the `before_each` function getting called instead
2022-10-06 07:57:57 +01:00
afbf2892af feat: add logo 2022-10-01 11:11:38 +01:00
dependabot[bot]
a7c9e2e409 chore: bump JohnnyMorganz/stylua-action from 1.1.0 to 1.1.2
Bumps [JohnnyMorganz/stylua-action](https://github.com/JohnnyMorganz/stylua-action) from 1.1.0 to 1.1.2.
- [Release notes](https://github.com/JohnnyMorganz/stylua-action/releases)
- [Commits](https://github.com/JohnnyMorganz/stylua-action/compare/v1.1.0...v1.1.2)

---
updated-dependencies:
- dependency-name: JohnnyMorganz/stylua-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-23 15:04:56 +01:00
dependabot[bot]
b4d2673c71 chore: bump JohnnyMorganz/stylua-action from 1.0.0 to 1.1.0
Bumps [JohnnyMorganz/stylua-action](https://github.com/JohnnyMorganz/stylua-action) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/JohnnyMorganz/stylua-action/releases)
- [Commits](https://github.com/JohnnyMorganz/stylua-action/compare/1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: JohnnyMorganz/stylua-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-18 19:58:30 +01:00
e9cdd40c74 fix: crash in IvyLines 2022-09-18 19:58:09 +01:00
8d02c3a439 chore: add dependabot 2022-09-18 19:50:24 +01:00
c63ff5ff37 chore: update dependencies 2022-09-18 19:50:24 +01:00
6f58ad6d67 feat: add vsplit and split actions
Now you can open the currently selected item in a vertical split or a
horizontal split. The completion callback must support the current
actions.

There is also a bit of testing in here. The vim mock has been refactored
and split out so we can use it multiple tests.
2022-09-07 21:19:33 +01:00
ced6e5ae1e ci: setup stylua action 2022-09-04 16:18:04 +01:00
f1577f5c3e refactor: upgrade to actions/checkout v3
Ref: #10
2022-09-04 16:18:04 +01:00
95be579cef fix: ensure the correct window is activated on complete
When you complete a completion the completion window is no longer
activated after the callback is run. This was causing issues with the
incorrect window being active after the completion.

This will lead the way for more actions other then edit, that will be
comming soon.

Fixes-issue: #8
2022-09-04 15:34:47 +01:00
a3cd30d4ff test: add base test for ivy.window 2022-09-04 15:34:47 +01:00
3b0d1510e7 fix: include dot files in search results
This adds dot files into the finder. We are adding the overrides to the
`ignore` package, that can be used later to add custom ignore
directories that can be passed in as settings.

We are also adding a new `ivy_cwd` function to libivy to get the current
directory due to the limitations of lua.

Fixes-issue: #16
2022-09-04 13:33:50 +01:00
252fc9da1d fix: displaying the incorrect number of items in completions 2022-09-02 21:33:19 +01:00
1220eb3bc3 feat: highlight the completion chars in for gui
Ref: #9
2022-09-02 21:31:56 +01:00
f70cd6aad8 fix: remove the completion buffer from the buffer list
You will no longer see the completion "Buffers" in the list of buffers
when searching for buffers.

Fixes-issue: #7
2022-09-02 21:25:19 +01:00
a712c929cb feat: make the completion candidates type more consistent
The API for `window.set_items` took to many variable types. It would
take a table in multiple different formats and a string. Now it will
only take a table in a single format and a string. It will convert the
string into the table format by splitting it on new lines.

The table format is an array of tables that must have a `content` key
that will be the text that is displayed in the completion window. The
table can have any other data that is ignored.

```lua
local items = {
  { content = "Item one" },
  { content = "Item two" }
}
```

The `set_items` function will only display the `content` key in the
completion window, it will not do any sorting or filtering, that must be
done before passing the data to the `set_items` function.
2022-09-02 21:03:56 +01:00
e25a96c34a
Merge pull request #6 from AdeAttwood/experimental-rust
Experimental rust
2022-08-28 20:24:41 +01:00
45d61ffc32 ci: add rust build and format into the actions 2022-08-28 18:11:51 +01:00
39febd82e2 docs: add updated benchmark to the readme 2022-08-28 10:15:55 +01:00
a50a489479
Merge pull request #5 from Xymist/rust_xymist
Rust performance improvements
2022-08-26 21:06:46 +01:00
Xymist
b509a5842f Remove ThreadPool
Having switched to iterators and Rayon this is no longer used.
2022-08-26 16:46:51 +01:00
Xymist
de41712291 Return to using minimum_score
- Update the provided `minimum_score` in `sorter::Option::new` to match
  what was being used in `sort_strings`
- Use the `minimum_score` value instead of a hardcoded number

This seems like functionality that was either intended and not added, or
added and then part removed. Either way the performance impact is
minimal and it's a nice idea.
2022-08-26 16:40:12 +01:00
Xymist
d95d65c6a3 Use Rayon for sorting as well
- For completeness, but also for additional performance when there are
  extremely large numbers of results, use `par_sort_unstable_by()` for
  sorting the results. For most sane result sets this will not represent
  a significant speedup (for the Kubernetes benchmark it's around 1%)
  but as the set to be sorted grows the impact would be larger.
2022-08-26 16:36:34 +01:00
Xymist
c5e8677a37 Introduce Rayon for parallel iteration and sorting
- Use `into_par_iter()` before setting out to calculate scores and then
  filter by them

This represents a more efficient parallelism approach, with no mutex
or global state at top level.

ivy_files(kubernetes)   time:   [4.5800 ms 4.6121 ms 4.6467 ms]
                        change: [-55.056% -54.570% -54.133%] (p = 0.00 < 0.05)
                        Performance has improved.

ivy_match(file.lua)     time:   [1.1514 µs 1.1599 µs 1.1694 µs]
                        change: [+0.4116% +2.0753% +3.6710%] (p = 0.01 < 0.05)
                        Change within noise threshold.
2022-08-26 16:34:15 +01:00
Xymist
cec8393770 Remove multithreading for sorting
The relevant processes are so fast, mutexes and mutex locks are so
expensive, and iterators so efficient, that it's actually faster to run
single-threaded across all the data than to spin up a bunch of threads
and have them basically spinlock waiting for the global mutex involved
either directly or in a channel.

ivy_files(kubernetes)   time:   [10.209 ms 10.245 ms 10.286 ms]
                        change: [-36.781% -36.178% -35.601%] (p = 0.00 < 0.05)
                        Performance has improved.

ivy_match(file.lua)     time:   [1.1626 µs 1.1668 µs 1.1709 µs]
                        change: [+0.2131% +1.5409% +2.9109%] (p = 0.02 < 0.05)
                        Change within noise threshold.
2022-08-26 16:29:11 +01:00
Xymist
7fb8be541a Reduce lock contention (round 1)
- Use an async (i.e. unlimited buffer) MPSC channel instead of an
  Arc<Mutex<Vec>> for storing the scored matches in Sorter
- Use Arc<Matcher> instead of Arc<Mutex<Matcher>> for the matcher, as
  it's not mutated and appears to be threadsafe.

This cuts average iteration time (on the benchmarked machine) from
25.98ms to 16.08ms for the ivy_files benchmark.
2022-08-26 16:01:22 +01:00
Xymist
ce28b248fa Add results to .gitignore 2022-08-26 15:17:23 +01:00
Xymist
8ab074b537 Add benchmarks and an example bin for profiling 2022-08-26 14:20:17 +01:00
Xymist
12a1a64c54 Format and clippy 2022-08-26 10:25:05 +01:00
ac01e9e9a4 docs: update the build info and benchmark status 2022-08-25 21:01:19 +01:00
f4a65a574c perf: add instance prop of SkimMatcherV2
This is so we are not crating an new instance of this each time we are
scoring a match.
2022-08-25 20:19:09 +01:00
9fdb633f3e chore: cache directory when ivy_init is called
This is now implemented in rust
2022-08-25 20:19:09 +01:00
e7b7dc1e4c feat: experimental first rust implementation of libivy 2022-08-25 20:19:01 +01:00
7439ff98b0 feat: move to fts fuzzy match with some modifications 2022-08-25 20:14:12 +01:00
Ade Attwood
d7df043eb9 perf: reduce copying when sorting
Passes values by reference when sorting to reduce memory copying. The
main saving on this is preventing copying of the large vector of files
getting passed into the `sort` function and then copying each item in
the vector in the for. This results in about a 27% performance gain
reducing the full benchmark of the kubernetes benchmark by 7.89 sec

Before

| Name                         | Total         | Average       | Min           | Max           |
| ---------------------------- | ------------- | ------------- | ------------- | ------------- |
| ivy_match(file.lua) 1000000x | 02.351614 (s) | 00.000002 (s) | 00.000002 (s) | 00.000042 (s) |
| ivy_files(kubernetes) 100x   | 32.704256 (s) | 00.327043 (s) | 00.289397 (s) | 00.344413 (s) |

After

| Name                         | Total         | Average       | Min           | Max           |
| ---------------------------- | ------------- | ------------- | ------------- | ------------- |
| ivy_match(file.lua) 1000000x | 02.353386 (s) | 00.000002 (s) | 00.000002 (s) | 00.000049 (s) |
| ivy_files(kubernetes) 100x   | 24.809576 (s) | 00.248096 (s) | 00.203167 (s) | 00.270263 (s) |
2022-08-07 21:48:24 +01:00
Ade Attwood
1ae47813d7 feat: add benchmarks 2022-08-07 16:41:51 +01:00
Ade Attwood
2c04dd79dd ci: add clang format to the actions 2022-08-07 16:41:51 +01:00
Ade Attwood
5d6546d414 ci: add luacheck 2022-08-07 16:41:51 +01:00
Ade Attwood
f2a22c2190 test: add test for ivy.prompt 2022-08-06 14:21:36 +01:00
Ade Attwood
acbf91d0dc test: add hooks to test scripts
Now you can use `before` `before_each` `after` and `after_each`. Each of
the hooks will run in the context of the test file.

`before` This will run once before all the tests
`before_each` This will run before each of the test functions
`after` Will run once after all the test functions
`after_each` Will run after each one of the test functions

Multiple functions can be defined for each hook by calling the
respective function again.
2022-08-06 14:16:12 +01:00
Ade Attwood
df80d5e837 ci: add test and build actions 2022-08-06 10:45:04 +01:00
Ade Attwood
617f6a98cc test: a test script and some tests
This adds the start of the test suite that we can add into CI to ensure
we are not pussing a broken build.
2022-08-06 10:45:04 +01:00