Skip to content

Commit 3c098ca

Browse files
committed
0.1.1: Add SCLS_CONFIG_SUBDIRECTORY to override default lookup dir
1 parent c2c81d7 commit 3c098ca

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# 0.1.1
2+
- Added support for SCLS_CONFIG_SUBDIRECTORY to override default lookup directory for snippets.
13
# 0.0.1
24
- Initial release as a fork under zed-industries.
3-

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "simple-completion-language-server"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55

66
[[bin]]
@@ -11,7 +11,12 @@ path = "src/main.rs"
1111
anyhow = "1.0"
1212
ropey = "1.6"
1313
aho-corasick = "1.1"
14-
tokio = { version = "1", features = ["rt", "rt-multi-thread", "io-std", "macros"] }
14+
tokio = { version = "1", features = [
15+
"rt",
16+
"rt-multi-thread",
17+
"io-std",
18+
"macros",
19+
] }
1520
tower-lsp = { version = "0.20", features = ["runtime-tokio"] }
1621
serde = { version = "1", features = ["serde_derive"] }
1722
serde_json = { version = "1" }
@@ -21,8 +26,8 @@ etcetera = "0.8"
2126
xshell = "0.2"
2227

2328
tracing = "0.1"
24-
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
25-
tracing-appender = "0.2"
29+
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
30+
tracing-appender = "0.2"
2631

2732
[dev-dependencies]
2833
test-log = { version = "0.2", default-features = false, features = ["trace"] }

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ language-servers = [ "scls" ]
7474

7575
Read snippets from dir `~/.config/helix/snippets` or specify snippets path via `SNIPPETS_PATH` env.
7676

77+
Default lookup directory can be overriden via `SCLS_CONFIG_SUBDIRECTORY` as well (e.g. when SCLS_CONFIG_SUBDIRECTORY = `vim`, SCLS will perform it's lookups in `~/.config/vim` instead)
78+
7779
Currently, it supports our own `toml` format and vscode `json` (a basic effort).
7880

7981
Filename used as snippet scope (language), filename `snippets.(toml|json)` will not attach scope to snippets.

src/main.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use etcetera::base_strategy::{choose_base_strategy, BaseStrategy};
2-
use std::collections::HashMap;
2+
use std::{collections::HashMap, path::PathBuf};
33
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
44
use xshell::{cmd, Shell};
55

@@ -132,7 +132,9 @@ async fn main() {
132132

133133
let strategy = choose_base_strategy().expect("Unable to find the config directory!");
134134
let mut config_dir = strategy.config_dir();
135-
config_dir.push("helix");
135+
let config_subdirectory_name =
136+
std::env::var("SCLS_CONFIG_SUBDIRECTORY").unwrap_or_else(|_| "helix".to_owned());
137+
config_dir.push(config_subdirectory_name);
136138

137139
let start_options = StartOptions {
138140
home_dir: etcetera::home_dir()
@@ -141,21 +143,21 @@ async fn main() {
141143
.expect("Unable to get home dir as string!")
142144
.to_string(),
143145
snippets_path: std::env::var("SNIPPETS_PATH")
144-
.map(std::path::PathBuf::from)
146+
.map(PathBuf::from)
145147
.unwrap_or_else(|_| {
146148
let mut filepath = config_dir.clone();
147149
filepath.push("snippets");
148150
filepath
149151
}),
150152
external_snippets_config_path: std::env::var("EXTERNAL_SNIPPETS_CONFIG")
151-
.map(std::path::PathBuf::from)
153+
.map(PathBuf::from)
152154
.unwrap_or_else(|_| {
153155
let mut filepath = config_dir.clone();
154156
filepath.push("external-snippets.toml");
155157
filepath
156158
}),
157159
unicode_input_path: std::env::var("UNICODE_INPUT_PATH")
158-
.map(std::path::PathBuf::from)
160+
.map(PathBuf::from)
159161
.unwrap_or_else(|_| {
160162
let mut filepath = config_dir.clone();
161163
filepath.push("unicode-input");

0 commit comments

Comments
 (0)