mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Appease clippy
This commit is contained in:
parent
eeb21af841
commit
233b28a1b9
@ -52,7 +52,7 @@ fn compile_metal_shaders() {
|
|||||||
println!("cargo:rerun-if-changed={}", shader_path);
|
println!("cargo:rerun-if-changed={}", shader_path);
|
||||||
|
|
||||||
let output = Command::new("xcrun")
|
let output = Command::new("xcrun")
|
||||||
.args(&[
|
.args([
|
||||||
"-sdk",
|
"-sdk",
|
||||||
"macosx",
|
"macosx",
|
||||||
"metal",
|
"metal",
|
||||||
@ -76,7 +76,7 @@ fn compile_metal_shaders() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let output = Command::new("xcrun")
|
let output = Command::new("xcrun")
|
||||||
.args(&["-sdk", "macosx", "metallib"])
|
.args(["-sdk", "macosx", "metallib"])
|
||||||
.arg(air_output_path)
|
.arg(air_output_path)
|
||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg(metallib_output_path)
|
.arg(metallib_output_path)
|
||||||
|
@ -647,7 +647,7 @@ impl platform::Platform for MacPlatform {
|
|||||||
attrs.set(kSecReturnAttributes as *const _, cf_true);
|
attrs.set(kSecReturnAttributes as *const _, cf_true);
|
||||||
attrs.set(kSecReturnData as *const _, cf_true);
|
attrs.set(kSecReturnData as *const _, cf_true);
|
||||||
|
|
||||||
let mut result = CFTypeRef::from(ptr::null_mut());
|
let mut result = CFTypeRef::from(ptr::null());
|
||||||
let status = SecItemCopyMatching(attrs.as_concrete_TypeRef(), &mut result);
|
let status = SecItemCopyMatching(attrs.as_concrete_TypeRef(), &mut result);
|
||||||
match status {
|
match status {
|
||||||
security::errSecSuccess => {}
|
security::errSecSuccess => {}
|
||||||
|
@ -162,11 +162,9 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
|||||||
if let FnArg::Typed(arg) = arg {
|
if let FnArg::Typed(arg) = arg {
|
||||||
if let Type::Path(ty) = &*arg.ty {
|
if let Type::Path(ty) = &*arg.ty {
|
||||||
let last_segment = ty.path.segments.last();
|
let last_segment = ty.path.segments.last();
|
||||||
match last_segment.map(|s| s.ident.to_string()).as_deref() {
|
|
||||||
Some("StdRng") => {
|
if let Some("StdRng") = last_segment.map(|s| s.ident.to_string()).as_deref() {
|
||||||
inner_fn_args.extend(quote!(rand::SeedableRng::seed_from_u64(seed),));
|
inner_fn_args.extend(quote!(rand::SeedableRng::seed_from_u64(seed),));
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inner_fn_args.extend(quote!(cx,));
|
inner_fn_args.extend(quote!(cx,));
|
||||||
|
@ -5,7 +5,7 @@ use std::{
|
|||||||
process::Command,
|
process::Command,
|
||||||
};
|
};
|
||||||
|
|
||||||
const SWIFT_PACKAGE_NAME: &'static str = "LiveKitBridge";
|
const SWIFT_PACKAGE_NAME: &str = "LiveKitBridge";
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
@ -61,8 +61,8 @@ fn build_bridge(swift_target: &SwiftTarget) {
|
|||||||
let swift_package_root = swift_package_root();
|
let swift_package_root = swift_package_root();
|
||||||
if !Command::new("swift")
|
if !Command::new("swift")
|
||||||
.arg("build")
|
.arg("build")
|
||||||
.args(&["--configuration", &env::var("PROFILE").unwrap()])
|
.args(["--configuration", &env::var("PROFILE").unwrap()])
|
||||||
.args(&["--triple", &swift_target.target.triple])
|
.args(["--triple", &swift_target.target.triple])
|
||||||
.current_dir(&swift_package_root)
|
.current_dir(&swift_package_root)
|
||||||
.status()
|
.status()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -116,7 +116,7 @@ fn get_swift_target() -> SwiftTarget {
|
|||||||
let target = format!("{}-apple-macosx{}", arch, MACOS_TARGET_VERSION);
|
let target = format!("{}-apple-macosx{}", arch, MACOS_TARGET_VERSION);
|
||||||
|
|
||||||
let swift_target_info_str = Command::new("swift")
|
let swift_target_info_str = Command::new("swift")
|
||||||
.args(&["-target", &target, "-print-target-info"])
|
.args(["-target", &target, "-print-target-info"])
|
||||||
.output()
|
.output()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.stdout;
|
.stdout;
|
||||||
@ -143,7 +143,7 @@ fn copy_dir(source: &Path, destination: &Path) {
|
|||||||
assert!(
|
assert!(
|
||||||
Command::new("cp")
|
Command::new("cp")
|
||||||
.arg("-R")
|
.arg("-R")
|
||||||
.args(&[source, destination])
|
.args([source, destination])
|
||||||
.status()
|
.status()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.success(),
|
.success(),
|
||||||
|
@ -3,7 +3,7 @@ use std::{env, path::PathBuf, process::Command};
|
|||||||
fn main() {
|
fn main() {
|
||||||
let sdk_path = String::from_utf8(
|
let sdk_path = String::from_utf8(
|
||||||
Command::new("xcrun")
|
Command::new("xcrun")
|
||||||
.args(&["--sdk", "macosx", "--show-sdk-path"])
|
.args(["--sdk", "macosx", "--show-sdk-path"])
|
||||||
.output()
|
.output()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.stdout,
|
.stdout,
|
||||||
|
@ -113,9 +113,9 @@ pub mod core_video {
|
|||||||
let mut this = ptr::null();
|
let mut this = ptr::null();
|
||||||
let result = CVMetalTextureCacheCreate(
|
let result = CVMetalTextureCacheCreate(
|
||||||
kCFAllocatorDefault,
|
kCFAllocatorDefault,
|
||||||
ptr::null_mut(),
|
ptr::null(),
|
||||||
metal_device,
|
metal_device,
|
||||||
ptr::null_mut(),
|
ptr::null(),
|
||||||
&mut this,
|
&mut this,
|
||||||
);
|
);
|
||||||
if result == kCVReturnSuccess {
|
if result == kCVReturnSuccess {
|
||||||
@ -192,7 +192,7 @@ pub mod core_video {
|
|||||||
pub fn as_texture_ref(&self) -> &metal::TextureRef {
|
pub fn as_texture_ref(&self) -> &metal::TextureRef {
|
||||||
unsafe {
|
unsafe {
|
||||||
let texture = CVMetalTextureGetTexture(self.as_concrete_TypeRef());
|
let texture = CVMetalTextureGetTexture(self.as_concrete_TypeRef());
|
||||||
&metal::TextureRef::from_ptr(texture as *mut _)
|
metal::TextureRef::from_ptr(texture as *mut _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ pub fn random_token() -> String {
|
|||||||
for byte in token_bytes.iter_mut() {
|
for byte in token_bytes.iter_mut() {
|
||||||
*byte = rng.gen();
|
*byte = rng.gen();
|
||||||
}
|
}
|
||||||
base64::encode_config(&token_bytes, base64::URL_SAFE)
|
base64::encode_config(token_bytes, base64::URL_SAFE)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PublicKey {
|
impl PublicKey {
|
||||||
|
@ -62,7 +62,7 @@ fn parse_snippet<'a>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
let chunk_end = source.find(&['}', '$', '\\']).unwrap_or(source.len());
|
let chunk_end = source.find(['}', '$', '\\']).unwrap_or(source.len());
|
||||||
let (chunk, rest) = source.split_at(chunk_end);
|
let (chunk, rest) = source.split_at(chunk_end);
|
||||||
text.push_str(chunk);
|
text.push_str(chunk);
|
||||||
source = rest;
|
source = rest;
|
||||||
|
@ -20,7 +20,7 @@ unsafe impl Send for Connection {}
|
|||||||
impl Connection {
|
impl Connection {
|
||||||
pub(crate) fn open(uri: &str, persistent: bool) -> Result<Self> {
|
pub(crate) fn open(uri: &str, persistent: bool) -> Result<Self> {
|
||||||
let mut connection = Self {
|
let mut connection = Self {
|
||||||
sqlite3: 0 as *mut _,
|
sqlite3: ptr::null_mut(),
|
||||||
persistent,
|
persistent,
|
||||||
write: RefCell::new(true),
|
write: RefCell::new(true),
|
||||||
_sqlite: PhantomData,
|
_sqlite: PhantomData,
|
||||||
@ -32,7 +32,7 @@ impl Connection {
|
|||||||
CString::new(uri)?.as_ptr(),
|
CString::new(uri)?.as_ptr(),
|
||||||
&mut connection.sqlite3,
|
&mut connection.sqlite3,
|
||||||
flags,
|
flags,
|
||||||
0 as *const _,
|
ptr::null(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Turn on extended error codes
|
// Turn on extended error codes
|
||||||
@ -97,7 +97,7 @@ impl Connection {
|
|||||||
let remaining_sql_str = remaining_sql.to_str().unwrap().trim();
|
let remaining_sql_str = remaining_sql.to_str().unwrap().trim();
|
||||||
remaining_sql_str != ";" && !remaining_sql_str.is_empty()
|
remaining_sql_str != ";" && !remaining_sql_str.is_empty()
|
||||||
} {
|
} {
|
||||||
let mut raw_statement = 0 as *mut sqlite3_stmt;
|
let mut raw_statement = ptr::null_mut::<sqlite3_stmt>();
|
||||||
let mut remaining_sql_ptr = ptr::null();
|
let mut remaining_sql_ptr = ptr::null();
|
||||||
sqlite3_prepare_v2(
|
sqlite3_prepare_v2(
|
||||||
self.sqlite3,
|
self.sqlite3,
|
||||||
|
@ -48,7 +48,7 @@ impl<'a> Statement<'a> {
|
|||||||
.trim();
|
.trim();
|
||||||
remaining_sql_str != ";" && !remaining_sql_str.is_empty()
|
remaining_sql_str != ";" && !remaining_sql_str.is_empty()
|
||||||
} {
|
} {
|
||||||
let mut raw_statement = 0 as *mut sqlite3_stmt;
|
let mut raw_statement = ptr::null_mut::<sqlite3_stmt>();
|
||||||
let mut remaining_sql_ptr = ptr::null();
|
let mut remaining_sql_ptr = ptr::null();
|
||||||
sqlite3_prepare_v2(
|
sqlite3_prepare_v2(
|
||||||
connection.sqlite3,
|
connection.sqlite3,
|
||||||
@ -101,7 +101,7 @@ impl<'a> Statement<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bind_index_with(&self, index: i32, bind: impl Fn(&*mut sqlite3_stmt) -> ()) -> Result<()> {
|
fn bind_index_with(&self, index: i32, bind: impl Fn(&*mut sqlite3_stmt)) -> Result<()> {
|
||||||
let mut any_succeed = false;
|
let mut any_succeed = false;
|
||||||
unsafe {
|
unsafe {
|
||||||
for raw_statement in self.raw_statements.iter() {
|
for raw_statement in self.raw_statements.iter() {
|
||||||
@ -133,7 +133,7 @@ impl<'a> Statement<'a> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn column_blob<'b>(&'b mut self, index: i32) -> Result<&'b [u8]> {
|
pub fn column_blob(&mut self, index: i32) -> Result<&[u8]> {
|
||||||
let index = index as c_int;
|
let index = index as c_int;
|
||||||
let pointer = unsafe { sqlite3_column_blob(self.current_statement(), index) };
|
let pointer = unsafe { sqlite3_column_blob(self.current_statement(), index) };
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ impl<'a> Statement<'a> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn column_text<'b>(&'b mut self, index: i32) -> Result<&'b str> {
|
pub fn column_text(&mut self, index: i32) -> Result<&str> {
|
||||||
let index = index as c_int;
|
let index = index as c_int;
|
||||||
let pointer = unsafe { sqlite3_column_text(self.current_statement(), index) };
|
let pointer = unsafe { sqlite3_column_text(self.current_statement(), index) };
|
||||||
|
|
||||||
|
@ -114,12 +114,12 @@ impl<M: Migrator> ThreadSafeConnection<M> {
|
|||||||
let mut queues = QUEUES.write();
|
let mut queues = QUEUES.write();
|
||||||
if !queues.contains_key(&self.uri) {
|
if !queues.contains_key(&self.uri) {
|
||||||
let mut write_queue_constructor =
|
let mut write_queue_constructor =
|
||||||
write_queue_constructor.unwrap_or(background_thread_queue());
|
write_queue_constructor.unwrap_or_else(background_thread_queue);
|
||||||
queues.insert(self.uri.clone(), write_queue_constructor());
|
queues.insert(self.uri.clone(), write_queue_constructor());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn builder(uri: &str, persistent: bool) -> ThreadSafeConnectionBuilder<M> {
|
pub fn builder(uri: &str, persistent: bool) -> ThreadSafeConnectionBuilder<M> {
|
||||||
@ -187,10 +187,9 @@ impl<M: Migrator> ThreadSafeConnection<M> {
|
|||||||
*connection.write.get_mut() = false;
|
*connection.write.get_mut() = false;
|
||||||
|
|
||||||
if let Some(initialize_query) = connection_initialize_query {
|
if let Some(initialize_query) = connection_initialize_query {
|
||||||
connection.exec(initialize_query).expect(&format!(
|
connection.exec(initialize_query).unwrap_or_else(|_| {
|
||||||
"Initialize query failed to execute: {}",
|
panic!("Initialize query failed to execute: {}", initialize_query)
|
||||||
initialize_query
|
})()
|
||||||
))()
|
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +224,7 @@ impl<M: Migrator> Clone for ThreadSafeConnection<M> {
|
|||||||
Self {
|
Self {
|
||||||
uri: self.uri.clone(),
|
uri: self.uri.clone(),
|
||||||
persistent: self.persistent,
|
persistent: self.persistent,
|
||||||
connection_initialize_query: self.connection_initialize_query.clone(),
|
connection_initialize_query: self.connection_initialize_query,
|
||||||
connections: self.connections.clone(),
|
connections: self.connections.clone(),
|
||||||
_migrator: PhantomData,
|
_migrator: PhantomData,
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||||||
|
|
||||||
impl Connection {
|
impl Connection {
|
||||||
pub fn exec<'a>(&'a self, query: &str) -> Result<impl 'a + FnMut() -> Result<()>> {
|
pub fn exec<'a>(&'a self, query: &str) -> Result<impl 'a + FnMut() -> Result<()>> {
|
||||||
let mut statement = Statement::prepare(&self, query)?;
|
let mut statement = Statement::prepare(self, query)?;
|
||||||
Ok(move || statement.exec())
|
Ok(move || statement.exec())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ impl Connection {
|
|||||||
&'a self,
|
&'a self,
|
||||||
query: &str,
|
query: &str,
|
||||||
) -> Result<impl 'a + FnMut(B) -> Result<()>> {
|
) -> Result<impl 'a + FnMut(B) -> Result<()>> {
|
||||||
let mut statement = Statement::prepare(&self, query)?;
|
let mut statement = Statement::prepare(self, query)?;
|
||||||
Ok(move |bindings| statement.with_bindings(bindings)?.exec())
|
Ok(move |bindings| statement.with_bindings(bindings)?.exec())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ impl Connection {
|
|||||||
&'a self,
|
&'a self,
|
||||||
query: &str,
|
query: &str,
|
||||||
) -> Result<impl 'a + FnMut() -> Result<Vec<C>>> {
|
) -> Result<impl 'a + FnMut() -> Result<Vec<C>>> {
|
||||||
let mut statement = Statement::prepare(&self, query)?;
|
let mut statement = Statement::prepare(self, query)?;
|
||||||
Ok(move || statement.rows::<C>())
|
Ok(move || statement.rows::<C>())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ impl Connection {
|
|||||||
&'a self,
|
&'a self,
|
||||||
query: &str,
|
query: &str,
|
||||||
) -> Result<impl 'a + FnMut(B) -> Result<Vec<C>>> {
|
) -> Result<impl 'a + FnMut(B) -> Result<Vec<C>>> {
|
||||||
let mut statement = Statement::prepare(&self, query)?;
|
let mut statement = Statement::prepare(self, query)?;
|
||||||
Ok(move |bindings| statement.with_bindings(bindings)?.rows::<C>())
|
Ok(move |bindings| statement.with_bindings(bindings)?.rows::<C>())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ impl Connection {
|
|||||||
&'a self,
|
&'a self,
|
||||||
query: &str,
|
query: &str,
|
||||||
) -> Result<impl 'a + FnMut() -> Result<Option<C>>> {
|
) -> Result<impl 'a + FnMut() -> Result<Option<C>>> {
|
||||||
let mut statement = Statement::prepare(&self, query)?;
|
let mut statement = Statement::prepare(self, query)?;
|
||||||
Ok(move || statement.maybe_row::<C>())
|
Ok(move || statement.maybe_row::<C>())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ impl Connection {
|
|||||||
&'a self,
|
&'a self,
|
||||||
query: &str,
|
query: &str,
|
||||||
) -> Result<impl 'a + FnMut(B) -> Result<Option<C>>> {
|
) -> Result<impl 'a + FnMut(B) -> Result<Option<C>>> {
|
||||||
let mut statement = Statement::prepare(&self, query)?;
|
let mut statement = Statement::prepare(self, query)?;
|
||||||
Ok(move |bindings| {
|
Ok(move |bindings| {
|
||||||
statement
|
statement
|
||||||
.with_bindings(bindings)
|
.with_bindings(bindings)
|
||||||
|
@ -33,14 +33,14 @@ fn create_error(
|
|||||||
.skip_while(|(offset, _)| offset <= &error_offset)
|
.skip_while(|(offset, _)| offset <= &error_offset)
|
||||||
.map(|(_, span)| span)
|
.map(|(_, span)| span)
|
||||||
.next()
|
.next()
|
||||||
.unwrap_or(Span::call_site());
|
.unwrap_or_else(Span::call_site);
|
||||||
let error_text = format!("Sql Error: {}\nFor Query: {}", error, formatted_sql);
|
let error_text = format!("Sql Error: {}\nFor Query: {}", error, formatted_sql);
|
||||||
TokenStream::from(Error::new(error_span.into(), error_text).into_compile_error())
|
TokenStream::from(Error::new(error_span.into(), error_text).into_compile_error())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_sql(tokens: TokenStream) -> (Vec<(usize, Span)>, String) {
|
fn make_sql(tokens: TokenStream) -> (Vec<(usize, Span)>, String) {
|
||||||
let mut sql_tokens = vec![];
|
let mut sql_tokens = vec![];
|
||||||
flatten_stream(tokens.clone(), &mut sql_tokens);
|
flatten_stream(tokens, &mut sql_tokens);
|
||||||
// Lookup of spans by offset at the end of the token
|
// Lookup of spans by offset at the end of the token
|
||||||
let mut spans: Vec<(usize, Span)> = Vec::new();
|
let mut spans: Vec<(usize, Span)> = Vec::new();
|
||||||
let mut sql = String::new();
|
let mut sql = String::new();
|
||||||
@ -67,7 +67,7 @@ fn flatten_stream(tokens: TokenStream, result: &mut Vec<(String, Span)>) {
|
|||||||
result.push((close_delimiter(group.delimiter()), group.span()));
|
result.push((close_delimiter(group.delimiter()), group.span()));
|
||||||
}
|
}
|
||||||
TokenTree::Ident(ident) => {
|
TokenTree::Ident(ident) => {
|
||||||
result.push((format!("{} ", ident.to_string()), ident.span()));
|
result.push((format!("{} ", ident), ident.span()));
|
||||||
}
|
}
|
||||||
leaf_tree => result.push((leaf_tree.to_string(), leaf_tree.span())),
|
leaf_tree => result.push((leaf_tree.to_string(), leaf_tree.span())),
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ impl<K: Clone + Debug + Default + Ord, V: Clone + Debug> TreeMap<K, V> {
|
|||||||
self.0.insert_or_replace(MapEntry { key, value }, &());
|
self.0.insert_or_replace(MapEntry { key, value }, &());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove<'a>(&mut self, key: &'a K) -> Option<V> {
|
pub fn remove(&mut self, key: &K) -> Option<V> {
|
||||||
let mut removed = None;
|
let mut removed = None;
|
||||||
let mut cursor = self.0.cursor::<MapKeyRef<'_, K>>();
|
let mut cursor = self.0.cursor::<MapKeyRef<'_, K>>();
|
||||||
let key = MapKeyRef(Some(key));
|
let key = MapKeyRef(Some(key));
|
||||||
|
@ -4,7 +4,7 @@ use lazy_static::lazy_static;
|
|||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref RELEASE_CHANNEL_NAME: String = env::var("ZED_RELEASE_CHANNEL")
|
pub static ref RELEASE_CHANNEL_NAME: String = env::var("ZED_RELEASE_CHANNEL")
|
||||||
.unwrap_or(include_str!("../../zed/RELEASE_CHANNEL").to_string());
|
.unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").to_string());
|
||||||
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() {
|
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() {
|
||||||
"dev" => ReleaseChannel::Dev,
|
"dev" => ReleaseChannel::Dev,
|
||||||
"preview" => ReleaseChannel::Preview,
|
"preview" => ReleaseChannel::Preview,
|
||||||
|
@ -36,7 +36,7 @@ pub fn truncate_and_trailoff(s: &str, max_chars: usize) -> String {
|
|||||||
debug_assert!(max_chars >= 5);
|
debug_assert!(max_chars >= 5);
|
||||||
|
|
||||||
if s.len() > max_chars {
|
if s.len() > max_chars {
|
||||||
format!("{}…", truncate(&s, max_chars.saturating_sub(3)))
|
format!("{}…", truncate(s, max_chars.saturating_sub(3)))
|
||||||
} else {
|
} else {
|
||||||
s.to_string()
|
s.to_string()
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,14 @@ impl LspAdapter for RubyLanguageServer {
|
|||||||
grammar.highlight_id_for_name("type")?
|
grammar.highlight_id_for_name("type")?
|
||||||
}
|
}
|
||||||
lsp::CompletionItemKind::KEYWORD => {
|
lsp::CompletionItemKind::KEYWORD => {
|
||||||
if label.starts_with(":") {
|
if label.starts_with(':') {
|
||||||
grammar.highlight_id_for_name("string.special.symbol")?
|
grammar.highlight_id_for_name("string.special.symbol")?
|
||||||
} else {
|
} else {
|
||||||
grammar.highlight_id_for_name("keyword")?
|
grammar.highlight_id_for_name("keyword")?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lsp::CompletionItemKind::VARIABLE => {
|
lsp::CompletionItemKind::VARIABLE => {
|
||||||
if label.starts_with("@") {
|
if label.starts_with('@') {
|
||||||
grammar.highlight_id_for_name("property")?
|
grammar.highlight_id_for_name("property")?
|
||||||
} else {
|
} else {
|
||||||
return None;
|
return None;
|
||||||
|
@ -101,7 +101,7 @@ fn main() {
|
|||||||
|
|
||||||
//Setup settings global before binding actions
|
//Setup settings global before binding actions
|
||||||
cx.set_global(SettingsFile::new(
|
cx.set_global(SettingsFile::new(
|
||||||
&*paths::SETTINGS,
|
&paths::SETTINGS,
|
||||||
settings_file_content.clone(),
|
settings_file_content.clone(),
|
||||||
fs.clone(),
|
fs.clone(),
|
||||||
));
|
));
|
||||||
@ -586,7 +586,7 @@ async fn handle_cli_connection(
|
|||||||
|
|
||||||
responses
|
responses
|
||||||
.send(CliResponse::Exit {
|
.send(CliResponse::Exit {
|
||||||
status: if errored { 1 } else { 0 },
|
status: i32::from(errored),
|
||||||
})
|
})
|
||||||
.log_err();
|
.log_err();
|
||||||
}
|
}
|
||||||
|
@ -338,11 +338,11 @@ pub fn initialize_workspace(
|
|||||||
},
|
},
|
||||||
"schemas": [
|
"schemas": [
|
||||||
{
|
{
|
||||||
"fileMatch": [schema_file_match(&*paths::SETTINGS)],
|
"fileMatch": [schema_file_match(&paths::SETTINGS)],
|
||||||
"schema": settings_file_json_schema(theme_names, language_names),
|
"schema": settings_file_json_schema(theme_names, language_names),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fileMatch": [schema_file_match(&*paths::KEYMAP)],
|
"fileMatch": [schema_file_match(&paths::KEYMAP)],
|
||||||
"schema": keymap_file_json_schema(&action_names),
|
"schema": keymap_file_json_schema(&action_names),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -646,7 +646,7 @@ fn open_bundled_config_file(
|
|||||||
cx: &mut ViewContext<Workspace>,
|
cx: &mut ViewContext<Workspace>,
|
||||||
) {
|
) {
|
||||||
workspace
|
workspace
|
||||||
.with_local_workspace(&app_state.clone(), cx, |workspace, cx| {
|
.with_local_workspace(&app_state, cx, |workspace, cx| {
|
||||||
let project = workspace.project().clone();
|
let project = workspace.project().clone();
|
||||||
let buffer = project.update(cx, |project, cx| {
|
let buffer = project.update(cx, |project, cx| {
|
||||||
let text = Assets::get(asset_path).unwrap().data;
|
let text = Assets::get(asset_path).unwrap().data;
|
||||||
|
Loading…
Reference in New Issue
Block a user