Skip to content

Commit 6efa978

Browse files
committed
fix nix
1 parent 9fc5760 commit 6efa978

File tree

19 files changed

+924
-724
lines changed

19 files changed

+924
-724
lines changed

.cargo/config.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
[target.x86_64-apple-darwin]
2-
rustflags = [
3-
"-C", "link-arg=-undefined",
4-
"-C", "link-arg=dynamic_lookup",
5-
]
6-
7-
[target.aarch64-apple-darwin]
1+
[target.'cfg(target_os = "macos")']
82
rustflags = [
93
"-C", "link-arg=-undefined",
104
"-C", "link-arg=dynamic_lookup",

.github/workflows/lua-tests.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Lua E2E Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
MACOSX_DEPLOYMENT_TARGET: "13"
12+
13+
jobs:
14+
lua-tests:
15+
name: Lua E2E (${{ matrix.os }})
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: ubuntu-latest
22+
- os: macos-latest
23+
- os: windows-latest
24+
target: x86_64-pc-windows-msvc
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install Zig
29+
uses: mlugg/setup-zig@v2
30+
with:
31+
version: 0.15.2
32+
33+
- name: Install Rust
34+
uses: actions-rust-lang/setup-rust-toolchain@v1
35+
with:
36+
cache: true
37+
cache-on-failure: true
38+
cache-key: "v1-lua-e2e"
39+
rustflags: ""
40+
target: ${{ matrix.target || '' }}
41+
42+
- name: Build Rust binary (Windows)
43+
if: matrix.target
44+
run: cargo build --release --target ${{ matrix.target }} -p fff-nvim
45+
46+
- name: Copy binary to target/release (Windows)
47+
if: matrix.target
48+
shell: bash
49+
run: |
50+
cp target/${{ matrix.target }}/release/fff_nvim.dll target/release/fff_nvim.dll
51+
52+
- name: Build Rust binary
53+
if: ${{ !matrix.target }}
54+
run: cargo build --release -p fff-nvim
55+
56+
- name: Install Neovim
57+
uses: rhysd/action-setup-vim@v1
58+
with:
59+
neovim: true
60+
version: v0.10.4
61+
62+
- name: Clone plenary.nvim
63+
shell: bash
64+
run: git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ../plenary.nvim
65+
66+
- name: Run Lua tests
67+
shell: bash
68+
run: |
69+
nvim --headless -u tests/minimal_init.lua \
70+
-c "PlenaryBustedFile tests/fff_core_spec.lua" 2>&1

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
PLENARY_DIR ?= ../plenary.nvim
2+
3+
.PHONY: build test test-rust test-lua test-setup
4+
5+
build:
6+
cargo build --release
7+
8+
test-setup:
9+
@if [ ! -d "$(PLENARY_DIR)" ]; then \
10+
echo "Cloning plenary.nvim..."; \
11+
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $(PLENARY_DIR); \
12+
fi
13+
14+
test-rust:
15+
cargo test --verbose --workspace --exclude fff-nvim
16+
17+
test-lua: test-setup build
18+
nvim --headless -u tests/minimal_init.lua \
19+
-c "PlenaryBustedFile tests/fff_core_spec.lua" 2>&1
20+
21+
test: test-rust test-lua
22+
23+
format-rust:
24+
cargo fmt --all
25+
format-lua:
26+
stylua .
27+
28+
format: format-rust format-lua

crates/fff-c/src/lib.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -672,33 +672,6 @@ pub unsafe extern "C" fn fff_health_check(test_path: *const c_char) -> *mut FffR
672672
}
673673
}
674674

675-
/// Shorten a file path for display
676-
///
677-
/// # Safety
678-
/// `path` and `strategy` must be valid null-terminated UTF-8 strings (strategy can be null)
679-
#[unsafe(no_mangle)]
680-
pub unsafe extern "C" fn fff_shorten_path(
681-
path: *const c_char,
682-
max_size: u64,
683-
strategy: *const c_char,
684-
) -> *mut FffResult {
685-
let path_str = match unsafe { cstr_to_str(path) } {
686-
Some(s) => s,
687-
None => return FffResult::err("Path is null or invalid UTF-8"),
688-
};
689-
690-
let strategy_str = unsafe { cstr_to_str(strategy) }.unwrap_or("middle_number");
691-
let strategy = fff_core::PathShortenStrategy::from_name(strategy_str);
692-
693-
match fff_core::shorten_path(strategy, max_size as usize, &PathBuf::from(path_str)) {
694-
Ok(shortened) => {
695-
let json = serde_json::to_string(&shortened).unwrap_or_else(|_| "\"\"".to_string());
696-
FffResult::ok_data(&json)
697-
}
698-
Err(e) => FffResult::err(&format!("Failed to shorten path: {}", e)),
699-
}
700-
}
701-
702675
/// Free a result returned by any fff_* function
703676
///
704677
/// # Safety

crates/fff-core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pub static QUERY_TRACKER: Lazy<RwLock<Option<QueryTracker>>> = Lazy::new(|| RwLo
3030
pub use db_healthcheck::{DbHealth, DbHealthChecker};
3131
pub use error::{Error, Result};
3232
pub use file_picker::{FuzzySearchOptions, ScanProgress};
33-
pub use path_utils::{PathShortenStrategy, shorten_path};
3433
pub use types::{FileItem, PaginationArgs, Score, ScoringContext, SearchResult};
3534

3635
// Re-export query parser types (including Location which moved there)

0 commit comments

Comments
 (0)