Checkpoint

This commit is contained in:
Antonio Scandurra 2023-10-23 10:59:29 +02:00
parent a0b667a2ca
commit 56462ef793
23 changed files with 4833 additions and 2536 deletions

53
Cargo.lock generated
View File

@ -3129,6 +3129,14 @@ dependencies = [
"util",
]
[[package]]
name = "fuzzy2"
version = "0.1.0"
dependencies = [
"gpui2",
"util",
]
[[package]]
name = "fxhash"
version = "0.2.1"
@ -4174,14 +4182,14 @@ dependencies = [
"env_logger 0.9.3",
"fs",
"futures 0.3.28",
"fuzzy",
"fuzzy2",
"git",
"globset",
"gpui2",
"indoc",
"lazy_static",
"log",
"lsp",
"lsp2",
"parking_lot 0.11.2",
"postage",
"rand 0.8.5",
@ -4198,6 +4206,7 @@ dependencies = [
"smol",
"sum_tree",
"text",
"theme2",
"tree-sitter",
"tree-sitter-elixir",
"tree-sitter-embedded-template",
@ -4492,6 +4501,29 @@ dependencies = [
"url",
]
[[package]]
name = "lsp2"
version = "0.1.0"
dependencies = [
"anyhow",
"async-pipe",
"collections",
"ctor",
"env_logger 0.9.3",
"futures 0.3.28",
"gpui2",
"log",
"lsp-types",
"parking_lot 0.11.2",
"postage",
"serde",
"serde_derive",
"serde_json",
"smol",
"unindent",
"util",
]
[[package]]
name = "mach"
version = "0.3.2"
@ -8343,6 +8375,23 @@ dependencies = [
"util",
]
[[package]]
name = "theme2"
version = "0.1.0"
dependencies = [
"anyhow",
"fs",
"gpui2",
"indexmap 1.9.3",
"parking_lot 0.11.2",
"serde",
"serde_derive",
"serde_json",
"settings2",
"toml 0.5.11",
"util",
]
[[package]]
name = "theme_selector"
version = "0.1.0"

View File

@ -34,6 +34,7 @@ members = [
"crates/fs",
"crates/fsevent",
"crates/fuzzy",
"crates/fuzzy2",
"crates/git",
"crates/go_to_line",
"crates/gpui",
@ -49,6 +50,7 @@ members = [
"crates/live_kit_client",
"crates/live_kit_server",
"crates/lsp",
"crates/lsp2",
"crates/media",
"crates/menu",
"crates/node_runtime",
@ -76,6 +78,7 @@ members = [
"crates/terminal",
"crates/text",
"crates/theme",
"crates/theme2",
"crates/theme_selector",
"crates/ui2",
"crates/util",

13
crates/fuzzy2/Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[package]
name = "fuzzy2"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
path = "src/fuzzy2.rs"
doctest = false
[dependencies]
gpui2 = { path = "../gpui2" }
util = { path = "../util" }

View File

@ -0,0 +1,63 @@
use std::iter::FromIterator;
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct CharBag(u64);
impl CharBag {
pub fn is_superset(self, other: CharBag) -> bool {
self.0 & other.0 == other.0
}
fn insert(&mut self, c: char) {
let c = c.to_ascii_lowercase();
if ('a'..='z').contains(&c) {
let mut count = self.0;
let idx = c as u8 - b'a';
count >>= idx * 2;
count = ((count << 1) | 1) & 3;
count <<= idx * 2;
self.0 |= count;
} else if ('0'..='9').contains(&c) {
let idx = c as u8 - b'0';
self.0 |= 1 << (idx + 52);
} else if c == '-' {
self.0 |= 1 << 62;
}
}
}
impl Extend<char> for CharBag {
fn extend<T: IntoIterator<Item = char>>(&mut self, iter: T) {
for c in iter {
self.insert(c);
}
}
}
impl FromIterator<char> for CharBag {
fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self {
let mut result = Self::default();
result.extend(iter);
result
}
}
impl From<&str> for CharBag {
fn from(s: &str) -> Self {
let mut bag = Self(0);
for c in s.chars() {
bag.insert(c);
}
bag
}
}
impl From<&[char]> for CharBag {
fn from(chars: &[char]) -> Self {
let mut bag = Self(0);
for c in chars {
bag.insert(*c);
}
bag
}
}

View File

@ -0,0 +1,10 @@
mod char_bag;
mod matcher;
mod paths;
mod strings;
pub use char_bag::CharBag;
pub use paths::{
match_fixed_path_set, match_path_sets, PathMatch, PathMatchCandidate, PathMatchCandidateSet,
};
pub use strings::{match_strings, StringMatch, StringMatchCandidate};

View File

@ -0,0 +1,464 @@
use std::{
borrow::Cow,
sync::atomic::{self, AtomicBool},
};
use crate::CharBag;
const BASE_DISTANCE_PENALTY: f64 = 0.6;
const ADDITIONAL_DISTANCE_PENALTY: f64 = 0.05;
const MIN_DISTANCE_PENALTY: f64 = 0.2;
pub struct Matcher<'a> {
query: &'a [char],
lowercase_query: &'a [char],
query_char_bag: CharBag,
smart_case: bool,
max_results: usize,
min_score: f64,
match_positions: Vec<usize>,
last_positions: Vec<usize>,
score_matrix: Vec<Option<f64>>,
best_position_matrix: Vec<usize>,
}
pub trait Match: Ord {
fn score(&self) -> f64;
fn set_positions(&mut self, positions: Vec<usize>);
}
pub trait MatchCandidate {
fn has_chars(&self, bag: CharBag) -> bool;
fn to_string(&self) -> Cow<'_, str>;
}
impl<'a> Matcher<'a> {
pub fn new(
query: &'a [char],
lowercase_query: &'a [char],
query_char_bag: CharBag,
smart_case: bool,
max_results: usize,
) -> Self {
Self {
query,
lowercase_query,
query_char_bag,
min_score: 0.0,
last_positions: vec![0; query.len()],
match_positions: vec![0; query.len()],
score_matrix: Vec::new(),
best_position_matrix: Vec::new(),
smart_case,
max_results,
}
}
pub fn match_candidates<C: MatchCandidate, R, F>(
&mut self,
prefix: &[char],
lowercase_prefix: &[char],
candidates: impl Iterator<Item = C>,
results: &mut Vec<R>,
cancel_flag: &AtomicBool,
build_match: F,
) where
R: Match,
F: Fn(&C, f64) -> R,
{
let mut candidate_chars = Vec::new();
let mut lowercase_candidate_chars = Vec::new();
for candidate in candidates {
if !candidate.has_chars(self.query_char_bag) {
continue;
}
if cancel_flag.load(atomic::Ordering::Relaxed) {
break;
}
candidate_chars.clear();
lowercase_candidate_chars.clear();
for c in candidate.to_string().chars() {
candidate_chars.push(c);
lowercase_candidate_chars.push(c.to_ascii_lowercase());
}
if !self.find_last_positions(lowercase_prefix, &lowercase_candidate_chars) {
continue;
}
let matrix_len = self.query.len() * (prefix.len() + candidate_chars.len());
self.score_matrix.clear();
self.score_matrix.resize(matrix_len, None);
self.best_position_matrix.clear();
self.best_position_matrix.resize(matrix_len, 0);
let score = self.score_match(
&candidate_chars,
&lowercase_candidate_chars,
prefix,
lowercase_prefix,
);
if score > 0.0 {
let mut mat = build_match(&candidate, score);
if let Err(i) = results.binary_search_by(|m| mat.cmp(m)) {
if results.len() < self.max_results {
mat.set_positions(self.match_positions.clone());
results.insert(i, mat);
} else if i < results.len() {
results.pop();
mat.set_positions(self.match_positions.clone());
results.insert(i, mat);
}
if results.len() == self.max_results {
self.min_score = results.last().unwrap().score();
}
}
}
}
}
fn find_last_positions(
&mut self,
lowercase_prefix: &[char],
lowercase_candidate: &[char],
) -> bool {
let mut lowercase_prefix = lowercase_prefix.iter();
let mut lowercase_candidate = lowercase_candidate.iter();
for (i, char) in self.lowercase_query.iter().enumerate().rev() {
if let Some(j) = lowercase_candidate.rposition(|c| c == char) {
self.last_positions[i] = j + lowercase_prefix.len();
} else if let Some(j) = lowercase_prefix.rposition(|c| c == char) {
self.last_positions[i] = j;
} else {
return false;
}
}
true
}
fn score_match(
&mut self,
path: &[char],
path_cased: &[char],
prefix: &[char],
lowercase_prefix: &[char],
) -> f64 {
let score = self.recursive_score_match(
path,
path_cased,
prefix,
lowercase_prefix,
0,
0,
self.query.len() as f64,
) * self.query.len() as f64;
if score <= 0.0 {
return 0.0;
}
let path_len = prefix.len() + path.len();
let mut cur_start = 0;
let mut byte_ix = 0;
let mut char_ix = 0;
for i in 0..self.query.len() {
let match_char_ix = self.best_position_matrix[i * path_len + cur_start];
while char_ix < match_char_ix {
let ch = prefix
.get(char_ix)
.or_else(|| path.get(char_ix - prefix.len()))
.unwrap();
byte_ix += ch.len_utf8();
char_ix += 1;
}
cur_start = match_char_ix + 1;
self.match_positions[i] = byte_ix;
}
score
}
#[allow(clippy::too_many_arguments)]
fn recursive_score_match(
&mut self,
path: &[char],
path_cased: &[char],
prefix: &[char],
lowercase_prefix: &[char],
query_idx: usize,
path_idx: usize,
cur_score: f64,
) -> f64 {
if query_idx == self.query.len() {
return 1.0;
}
let path_len = prefix.len() + path.len();
if let Some(memoized) = self.score_matrix[query_idx * path_len + path_idx] {
return memoized;
}
let mut score = 0.0;
let mut best_position = 0;
let query_char = self.lowercase_query[query_idx];
let limit = self.last_positions[query_idx];
let mut last_slash = 0;
for j in path_idx..=limit {
let path_char = if j < prefix.len() {
lowercase_prefix[j]
} else {
path_cased[j - prefix.len()]
};
let is_path_sep = path_char == '/' || path_char == '\\';
if query_idx == 0 && is_path_sep {
last_slash = j;
}
if query_char == path_char || (is_path_sep && query_char == '_' || query_char == '\\') {
let curr = if j < prefix.len() {
prefix[j]
} else {
path[j - prefix.len()]
};
let mut char_score = 1.0;
if j > path_idx {
let last = if j - 1 < prefix.len() {
prefix[j - 1]
} else {
path[j - 1 - prefix.len()]
};
if last == '/' {
char_score = 0.9;
} else if (last == '-' || last == '_' || last == ' ' || last.is_numeric())
|| (last.is_lowercase() && curr.is_uppercase())
{
char_score = 0.8;
} else if last == '.' {
char_score = 0.7;
} else if query_idx == 0 {
char_score = BASE_DISTANCE_PENALTY;
} else {
char_score = MIN_DISTANCE_PENALTY.max(
BASE_DISTANCE_PENALTY
- (j - path_idx - 1) as f64 * ADDITIONAL_DISTANCE_PENALTY,
);
}
}
// Apply a severe penalty if the case doesn't match.
// This will make the exact matches have higher score than the case-insensitive and the
// path insensitive matches.
if (self.smart_case || curr == '/') && self.query[query_idx] != curr {
char_score *= 0.001;
}
let mut multiplier = char_score;
// Scale the score based on how deep within the path we found the match.
if query_idx == 0 {
multiplier /= ((prefix.len() + path.len()) - last_slash) as f64;
}
let mut next_score = 1.0;
if self.min_score > 0.0 {
next_score = cur_score * multiplier;
// Scores only decrease. If we can't pass the previous best, bail
if next_score < self.min_score {
// Ensure that score is non-zero so we use it in the memo table.
if score == 0.0 {
score = 1e-18;
}
continue;
}
}
let new_score = self.recursive_score_match(
path,
path_cased,
prefix,
lowercase_prefix,
query_idx + 1,
j + 1,
next_score,
) * multiplier;
if new_score > score {
score = new_score;
best_position = j;
// Optimization: can't score better than 1.
if new_score == 1.0 {
break;
}
}
}
}
if best_position != 0 {
self.best_position_matrix[query_idx * path_len + path_idx] = best_position;
}
self.score_matrix[query_idx * path_len + path_idx] = Some(score);
score
}
}
#[cfg(test)]
mod tests {
use crate::{PathMatch, PathMatchCandidate};
use super::*;
use std::{
path::{Path, PathBuf},
sync::Arc,
};
#[test]
fn test_get_last_positions() {
let mut query: &[char] = &['d', 'c'];
let mut matcher = Matcher::new(query, query, query.into(), false, 10);
let result = matcher.find_last_positions(&['a', 'b', 'c'], &['b', 'd', 'e', 'f']);
assert!(!result);
query = &['c', 'd'];
let mut matcher = Matcher::new(query, query, query.into(), false, 10);
let result = matcher.find_last_positions(&['a', 'b', 'c'], &['b', 'd', 'e', 'f']);
assert!(result);
assert_eq!(matcher.last_positions, vec![2, 4]);
query = &['z', '/', 'z', 'f'];
let mut matcher = Matcher::new(query, query, query.into(), false, 10);
let result = matcher.find_last_positions(&['z', 'e', 'd', '/'], &['z', 'e', 'd', '/', 'f']);
assert!(result);
assert_eq!(matcher.last_positions, vec![0, 3, 4, 8]);
}
#[test]
fn test_match_path_entries() {
let paths = vec![
"",
"a",
"ab",
"abC",
"abcd",
"alphabravocharlie",
"AlphaBravoCharlie",
"thisisatestdir",
"/////ThisIsATestDir",
"/this/is/a/test/dir",
"/test/tiatd",
];
assert_eq!(
match_single_path_query("abc", false, &paths),
vec![
("abC", vec![0, 1, 2]),
("abcd", vec![0, 1, 2]),
("AlphaBravoCharlie", vec![0, 5, 10]),
("alphabravocharlie", vec![4, 5, 10]),
]
);
assert_eq!(
match_single_path_query("t/i/a/t/d", false, &paths),
vec![("/this/is/a/test/dir", vec![1, 5, 6, 8, 9, 10, 11, 15, 16]),]
);
assert_eq!(
match_single_path_query("tiatd", false, &paths),
vec![
("/test/tiatd", vec![6, 7, 8, 9, 10]),
("/this/is/a/test/dir", vec![1, 6, 9, 11, 16]),
("/////ThisIsATestDir", vec![5, 9, 11, 12, 16]),
("thisisatestdir", vec![0, 2, 6, 7, 11]),
]
);
}
#[test]
fn test_match_multibyte_path_entries() {
let paths = vec!["aαbβ/cγ", "αβγδ/bcde", "c1⃣2⃣3⃣/d4⃣5⃣6⃣/e7⃣8⃣9⃣/f", "/d/🆒/h"];
assert_eq!("1".len(), 7);
assert_eq!(
match_single_path_query("bcd", false, &paths),
vec![
("αβγδ/bcde", vec![9, 10, 11]),
("aαbβ/cγ", vec![3, 7, 10]),
]
);
assert_eq!(
match_single_path_query("cde", false, &paths),
vec![
("αβγδ/bcde", vec![10, 11, 12]),
("c1⃣2⃣3⃣/d4⃣5⃣6⃣/e7⃣8⃣9⃣/f", vec![0, 23, 46]),
]
);
}
fn match_single_path_query<'a>(
query: &str,
smart_case: bool,
paths: &[&'a str],
) -> Vec<(&'a str, Vec<usize>)> {
let lowercase_query = query.to_lowercase().chars().collect::<Vec<_>>();
let query = query.chars().collect::<Vec<_>>();
let query_chars = CharBag::from(&lowercase_query[..]);
let path_arcs: Vec<Arc<Path>> = paths
.iter()
.map(|path| Arc::from(PathBuf::from(path)))
.collect::<Vec<_>>();
let mut path_entries = Vec::new();
for (i, path) in paths.iter().enumerate() {
let lowercase_path = path.to_lowercase().chars().collect::<Vec<_>>();
let char_bag = CharBag::from(lowercase_path.as_slice());
path_entries.push(PathMatchCandidate {
char_bag,
path: &path_arcs[i],
});
}
let mut matcher = Matcher::new(&query, &lowercase_query, query_chars, smart_case, 100);
let cancel_flag = AtomicBool::new(false);
let mut results = Vec::new();
matcher.match_candidates(
&[],
&[],
path_entries.into_iter(),
&mut results,
&cancel_flag,
|candidate, score| PathMatch {
score,
worktree_id: 0,
positions: Vec::new(),
path: Arc::from(candidate.path),
path_prefix: "".into(),
distance_to_relative_ancestor: usize::MAX,
},
);
results
.into_iter()
.map(|result| {
(
paths
.iter()
.copied()
.find(|p| result.path.as_ref() == Path::new(p))
.unwrap(),
result.positions,
)
})
.collect()
}
}

257
crates/fuzzy2/src/paths.rs Normal file
View File

@ -0,0 +1,257 @@
use gpui2::Executor;
use std::{
borrow::Cow,
cmp::{self, Ordering},
path::Path,
sync::{atomic::AtomicBool, Arc},
};
use crate::{
matcher::{Match, MatchCandidate, Matcher},
CharBag,
};
#[derive(Clone, Debug)]
pub struct PathMatchCandidate<'a> {
pub path: &'a Path,
pub char_bag: CharBag,
}
#[derive(Clone, Debug)]
pub struct PathMatch {
pub score: f64,
pub positions: Vec<usize>,
pub worktree_id: usize,
pub path: Arc<Path>,
pub path_prefix: Arc<str>,
/// Number of steps removed from a shared parent with the relative path
/// Used to order closer paths first in the search list
pub distance_to_relative_ancestor: usize,
}
pub trait PathMatchCandidateSet<'a>: Send + Sync {
type Candidates: Iterator<Item = PathMatchCandidate<'a>>;
fn id(&self) -> usize;
fn len(&self) -> usize;
fn is_empty(&self) -> bool {
self.len() == 0
}
fn prefix(&self) -> Arc<str>;
fn candidates(&'a self, start: usize) -> Self::Candidates;
}
impl Match for PathMatch {
fn score(&self) -> f64 {
self.score
}
fn set_positions(&mut self, positions: Vec<usize>) {
self.positions = positions;
}
}
impl<'a> MatchCandidate for PathMatchCandidate<'a> {
fn has_chars(&self, bag: CharBag) -> bool {
self.char_bag.is_superset(bag)
}
fn to_string(&self) -> Cow<'a, str> {
self.path.to_string_lossy()
}
}
impl PartialEq for PathMatch {
fn eq(&self, other: &Self) -> bool {
self.cmp(other).is_eq()
}
}
impl Eq for PathMatch {}
impl PartialOrd for PathMatch {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for PathMatch {
fn cmp(&self, other: &Self) -> Ordering {
self.score
.partial_cmp(&other.score)
.unwrap_or(Ordering::Equal)
.then_with(|| self.worktree_id.cmp(&other.worktree_id))
.then_with(|| {
other
.distance_to_relative_ancestor
.cmp(&self.distance_to_relative_ancestor)
})
.then_with(|| self.path.cmp(&other.path))
}
}
pub fn match_fixed_path_set(
candidates: Vec<PathMatchCandidate>,
worktree_id: usize,
query: &str,
smart_case: bool,
max_results: usize,
) -> Vec<PathMatch> {
let lowercase_query = query.to_lowercase().chars().collect::<Vec<_>>();
let query = query.chars().collect::<Vec<_>>();
let query_char_bag = CharBag::from(&lowercase_query[..]);
let mut matcher = Matcher::new(
&query,
&lowercase_query,
query_char_bag,
smart_case,
max_results,
);
let mut results = Vec::new();
matcher.match_candidates(
&[],
&[],
candidates.into_iter(),
&mut results,
&AtomicBool::new(false),
|candidate, score| PathMatch {
score,
worktree_id,
positions: Vec::new(),
path: Arc::from(candidate.path),
path_prefix: Arc::from(""),
distance_to_relative_ancestor: usize::MAX,
},
);
results
}
pub async fn match_path_sets<'a, Set: PathMatchCandidateSet<'a>>(
candidate_sets: &'a [Set],
query: &str,
relative_to: Option<Arc<Path>>,
smart_case: bool,
max_results: usize,
cancel_flag: &AtomicBool,
executor: Executor,
) -> Vec<PathMatch> {
let path_count: usize = candidate_sets.iter().map(|s| s.len()).sum();
if path_count == 0 {
return Vec::new();
}
let lowercase_query = query.to_lowercase().chars().collect::<Vec<_>>();
let query = query.chars().collect::<Vec<_>>();
let lowercase_query = &lowercase_query;
let query = &query;
let query_char_bag = CharBag::from(&lowercase_query[..]);
let num_cpus = executor.num_cpus().min(path_count);
let segment_size = (path_count + num_cpus - 1) / num_cpus;
let mut segment_results = (0..num_cpus)
.map(|_| Vec::with_capacity(max_results))
.collect::<Vec<_>>();
executor
.scoped(|scope| {
for (segment_idx, results) in segment_results.iter_mut().enumerate() {
let relative_to = relative_to.clone();
scope.spawn(async move {
let segment_start = segment_idx * segment_size;
let segment_end = segment_start + segment_size;
let mut matcher = Matcher::new(
query,
lowercase_query,
query_char_bag,
smart_case,
max_results,
);
let mut tree_start = 0;
for candidate_set in candidate_sets {
let tree_end = tree_start + candidate_set.len();
if tree_start < segment_end && segment_start < tree_end {
let start = cmp::max(tree_start, segment_start) - tree_start;
let end = cmp::min(tree_end, segment_end) - tree_start;
let candidates = candidate_set.candidates(start).take(end - start);
let worktree_id = candidate_set.id();
let prefix = candidate_set.prefix().chars().collect::<Vec<_>>();
let lowercase_prefix = prefix
.iter()
.map(|c| c.to_ascii_lowercase())
.collect::<Vec<_>>();
matcher.match_candidates(
&prefix,
&lowercase_prefix,
candidates,
results,
cancel_flag,
|candidate, score| PathMatch {
score,
worktree_id,
positions: Vec::new(),
path: Arc::from(candidate.path),
path_prefix: candidate_set.prefix(),
distance_to_relative_ancestor: relative_to.as_ref().map_or(
usize::MAX,
|relative_to| {
distance_between_paths(
candidate.path.as_ref(),
relative_to.as_ref(),
)
},
),
},
);
}
if tree_end >= segment_end {
break;
}
tree_start = tree_end;
}
})
}
})
.await;
let mut results = Vec::new();
for segment_result in segment_results {
if results.is_empty() {
results = segment_result;
} else {
util::extend_sorted(&mut results, segment_result, max_results, |a, b| b.cmp(a));
}
}
results
}
/// Compute the distance from a given path to some other path
/// If there is no shared path, returns usize::MAX
fn distance_between_paths(path: &Path, relative_to: &Path) -> usize {
let mut path_components = path.components();
let mut relative_components = relative_to.components();
while path_components
.next()
.zip(relative_components.next())
.map(|(path_component, relative_component)| path_component == relative_component)
.unwrap_or_default()
{}
path_components.count() + relative_components.count() + 1
}
#[cfg(test)]
mod tests {
use std::path::Path;
use super::distance_between_paths;
#[test]
fn test_distance_between_paths_empty() {
distance_between_paths(Path::new(""), Path::new(""));
}
}

View File

@ -0,0 +1,159 @@
use crate::{
matcher::{Match, MatchCandidate, Matcher},
CharBag,
};
use gpui2::Executor;
use std::{
borrow::Cow,
cmp::{self, Ordering},
sync::atomic::AtomicBool,
};
#[derive(Clone, Debug)]
pub struct StringMatchCandidate {
pub id: usize,
pub string: String,
pub char_bag: CharBag,
}
impl Match for StringMatch {
fn score(&self) -> f64 {
self.score
}
fn set_positions(&mut self, positions: Vec<usize>) {
self.positions = positions;
}
}
impl StringMatchCandidate {
pub fn new(id: usize, string: String) -> Self {
Self {
id,
char_bag: CharBag::from(string.as_str()),
string,
}
}
}
impl<'a> MatchCandidate for &'a StringMatchCandidate {
fn has_chars(&self, bag: CharBag) -> bool {
self.char_bag.is_superset(bag)
}
fn to_string(&self) -> Cow<'a, str> {
self.string.as_str().into()
}
}
#[derive(Clone, Debug)]
pub struct StringMatch {
pub candidate_id: usize,
pub score: f64,
pub positions: Vec<usize>,
pub string: String,
}
impl PartialEq for StringMatch {
fn eq(&self, other: &Self) -> bool {
self.cmp(other).is_eq()
}
}
impl Eq for StringMatch {}
impl PartialOrd for StringMatch {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for StringMatch {
fn cmp(&self, other: &Self) -> Ordering {
self.score
.partial_cmp(&other.score)
.unwrap_or(Ordering::Equal)
.then_with(|| self.candidate_id.cmp(&other.candidate_id))
}
}
pub async fn match_strings(
candidates: &[StringMatchCandidate],
query: &str,
smart_case: bool,
max_results: usize,
cancel_flag: &AtomicBool,
executor: Executor,
) -> Vec<StringMatch> {
if candidates.is_empty() || max_results == 0 {
return Default::default();
}
if query.is_empty() {
return candidates
.iter()
.map(|candidate| StringMatch {
candidate_id: candidate.id,
score: 0.,
positions: Default::default(),
string: candidate.string.clone(),
})
.collect();
}
let lowercase_query = query.to_lowercase().chars().collect::<Vec<_>>();
let query = query.chars().collect::<Vec<_>>();
let lowercase_query = &lowercase_query;
let query = &query;
let query_char_bag = CharBag::from(&lowercase_query[..]);
let num_cpus = executor.num_cpus().min(candidates.len());
let segment_size = (candidates.len() + num_cpus - 1) / num_cpus;
let mut segment_results = (0..num_cpus)
.map(|_| Vec::with_capacity(max_results.min(candidates.len())))
.collect::<Vec<_>>();
executor
.scoped(|scope| {
for (segment_idx, results) in segment_results.iter_mut().enumerate() {
let cancel_flag = &cancel_flag;
scope.spawn(async move {
let segment_start = cmp::min(segment_idx * segment_size, candidates.len());
let segment_end = cmp::min(segment_start + segment_size, candidates.len());
let mut matcher = Matcher::new(
query,
lowercase_query,
query_char_bag,
smart_case,
max_results,
);
matcher.match_candidates(
&[],
&[],
candidates[segment_start..segment_end].iter(),
results,
cancel_flag,
|candidate, score| StringMatch {
candidate_id: candidate.id,
score,
positions: Vec::new(),
string: candidate.string.to_string(),
},
);
});
}
})
.await;
let mut results = Vec::new();
for segment_result in segment_results {
if results.is_empty() {
results = segment_result;
} else {
util::extend_sorted(&mut results, segment_result, max_results, |a, b| b.cmp(a));
}
}
results
}

View File

@ -202,6 +202,20 @@ impl Executor {
Task::Spawned(task)
}
#[cfg(any(test, feature = "test-support"))]
pub fn start_waiting(&self) {
todo!("start_waiting")
}
#[cfg(any(test, feature = "test-support"))]
pub async fn simulate_random_delay(&self) {
todo!("simulate_random_delay")
}
pub fn num_cpus(&self) -> usize {
num_cpus::get()
}
pub fn is_main_thread(&self) -> bool {
self.dispatcher.is_main_thread()
}

View File

@ -13,7 +13,7 @@ test-support = [
"rand",
"client2/test-support",
"collections/test-support",
"lsp/test-support",
"lsp2/test-support",
"text/test-support",
"tree-sitter-rust",
"tree-sitter-typescript",
@ -24,16 +24,16 @@ test-support = [
[dependencies]
clock = { path = "../clock" }
collections = { path = "../collections" }
fuzzy = { path = "../fuzzy" }
fuzzy2 = { path = "../fuzzy2" }
fs = { path = "../fs" }
git = { path = "../git" }
gpui2 = { path = "../gpui2" }
lsp = { path = "../lsp" }
lsp2 = { path = "../lsp2" }
rpc = { path = "../rpc" }
settings2 = { path = "../settings2" }
sum_tree = { path = "../sum_tree" }
text = { path = "../text" }
# theme = { path = "../theme" }
theme2 = { path = "../theme2" }
util = { path = "../util" }
anyhow.workspace = true
@ -64,7 +64,7 @@ tree-sitter-typescript = { workspace = true, optional = true }
client2 = { path = "../client2", features = ["test-support"] }
collections = { path = "../collections", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] }
lsp = { path = "../lsp", features = ["test-support"] }
lsp2 = { path = "../lsp2", features = ["test-support"] }
text = { path = "../text", features = ["test-support"] }
settings = { path = "../settings", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] }

View File

@ -17,7 +17,7 @@ use anyhow::{anyhow, Result};
pub use clock::ReplicaId;
use futures::FutureExt as _;
use gpui2::{AppContext, EventEmitter, HighlightStyle, ModelContext, Task};
use lsp::LanguageServerId;
use lsp2::LanguageServerId;
use parking_lot::Mutex;
use similar::{ChangeTag, TextDiff};
use smallvec::SmallVec;
@ -40,6 +40,7 @@ use std::{
use sum_tree::TreeMap;
use text::operation_queue::OperationQueue;
pub use text::{Buffer as TextBuffer, BufferSnapshot as TextBufferSnapshot, *};
use theme2::SyntaxTheme;
#[cfg(any(test, feature = "test-support"))]
use util::RandomCharIter;
use util::{RangeExt, TryFutureExt as _};
@ -47,7 +48,7 @@ use util::{RangeExt, TryFutureExt as _};
#[cfg(any(test, feature = "test-support"))]
pub use {tree_sitter_rust, tree_sitter_typescript};
pub use lsp::DiagnosticSeverity;
pub use lsp2::DiagnosticSeverity;
pub struct Buffer {
text: TextBuffer,
@ -148,14 +149,14 @@ pub struct Completion {
pub new_text: String,
pub label: CodeLabel,
pub server_id: LanguageServerId,
pub lsp_completion: lsp::CompletionItem,
pub lsp_completion: lsp2::CompletionItem,
}
#[derive(Clone, Debug)]
pub struct CodeAction {
pub server_id: LanguageServerId,
pub range: Range<Anchor>,
pub lsp_action: lsp::CodeAction,
pub lsp_action: lsp2::CodeAction,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@ -3000,14 +3001,14 @@ impl IndentSize {
impl Completion {
pub fn sort_key(&self) -> (usize, &str) {
let kind_key = match self.lsp_completion.kind {
Some(lsp::CompletionItemKind::VARIABLE) => 0,
Some(lsp2::CompletionItemKind::VARIABLE) => 0,
_ => 1,
};
(kind_key, &self.label.text[self.label.filter_range.clone()])
}
pub fn is_snippet(&self) -> bool {
self.lsp_completion.insert_text_format == Some(lsp::InsertTextFormat::SNIPPET)
self.lsp_completion.insert_text_format == Some(lsp2::InsertTextFormat::SNIPPET)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
use crate::Diagnostic;
use collections::HashMap;
use lsp::LanguageServerId;
use lsp2::LanguageServerId;
use std::{
cmp::{Ordering, Reverse},
iter,
@ -37,14 +37,14 @@ pub struct Summary {
impl<T> DiagnosticEntry<T> {
// Used to provide diagnostic context to lsp codeAction request
pub fn to_lsp_diagnostic_stub(&self) -> lsp::Diagnostic {
pub fn to_lsp_diagnostic_stub(&self) -> lsp2::Diagnostic {
let code = self
.diagnostic
.code
.clone()
.map(lsp::NumberOrString::String);
.map(lsp2::NumberOrString::String);
lsp::Diagnostic {
lsp2::Diagnostic {
code,
severity: Some(self.diagnostic.severity),
..Default::default()

View File

@ -1,6 +1,6 @@
use gpui2::HighlightStyle;
use std::sync::Arc;
use theme::SyntaxTheme;
use theme2::SyntaxTheme;
#[derive(Clone, Debug)]
pub struct HighlightMap(Arc<[HighlightId]>);
@ -76,36 +76,36 @@ impl Default for HighlightId {
}
}
#[cfg(test)]
mod tests {
use super::*;
use gpui::color::Color;
// #[cfg(test)]
// mod tests {
// use super::*;
// use gpui2::color::Color;
#[test]
fn test_highlight_map() {
let theme = SyntaxTheme::new(
[
("function", Color::from_u32(0x100000ff)),
("function.method", Color::from_u32(0x200000ff)),
("function.async", Color::from_u32(0x300000ff)),
("variable.builtin.self.rust", Color::from_u32(0x400000ff)),
("variable.builtin", Color::from_u32(0x500000ff)),
("variable", Color::from_u32(0x600000ff)),
]
.iter()
.map(|(name, color)| (name.to_string(), (*color).into()))
.collect(),
);
// #[test]
// fn test_highlight_map() {
// let theme = SyntaxTheme::new(
// [
// ("function", Color::from_u32(0x100000ff)),
// ("function.method", Color::from_u32(0x200000ff)),
// ("function.async", Color::from_u32(0x300000ff)),
// ("variable.builtin.self.rust", Color::from_u32(0x400000ff)),
// ("variable.builtin", Color::from_u32(0x500000ff)),
// ("variable", Color::from_u32(0x600000ff)),
// ]
// .iter()
// .map(|(name, color)| (name.to_string(), (*color).into()))
// .collect(),
// );
let capture_names = &[
"function.special".to_string(),
"function.async.rust".to_string(),
"variable.builtin.self".to_string(),
];
// let capture_names = &[
// "function.special".to_string(),
// "function.async.rust".to_string(),
// "variable.builtin.self".to_string(),
// ];
let map = HighlightMap::new(capture_names, &theme);
assert_eq!(map.get(0).name(&theme), Some("function"));
assert_eq!(map.get(1).name(&theme), Some("function.async"));
assert_eq!(map.get(2).name(&theme), Some("variable.builtin"));
}
}
// let map = HighlightMap::new(capture_names, &theme);
// assert_eq!(map.get(0).name(&theme), Some("function"));
// assert_eq!(map.get(1).name(&theme), Some("function.async"));
// assert_eq!(map.get(2).name(&theme), Some("variable.builtin"));
// }
// }

View File

@ -20,7 +20,7 @@ use futures::{
use gpui2::{AppContext, AsyncAppContext, Executor, Task};
pub use highlight_map::HighlightMap;
use lazy_static::lazy_static;
use lsp::{CodeActionKind, LanguageServerBinary};
use lsp2::{CodeActionKind, LanguageServerBinary};
use parking_lot::{Mutex, RwLock};
use postage::watch;
use regex::Regex;
@ -42,7 +42,7 @@ use std::{
},
};
use syntax_map::SyntaxSnapshot;
use theme::{SyntaxTheme, Theme};
use theme2::{SyntaxTheme, Theme};
use tree_sitter::{self, Query};
use unicase::UniCase;
use util::{http::HttpClient, paths::PathExt};
@ -51,7 +51,7 @@ use util::{post_inc, ResultExt, TryFutureExt as _, UnwrapFuture};
pub use buffer::Operation;
pub use buffer::*;
pub use diagnostic_set::DiagnosticEntry;
pub use lsp::LanguageServerId;
pub use lsp2::LanguageServerId;
pub use outline::{Outline, OutlineItem};
pub use syntax_map::{OwnedSyntaxLayerInfo, SyntaxLayerInfo};
pub use text::LineEnding;
@ -98,7 +98,7 @@ lazy_static! {
}
pub trait ToLspPosition {
fn to_lsp_position(self) -> lsp::Position;
fn to_lsp_position(self) -> lsp2::Position;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
@ -201,17 +201,17 @@ impl CachedLspAdapter {
self.adapter.workspace_configuration(cx)
}
pub fn process_diagnostics(&self, params: &mut lsp::PublishDiagnosticsParams) {
pub fn process_diagnostics(&self, params: &mut lsp2::PublishDiagnosticsParams) {
self.adapter.process_diagnostics(params)
}
pub async fn process_completion(&self, completion_item: &mut lsp::CompletionItem) {
pub async fn process_completion(&self, completion_item: &mut lsp2::CompletionItem) {
self.adapter.process_completion(completion_item).await
}
pub async fn label_for_completion(
&self,
completion_item: &lsp::CompletionItem,
completion_item: &lsp2::CompletionItem,
language: &Arc<Language>,
) -> Option<CodeLabel> {
self.adapter
@ -222,7 +222,7 @@ impl CachedLspAdapter {
pub async fn label_for_symbol(
&self,
name: &str,
kind: lsp::SymbolKind,
kind: lsp2::SymbolKind,
language: &Arc<Language>,
) -> Option<CodeLabel> {
self.adapter.label_for_symbol(name, kind, language).await
@ -287,13 +287,13 @@ pub trait LspAdapter: 'static + Send + Sync {
container_dir: PathBuf,
) -> Option<LanguageServerBinary>;
fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
fn process_diagnostics(&self, _: &mut lsp2::PublishDiagnosticsParams) {}
async fn process_completion(&self, _: &mut lsp::CompletionItem) {}
async fn process_completion(&self, _: &mut lsp2::CompletionItem) {}
async fn label_for_completion(
&self,
_: &lsp::CompletionItem,
_: &lsp2::CompletionItem,
_: &Arc<Language>,
) -> Option<CodeLabel> {
None
@ -302,7 +302,7 @@ pub trait LspAdapter: 'static + Send + Sync {
async fn label_for_symbol(
&self,
_: &str,
_: lsp::SymbolKind,
_: lsp2::SymbolKind,
_: &Arc<Language>,
) -> Option<CodeLabel> {
None
@ -494,8 +494,8 @@ fn deserialize_regex<'de, D: Deserializer<'de>>(d: D) -> Result<Option<Regex>, D
pub struct FakeLspAdapter {
pub name: &'static str,
pub initialization_options: Option<Value>,
pub capabilities: lsp::ServerCapabilities,
pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp::FakeLanguageServer)>>,
pub capabilities: lsp2::ServerCapabilities,
pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp2::FakeLanguageServer)>>,
pub disk_based_diagnostics_progress_token: Option<String>,
pub disk_based_diagnostics_sources: Vec<String>,
pub enabled_formatters: Vec<BundledFormatter>,
@ -550,7 +550,7 @@ pub struct Language {
#[cfg(any(test, feature = "test-support"))]
fake_adapter: Option<(
mpsc::UnboundedSender<lsp::FakeLanguageServer>,
mpsc::UnboundedSender<lsp2::FakeLanguageServer>,
Arc<FakeLspAdapter>,
)>,
}
@ -667,7 +667,7 @@ struct LanguageRegistryState {
pub struct PendingLanguageServer {
pub server_id: LanguageServerId,
pub task: Task<Result<Option<lsp::LanguageServer>>>,
pub task: Task<Result<Option<lsp2::LanguageServer>>>,
pub container_dir: Option<Arc<Path>>,
}
@ -922,7 +922,7 @@ impl LanguageRegistry {
if language.fake_adapter.is_some() {
let task = cx.spawn(|cx| async move {
let (servers_tx, fake_adapter) = language.fake_adapter.as_ref().unwrap();
let (server, mut fake_server) = lsp::LanguageServer::fake(
let (server, mut fake_server) = lsp2::LanguageServer::fake(
fake_adapter.name.to_string(),
fake_adapter.capabilities.clone(),
cx.clone(),
@ -933,10 +933,10 @@ impl LanguageRegistry {
}
let servers_tx = servers_tx.clone();
cx.background()
cx.executor()
.spawn(async move {
if fake_server
.try_receive_notification::<lsp::notification::Initialized>()
.try_receive_notification::<lsp2::notification::Initialized>()
.await
.is_some()
{
@ -970,18 +970,22 @@ impl LanguageRegistry {
let task = {
let container_dir = container_dir.clone();
cx.spawn(|mut cx| async move {
cx.spawn(move |mut cx| async move {
login_shell_env_loaded.await;
let mut lock = this.lsp_binary_paths.lock();
let entry = lock
let entry = this
.lsp_binary_paths
.lock()
.entry(adapter.name.clone())
.or_insert_with(|| {
let adapter = adapter.clone();
let language = language.clone();
let delegate = delegate.clone();
cx.spawn(|cx| {
get_binary(
adapter.clone(),
language.clone(),
delegate.clone(),
adapter,
language,
delegate,
container_dir,
lsp_binary_statuses,
cx,
@ -991,9 +995,8 @@ impl LanguageRegistry {
.shared()
})
.clone();
drop(lock);
let binary = match entry.clone().await.log_err() {
let binary = match entry.await.log_err() {
Some(binary) => binary,
None => return Ok(None),
};
@ -1004,7 +1007,7 @@ impl LanguageRegistry {
}
}
Ok(Some(lsp::LanguageServer::new(
Ok(Some(lsp2::LanguageServer::new(
server_id,
binary,
&root_path,
@ -1486,7 +1489,7 @@ impl Language {
pub async fn set_fake_lsp_adapter(
&mut self,
fake_lsp_adapter: Arc<FakeLspAdapter>,
) -> mpsc::UnboundedReceiver<lsp::FakeLanguageServer> {
) -> mpsc::UnboundedReceiver<lsp2::FakeLanguageServer> {
let (servers_tx, servers_rx) = mpsc::unbounded();
self.fake_adapter = Some((servers_tx, fake_lsp_adapter.clone()));
let adapter = CachedLspAdapter::new(Arc::new(fake_lsp_adapter)).await;
@ -1516,7 +1519,7 @@ impl Language {
None
}
pub async fn process_completion(self: &Arc<Self>, completion: &mut lsp::CompletionItem) {
pub async fn process_completion(self: &Arc<Self>, completion: &mut lsp2::CompletionItem) {
for adapter in &self.adapters {
adapter.process_completion(completion).await;
}
@ -1524,7 +1527,7 @@ impl Language {
pub async fn label_for_completion(
self: &Arc<Self>,
completion: &lsp::CompletionItem,
completion: &lsp2::CompletionItem,
) -> Option<CodeLabel> {
self.adapters
.first()
@ -1536,7 +1539,7 @@ impl Language {
pub async fn label_for_symbol(
self: &Arc<Self>,
name: &str,
kind: lsp::SymbolKind,
kind: lsp2::SymbolKind,
) -> Option<CodeLabel> {
self.adapters
.first()
@ -1756,7 +1759,7 @@ impl Default for FakeLspAdapter {
fn default() -> Self {
Self {
name: "the-fake-language-server",
capabilities: lsp::LanguageServer::full_capabilities(),
capabilities: lsp2::LanguageServer::full_capabilities(),
initializer: None,
disk_based_diagnostics_progress_token: None,
initialization_options: None,
@ -1805,7 +1808,7 @@ impl LspAdapter for Arc<FakeLspAdapter> {
unreachable!();
}
fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
fn process_diagnostics(&self, _: &mut lsp2::PublishDiagnosticsParams) {}
async fn disk_based_diagnostic_sources(&self) -> Vec<String> {
self.disk_based_diagnostics_sources.clone()
@ -1835,22 +1838,22 @@ fn get_capture_indices(query: &Query, captures: &mut [(&str, &mut Option<u32>)])
}
}
pub fn point_to_lsp(point: PointUtf16) -> lsp::Position {
lsp::Position::new(point.row, point.column)
pub fn point_to_lsp(point: PointUtf16) -> lsp2::Position {
lsp2::Position::new(point.row, point.column)
}
pub fn point_from_lsp(point: lsp::Position) -> Unclipped<PointUtf16> {
pub fn point_from_lsp(point: lsp2::Position) -> Unclipped<PointUtf16> {
Unclipped(PointUtf16::new(point.line, point.character))
}
pub fn range_to_lsp(range: Range<PointUtf16>) -> lsp::Range {
lsp::Range {
pub fn range_to_lsp(range: Range<PointUtf16>) -> lsp2::Range {
lsp2::Range {
start: point_to_lsp(range.start),
end: point_to_lsp(range.end),
}
}
pub fn range_from_lsp(range: lsp::Range) -> Range<Unclipped<PointUtf16>> {
pub fn range_from_lsp(range: lsp2::Range) -> Range<Unclipped<PointUtf16>> {
let mut start = point_from_lsp(range.start);
let mut end = point_from_lsp(range.end);
if start > end {

View File

@ -1,6 +1,6 @@
use fuzzy::{StringMatch, StringMatchCandidate};
use fuzzy2::{StringMatch, StringMatchCandidate};
use gpui2::{Executor, HighlightStyle};
use std::{ops::Range, sync::Arc};
use std::ops::Range;
#[derive(Debug)]
pub struct Outline<T> {
@ -61,7 +61,7 @@ impl<T> Outline<T> {
let query = query.trim_start();
let is_path_query = query.contains(' ');
let smart_case = query.chars().any(|c| c.is_uppercase());
let mut matches = fuzzy::match_strings(
let mut matches = fuzzy2::match_strings(
if is_path_query {
&self.path_candidates
} else {

View File

@ -4,7 +4,7 @@ use crate::{
};
use anyhow::{anyhow, Result};
use clock::ReplicaId;
use lsp::{DiagnosticSeverity, LanguageServerId};
use lsp2::{DiagnosticSeverity, LanguageServerId};
use rpc::proto;
use std::{ops::Range, sync::Arc};
use text::*;

38
crates/lsp2/Cargo.toml Normal file
View File

@ -0,0 +1,38 @@
[package]
name = "lsp2"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
path = "src/lsp2.rs"
doctest = false
[features]
test-support = ["async-pipe"]
[dependencies]
collections = { path = "../collections" }
gpui2 = { path = "../gpui2" }
util = { path = "../util" }
anyhow.workspace = true
async-pipe = { git = "https://github.com/zed-industries/async-pipe-rs", rev = "82d00a04211cf4e1236029aa03e6b6ce2a74c553", optional = true }
futures.workspace = true
log.workspace = true
lsp-types = { git = "https://github.com/zed-industries/lsp-types", branch = "updated-completion-list-item-defaults" }
parking_lot.workspace = true
postage.workspace = true
serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
smol.workspace = true
[dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] }
async-pipe = { git = "https://github.com/zed-industries/async-pipe-rs", rev = "82d00a04211cf4e1236029aa03e6b6ce2a74c553" }
ctor.workspace = true
env_logger.workspace = true
unindent.workspace = true

1167
crates/lsp2/src/lsp2.rs Normal file

File diff suppressed because it is too large Load Diff

35
crates/theme2/Cargo.toml Normal file
View File

@ -0,0 +1,35 @@
[package]
name = "theme2"
version = "0.1.0"
edition = "2021"
publish = false
[features]
test-support = [
"gpui2/test-support",
"fs/test-support",
"settings2/test-support"
]
[lib]
path = "src/theme2.rs"
doctest = false
[dependencies]
gpui2 = { path = "../gpui2" }
fs = { path = "../fs" }
settings2 = { path = "../settings2" }
util = { path = "../util" }
anyhow.workspace = true
indexmap = "1.6.2"
parking_lot.workspace = true
serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
toml.workspace = true
[dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] }
fs = { path = "../fs", features = ["test-support"] }
settings2 = { path = "../settings2", features = ["test-support"] }

View File

@ -0,0 +1,21 @@
use gpui2::HighlightStyle;
use std::sync::Arc;
pub struct Theme {
pub editor: Editor,
}
pub struct Editor {
pub syntax: Arc<SyntaxTheme>,
}
#[derive(Default)]
pub struct SyntaxTheme {
pub highlights: Vec<(String, HighlightStyle)>,
}
impl SyntaxTheme {
pub fn new(highlights: Vec<(String, HighlightStyle)>) -> Self {
Self { highlights }
}
}

View File

@ -14,7 +14,7 @@ test-support = []
client = { path = "../client" }
editor = { path = "../editor" }
fs = { path = "../fs" }
fuzzy = { path = "../fuzzy" }
fuzzy = { path = "../fuzzy2" }
gpui = { path = "../gpui" }
db = { path = "../db" }
install_cli = { path = "../install_cli" }

View File

@ -108,7 +108,7 @@ fn main() {
handle_settings_file_changes(user_settings_file_rx, cx);
// handle_keymap_file_changes(user_keymap_file_rx, cx);
let client = client2::Client::new(http.clone(), cx);
// let client = client2::Client::new(http.clone(), cx);
// let mut languages = LanguageRegistry::new(login_shell_env_loaded);
// let copilot_language_server_id = languages.next_language_server_id();
// languages.set_executor(cx.background().clone());