Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: cpu.release

on:
push:
tags:
- "v*"

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target ${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: pathfinder-${{ matrix.target }}
path: target/${{ matrix.target }}/release/pathfinder

release:
needs: build
runs-on: ubuntu-slim
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- uses: softprops/action-gh-release@v2
with:
draft: true
files: artifacts/**/*
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: cpu.test

on:
push:
branches: [main]
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo test --verbose
- run: cargo clippy -- -D warnings
- run: cargo fmt -- --check
28 changes: 23 additions & 5 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ mod tests {
#[test]
fn python_multiple_extensions() {
// Python and stub files use the same LSP server
let cli = parse_args(&["-e", "py", "-e", "pyi", "-s", "pyright-langserver", "--", "--stdio"]).unwrap();
let cli = parse_args(&[
"-e",
"py",
"-e",
"pyi",
"-s",
"pyright-langserver",
"--",
"--stdio",
])
.unwrap();
assert_eq!(cli.extension, vec!["py", "pyi"]);
assert_eq!(cli.server, vec!["pyright-langserver", "--", "--stdio"]);
}
Expand All @@ -103,7 +113,10 @@ mod tests {
])
.unwrap();
assert_eq!(cli.extension, vec!["ts"]);
assert_eq!(cli.server, vec!["typescript-language-server", "--", "--stdio"]);
assert_eq!(
cli.server,
vec!["typescript-language-server", "--", "--stdio"]
);
}

#[test]
Expand All @@ -121,7 +134,10 @@ mod tests {
])
.unwrap();
assert_eq!(cli.extension, vec!["py"]);
assert_eq!(cli.server, vec!["uv", "run", "pyright-langserver", "--", "--stdio"]);
assert_eq!(
cli.server,
vec!["uv", "run", "pyright-langserver", "--", "--stdio"]
);
}

#[test]
Expand All @@ -137,7 +153,10 @@ mod tests {
])
.unwrap();
assert_eq!(cli.extension, vec!["jsx"]);
assert_eq!(cli.server, vec!["typescript-language-server", "--", "--stdio"]);
assert_eq!(
cli.server,
vec!["typescript-language-server", "--", "--stdio"]
);
}

#[test]
Expand All @@ -151,5 +170,4 @@ mod tests {
let result = parse_args(&["-e", "py"]);
assert!(result.is_err());
}

}
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ async fn main() -> Result<()> {
let server_specs = cli.to_server_specs()?;

// Extract the single server spec (CLI always produces one spec)
let server_spec = server_specs.into_iter().next()
let server_spec = server_specs
.into_iter()
.next()
.ok_or_else(|| anyhow!("no server specification provided"))?;

let config = Config::from_server_spec(server_spec)?;
Expand Down
5 changes: 3 additions & 2 deletions tests/rust_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ fn definition_via_rust_analyzer() -> Result<()> {
let mut lsp = LspBridge::new_with_command(
&config.server.command[0],
config.server.command[1..].to_vec(),
resolved_workspace
).await?;
resolved_workspace,
)
.await?;
lsp.initialize().await?;

let mut documents = DocumentManager::new();
Expand Down