Skip to content

Commit

Permalink
v0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
bestgopher committed Aug 29, 2024
1 parent 85d8b12 commit 30f8c00
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ on:
pull_request:
push:
tags:
- "**[0-9]+.[0-9]+.[0-9]+*"
- '**[0-9]+.[0-9]+.[0-9]+*'

jobs:
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
Expand All @@ -51,7 +51,7 @@ jobs:
outputs:
val: ${{ steps.plan.outputs.manifest }}
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
tag-flag: ${{ !github.event.pull_request && format('--tag=wakatime-ls-{0}', github.ref_name) || '' }}
tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
publishing: ${{ !github.event.pull_request }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -76,7 +76,7 @@ jobs:
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag=wakatime-ls-{0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
echo "cargo dist ran successfully"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wakatime-zed"
version = "0.1.5"
version = "0.1.7"
edition = "2021"

[lib]
Expand All @@ -20,14 +20,11 @@ lto = "thin"
cargo-dist-version = "0.22.0"
# CI backends to support
ci = "github"
# The archive format to use for non-windows builds (defaults .tar.xz)
unix-archive = ".zip"
# The archive format to use for windows builds (defaults .zip)
windows-archive = ".zip"
# The installers to generate for each app
installers = []
# Target platforms to build apps for (Rust target-triple syntax)
targets = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
]
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
4 changes: 3 additions & 1 deletion wakatime-ls/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[package]
name = "wakatime-ls"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
repository = "https://github.com/bestgopher/wakatime-zed"


[dependencies]
arc-swap = "1.7.1"
Expand Down
19 changes: 14 additions & 5 deletions wakatime-ls/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use arc_swap::ArcSwap;
use arc_swap::{access::Access, ArcSwap};
use chrono::{DateTime, Local, TimeDelta};
use clap::{Arg, Command};
use tokio::{process::Command as TokioCommand, sync::Mutex};
Expand Down Expand Up @@ -48,15 +48,17 @@ impl WakatimeLanguageServer {
let mut command = TokioCommand::new(self.wakatime_path.as_str());

command
.arg("--plugin")
.arg(self.platform.load().as_str())
.arg("--time")
.arg((now.timestamp() as f64).to_string())
.arg("--write")
.arg(event.is_write.to_string())
.arg("--entity")
.arg(event.uri.as_str());

if !self.platform.load().is_empty() {
command.arg("--plugin").arg(self.platform.load().as_str());
}

if let Some(ref key) = self.api_key {
command.arg("--key").arg(key);
}
Expand Down Expand Up @@ -116,7 +118,14 @@ impl LanguageServer for WakatimeLanguageServer {
}

platform.push(' ');
platform.push_str(self.platform.load().as_str());
platform.push_str(
format!(
"{}-wakatime/{}",
client_info.name.as_str(),
env!("CARGO_PKG_VERSION")
)
.as_str(),
);

self.platform.store(Arc::new(platform));
}
Expand Down Expand Up @@ -215,7 +224,7 @@ async fn main() {
client,
wakatime_path: wakatime_cli.to_string(),
api_key,
platform: ArcSwap::from_pointee(format!("wakatime-ls/{}", env!("CARGO_PKG_VERSION"))),
platform: ArcSwap::from_pointee(String::new()),
current_file: Mutex::new(CurrentFile {
uri: String::new(),
timestamp: Local::now(),
Expand Down
2 changes: 1 addition & 1 deletion wakatime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wakatime"
version = "0.1.6"
version = "0.1.7"
edition = "2021"

[lib]
Expand Down

0 comments on commit 30f8c00

Please sign in to comment.