Skip to content

Commit

Permalink
Renamed custom_config to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Cor committed Jul 18, 2021
1 parent 5effccd commit 1f9f273
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion helix-core/src/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ where
file_types: vec!["rs".to_string()],
language_id: "Rust".to_string(),
highlight_config: OnceCell::new(),
custom_config: None,
config: None,
//
roots: vec![],
auto_format: false,
Expand Down
2 changes: 1 addition & 1 deletion helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct LanguageConfiguration {
pub scope: String, // source.rust
pub file_types: Vec<String>, // filename ends_with? <Gemfile, rb, etc>
pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml>
pub custom_config: Option<String>,
pub config: Option<String>,

#[serde(default)]
pub auto_format: bool,
Expand Down
15 changes: 6 additions & 9 deletions helix-lsp/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ pub struct Client {
request_counter: AtomicU64,
capabilities: Option<lsp::ServerCapabilities>,
offset_encoding: OffsetEncoding,
custom_config: Option<Value>,
config: Option<Value>,
}

impl Client {
pub fn start(
cmd: &str,
args: &[String],
custom_config: Option<Value>,
config: Option<Value>,
id: usize,
) -> Result<(Self, UnboundedReceiver<(usize, Call)>)> {
let process = Command::new(cmd)
Expand Down Expand Up @@ -59,7 +59,7 @@ impl Client {
request_counter: AtomicU64::new(0),
capabilities: None,
offset_encoding: OffsetEncoding::Utf8,
custom_config,
config,
};

// TODO: async client.initialize()
Expand Down Expand Up @@ -217,11 +217,8 @@ impl Client {
// TODO: delay any requests that are triggered prior to initialize
let root = find_root(None).and_then(|root| lsp::Url::from_file_path(root).ok());

if self.custom_config.is_some() {
log::info!(
"Using custom LSP config: {}",
self.custom_config.as_ref().unwrap()
);
if self.config.is_some() {
log::info!("Using custom LSP config: {}", self.config.as_ref().unwrap());
}

#[allow(deprecated)]
Expand All @@ -230,7 +227,7 @@ impl Client {
// root_path is obsolete, use root_uri
root_path: None,
root_uri: root,
initialization_options: self.custom_config.clone(),
initialization_options: self.config.clone(),
capabilities: lsp::ClientCapabilities {
text_document: Some(lsp::TextDocumentClientCapabilities {
completion: Some(lsp::CompletionClientCapabilities {
Expand Down
2 changes: 1 addition & 1 deletion helix-lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl Registry {
&config.command,
&config.args,
serde_json::from_str(
language_config.custom_config.as_deref().unwrap_or(""),
language_config.config.as_deref().unwrap_or(""),
)
.ok(),
id,
Expand Down
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ injection-regex = "rust"
file-types = ["rs"]
roots = []
auto-format = true
custom-config = """
config = """
{
"cargo": {
"loadOutDirsFromCheck": true
Expand Down

0 comments on commit 1f9f273

Please sign in to comment.