Remove the 2s from source code

This commit is contained in:
Mikayla 2023-11-02 10:55:02 -07:00
parent a3565225ad
commit d11ff14b57
No known key found for this signature in database
115 changed files with 1473 additions and 1549 deletions

View file

@ -16,8 +16,8 @@ use crate::{
use anyhow::{anyhow, Result};
pub use clock::ReplicaId;
use futures::FutureExt as _;
use gpui2::{AppContext, EventEmitter, HighlightStyle, ModelContext, Task};
use lsp2::LanguageServerId;
use gpui::{AppContext, EventEmitter, HighlightStyle, ModelContext, Task};
use lsp::LanguageServerId;
use parking_lot::Mutex;
use similar::{ChangeTag, TextDiff};
use smallvec::SmallVec;
@ -40,7 +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;
use theme::SyntaxTheme;
#[cfg(any(test, feature = "test-support"))]
use util::RandomCharIter;
use util::{RangeExt, TryFutureExt as _};
@ -48,7 +48,7 @@ use util::{RangeExt, TryFutureExt as _};
#[cfg(any(test, feature = "test-support"))]
pub use {tree_sitter_rust, tree_sitter_typescript};
pub use lsp2::DiagnosticSeverity;
pub use lsp::DiagnosticSeverity;
pub struct Buffer {
text: TextBuffer,
@ -149,14 +149,14 @@ pub struct Completion {
pub new_text: String,
pub label: CodeLabel,
pub server_id: LanguageServerId,
pub lsp_completion: lsp2::CompletionItem,
pub lsp_completion: lsp::CompletionItem,
}
#[derive(Clone, Debug)]
pub struct CodeAction {
pub server_id: LanguageServerId,
pub range: Range<Anchor>,
pub lsp_action: lsp2::CodeAction,
pub lsp_action: lsp::CodeAction,
}
#[derive(Clone, Debug, PartialEq)]
@ -226,7 +226,7 @@ pub trait File: Send + Sync {
fn as_any(&self) -> &dyn Any;
fn to_proto(&self) -> rpc2::proto::File;
fn to_proto(&self) -> rpc::proto::File;
}
pub trait LocalFile: File {
@ -375,7 +375,7 @@ impl Buffer {
file,
);
this.text.set_line_ending(proto::deserialize_line_ending(
rpc2::proto::LineEnding::from_i32(message.line_ending)
rpc::proto::LineEnding::from_i32(message.line_ending)
.ok_or_else(|| anyhow!("missing line_ending"))?,
));
this.saved_version = proto::deserialize_version(&message.saved_version);
@ -3003,14 +3003,14 @@ impl IndentSize {
impl Completion {
pub fn sort_key(&self) -> (usize, &str) {
let kind_key = match self.lsp_completion.kind {
Some(lsp2::CompletionItemKind::VARIABLE) => 0,
Some(lsp::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(lsp2::InsertTextFormat::SNIPPET)
self.lsp_completion.insert_text_format == Some(lsp::InsertTextFormat::SNIPPET)
}
}

View file

@ -5,13 +5,13 @@ use crate::language_settings::{
use crate::Buffer;
use clock::ReplicaId;
use collections::BTreeMap;
use gpui2::{AppContext, Model};
use gpui2::{Context, TestAppContext};
use gpui::{AppContext, Model};
use gpui::{Context, TestAppContext};
use indoc::indoc;
use proto::deserialize_operation;
use rand::prelude::*;
use regex::RegexBuilder;
use settings2::SettingsStore;
use settings::SettingsStore;
use std::{
env,
ops::Range,
@ -38,8 +38,8 @@ fn init_logger() {
}
}
#[gpui2::test]
fn test_line_endings(cx: &mut gpui2::AppContext) {
#[gpui::test]
fn test_line_endings(cx: &mut gpui::AppContext) {
init_settings(cx, |_| {});
cx.build_model(|cx| {
@ -63,7 +63,7 @@ fn test_line_endings(cx: &mut gpui2::AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_select_language() {
let registry = Arc::new(LanguageRegistry::test());
registry.add(Arc::new(Language::new(
@ -132,8 +132,8 @@ fn test_select_language() {
);
}
#[gpui2::test]
fn test_edit_events(cx: &mut gpui2::AppContext) {
#[gpui::test]
fn test_edit_events(cx: &mut gpui::AppContext) {
let mut now = Instant::now();
let buffer_1_events = Arc::new(Mutex::new(Vec::new()));
let buffer_2_events = Arc::new(Mutex::new(Vec::new()));
@ -215,7 +215,7 @@ fn test_edit_events(cx: &mut gpui2::AppContext) {
);
}
#[gpui2::test]
#[gpui::test]
async fn test_apply_diff(cx: &mut TestAppContext) {
let text = "a\nbb\nccc\ndddd\neeeee\nffffff\n";
let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), text));
@ -238,8 +238,8 @@ async fn test_apply_diff(cx: &mut TestAppContext) {
});
}
#[gpui2::test(iterations = 10)]
async fn test_normalize_whitespace(cx: &mut gpui2::TestAppContext) {
#[gpui::test(iterations = 10)]
async fn test_normalize_whitespace(cx: &mut gpui::TestAppContext) {
let text = [
"zero", //
"one ", // 2 trailing spaces
@ -311,8 +311,8 @@ async fn test_normalize_whitespace(cx: &mut gpui2::TestAppContext) {
});
}
#[gpui2::test]
async fn test_reparse(cx: &mut gpui2::TestAppContext) {
#[gpui::test]
async fn test_reparse(cx: &mut gpui::TestAppContext) {
let text = "fn a() {}";
let buffer = cx.build_model(|cx| {
Buffer::new(0, cx.entity_id().as_u64(), text).with_language(Arc::new(rust_lang()), cx)
@ -440,8 +440,8 @@ async fn test_reparse(cx: &mut gpui2::TestAppContext) {
);
}
#[gpui2::test]
async fn test_resetting_language(cx: &mut gpui2::TestAppContext) {
#[gpui::test]
async fn test_resetting_language(cx: &mut gpui::TestAppContext) {
let buffer = cx.build_model(|cx| {
let mut buffer =
Buffer::new(0, cx.entity_id().as_u64(), "{}").with_language(Arc::new(rust_lang()), cx);
@ -463,8 +463,8 @@ async fn test_resetting_language(cx: &mut gpui2::TestAppContext) {
assert_eq!(get_tree_sexp(&buffer, cx), "(document (object))");
}
#[gpui2::test]
async fn test_outline(cx: &mut gpui2::TestAppContext) {
#[gpui::test]
async fn test_outline(cx: &mut gpui::TestAppContext) {
let text = r#"
struct Person {
name: String,
@ -556,7 +556,7 @@ async fn test_outline(cx: &mut gpui2::TestAppContext) {
async fn search<'a>(
outline: &'a Outline<Anchor>,
query: &'a str,
cx: &'a gpui2::TestAppContext,
cx: &'a gpui::TestAppContext,
) -> Vec<(&'a str, Vec<usize>)> {
let matches = cx
.update(|cx| outline.search(query, cx.background_executor().clone()))
@ -568,8 +568,8 @@ async fn test_outline(cx: &mut gpui2::TestAppContext) {
}
}
#[gpui2::test]
async fn test_outline_nodes_with_newlines(cx: &mut gpui2::TestAppContext) {
#[gpui::test]
async fn test_outline_nodes_with_newlines(cx: &mut gpui::TestAppContext) {
let text = r#"
impl A for B<
C
@ -595,8 +595,8 @@ async fn test_outline_nodes_with_newlines(cx: &mut gpui2::TestAppContext) {
);
}
#[gpui2::test]
async fn test_outline_with_extra_context(cx: &mut gpui2::TestAppContext) {
#[gpui::test]
async fn test_outline_with_extra_context(cx: &mut gpui::TestAppContext) {
let language = javascript_lang()
.with_outline_query(
r#"
@ -643,8 +643,8 @@ async fn test_outline_with_extra_context(cx: &mut gpui2::TestAppContext) {
);
}
#[gpui2::test]
async fn test_symbols_containing(cx: &mut gpui2::TestAppContext) {
#[gpui::test]
async fn test_symbols_containing(cx: &mut gpui::TestAppContext) {
let text = r#"
impl Person {
fn one() {
@ -731,7 +731,7 @@ async fn test_symbols_containing(cx: &mut gpui2::TestAppContext) {
}
}
#[gpui2::test]
#[gpui::test]
fn test_enclosing_bracket_ranges(cx: &mut AppContext) {
let mut assert = |selection_text, range_markers| {
assert_bracket_pairs(selection_text, range_markers, rust_lang(), cx)
@ -847,7 +847,7 @@ fn test_enclosing_bracket_ranges(cx: &mut AppContext) {
);
}
#[gpui2::test]
#[gpui::test]
fn test_enclosing_bracket_ranges_where_brackets_are_not_outermost_children(cx: &mut AppContext) {
let mut assert = |selection_text, bracket_pair_texts| {
assert_bracket_pairs(selection_text, bracket_pair_texts, javascript_lang(), cx)
@ -879,7 +879,7 @@ fn test_enclosing_bracket_ranges_where_brackets_are_not_outermost_children(cx: &
);
}
#[gpui2::test]
#[gpui::test]
fn test_range_for_syntax_ancestor(cx: &mut AppContext) {
cx.build_model(|cx| {
let text = "fn a() { b(|c| {}) }";
@ -918,7 +918,7 @@ fn test_range_for_syntax_ancestor(cx: &mut AppContext) {
}
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_with_soft_tabs(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -959,7 +959,7 @@ fn test_autoindent_with_soft_tabs(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_with_hard_tabs(cx: &mut AppContext) {
init_settings(cx, |settings| {
settings.defaults.hard_tabs = Some(true);
@ -1002,7 +1002,7 @@ fn test_autoindent_with_hard_tabs(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1143,7 +1143,7 @@ fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut AppC
eprintln!("DONE");
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_does_not_adjust_lines_within_newly_created_errors(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1205,7 +1205,7 @@ fn test_autoindent_does_not_adjust_lines_within_newly_created_errors(cx: &mut Ap
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1262,7 +1262,7 @@ fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_with_edit_at_end_of_buffer(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1280,7 +1280,7 @@ fn test_autoindent_with_edit_at_end_of_buffer(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_multi_line_insertion(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1322,7 +1322,7 @@ fn test_autoindent_multi_line_insertion(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_block_mode(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1406,7 +1406,7 @@ fn test_autoindent_block_mode(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_block_mode_without_original_indent_columns(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1486,7 +1486,7 @@ fn test_autoindent_block_mode_without_original_indent_columns(cx: &mut AppContex
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_language_without_indents_query(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1530,7 +1530,7 @@ fn test_autoindent_language_without_indents_query(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_with_injected_languages(cx: &mut AppContext) {
init_settings(cx, |settings| {
settings.languages.extend([
@ -1604,7 +1604,7 @@ fn test_autoindent_with_injected_languages(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_autoindent_query_with_outdent_captures(cx: &mut AppContext) {
init_settings(cx, |settings| {
settings.defaults.tab_size = Some(2.try_into().unwrap());
@ -1649,7 +1649,7 @@ fn test_autoindent_query_with_outdent_captures(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1738,7 +1738,7 @@ fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_language_scope_at_with_rust(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1806,7 +1806,7 @@ fn test_language_scope_at_with_rust(cx: &mut AppContext) {
});
}
#[gpui2::test]
#[gpui::test]
fn test_language_scope_at_with_combined_injections(cx: &mut AppContext) {
init_settings(cx, |_| {});
@ -1854,8 +1854,8 @@ fn test_language_scope_at_with_combined_injections(cx: &mut AppContext) {
});
}
#[gpui2::test]
fn test_serialization(cx: &mut gpui2::AppContext) {
#[gpui::test]
fn test_serialization(cx: &mut gpui::AppContext) {
let mut now = Instant::now();
let buffer1 = cx.build_model(|cx| {
@ -1895,7 +1895,7 @@ fn test_serialization(cx: &mut gpui2::AppContext) {
assert_eq!(buffer2.read(cx).text(), "abcDF");
}
#[gpui2::test(iterations = 100)]
#[gpui::test(iterations = 100)]
fn test_random_collaboration(cx: &mut AppContext, mut rng: StdRng) {
let min_peers = env::var("MIN_PEERS")
.map(|i| i.parse().expect("invalid `MIN_PEERS` variable"))
@ -2199,7 +2199,7 @@ fn test_contiguous_ranges() {
);
}
#[gpui2::test(iterations = 500)]
#[gpui::test(iterations = 500)]
fn test_trailing_whitespace_ranges(mut rng: StdRng) {
// Generate a random multi-line string containing
// some lines with trailing whitespace.
@ -2400,7 +2400,7 @@ fn javascript_lang() -> Language {
.unwrap()
}
fn get_tree_sexp(buffer: &Model<Buffer>, cx: &mut gpui2::TestAppContext) -> String {
fn get_tree_sexp(buffer: &Model<Buffer>, cx: &mut gpui::TestAppContext) -> String {
buffer.update(cx, |buffer, _| {
let snapshot = buffer.snapshot();
let layers = snapshot.syntax.layers(buffer.as_text_snapshot());

View file

@ -1,6 +1,6 @@
use crate::Diagnostic;
use collections::HashMap;
use lsp2::LanguageServerId;
use lsp::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) -> lsp2::Diagnostic {
pub fn to_lsp_diagnostic_stub(&self) -> lsp::Diagnostic {
let code = self
.diagnostic
.code
.clone()
.map(lsp2::NumberOrString::String);
.map(lsp::NumberOrString::String);
lsp2::Diagnostic {
lsp::Diagnostic {
code,
severity: Some(self.diagnostic.severity),
..Default::default()

View file

@ -1,6 +1,6 @@
use gpui2::HighlightStyle;
use gpui::HighlightStyle;
use std::sync::Arc;
use theme2::SyntaxTheme;
use theme::SyntaxTheme;
#[derive(Clone, Debug)]
pub struct HighlightMap(Arc<[HighlightId]>);
@ -79,7 +79,7 @@ impl Default for HighlightId {
#[cfg(test)]
mod tests {
use super::*;
use gpui2::rgba;
use gpui::rgba;
#[test]
fn test_highlight_map() {

View file

@ -17,10 +17,10 @@ use futures::{
future::{BoxFuture, Shared},
FutureExt, TryFutureExt as _,
};
use gpui2::{AppContext, AsyncAppContext, BackgroundExecutor, Task};
use gpui::{AppContext, AsyncAppContext, BackgroundExecutor, Task};
pub use highlight_map::HighlightMap;
use lazy_static::lazy_static;
use lsp2::{CodeActionKind, LanguageServerBinary};
use lsp::{CodeActionKind, LanguageServerBinary};
use parking_lot::{Mutex, RwLock};
use postage::watch;
use regex::Regex;
@ -42,7 +42,7 @@ use std::{
},
};
use syntax_map::SyntaxSnapshot;
use theme2::{SyntaxTheme, ThemeVariant};
use theme::{SyntaxTheme, ThemeVariant};
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 lsp2::LanguageServerId;
pub use lsp::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) -> lsp2::Position;
fn to_lsp_position(self) -> lsp::Position;
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
@ -203,17 +203,17 @@ impl CachedLspAdapter {
self.adapter.workspace_configuration(cx)
}
pub fn process_diagnostics(&self, params: &mut lsp2::PublishDiagnosticsParams) {
pub fn process_diagnostics(&self, params: &mut lsp::PublishDiagnosticsParams) {
self.adapter.process_diagnostics(params)
}
pub async fn process_completion(&self, completion_item: &mut lsp2::CompletionItem) {
pub async fn process_completion(&self, completion_item: &mut lsp::CompletionItem) {
self.adapter.process_completion(completion_item).await
}
pub async fn label_for_completion(
&self,
completion_item: &lsp2::CompletionItem,
completion_item: &lsp::CompletionItem,
language: &Arc<Language>,
) -> Option<CodeLabel> {
self.adapter
@ -224,7 +224,7 @@ impl CachedLspAdapter {
pub async fn label_for_symbol(
&self,
name: &str,
kind: lsp2::SymbolKind,
kind: lsp::SymbolKind,
language: &Arc<Language>,
) -> Option<CodeLabel> {
self.adapter.label_for_symbol(name, kind, language).await
@ -289,13 +289,13 @@ pub trait LspAdapter: 'static + Send + Sync {
container_dir: PathBuf,
) -> Option<LanguageServerBinary>;
fn process_diagnostics(&self, _: &mut lsp2::PublishDiagnosticsParams) {}
fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
async fn process_completion(&self, _: &mut lsp2::CompletionItem) {}
async fn process_completion(&self, _: &mut lsp::CompletionItem) {}
async fn label_for_completion(
&self,
_: &lsp2::CompletionItem,
_: &lsp::CompletionItem,
_: &Arc<Language>,
) -> Option<CodeLabel> {
None
@ -304,7 +304,7 @@ pub trait LspAdapter: 'static + Send + Sync {
async fn label_for_symbol(
&self,
_: &str,
_: lsp2::SymbolKind,
_: lsp::SymbolKind,
_: &Arc<Language>,
) -> Option<CodeLabel> {
None
@ -476,8 +476,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: lsp2::ServerCapabilities,
pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp2::FakeLanguageServer)>>,
pub capabilities: lsp::ServerCapabilities,
pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp::FakeLanguageServer)>>,
pub disk_based_diagnostics_progress_token: Option<String>,
pub disk_based_diagnostics_sources: Vec<String>,
pub prettier_plugins: Vec<&'static str>,
@ -532,7 +532,7 @@ pub struct Language {
#[cfg(any(test, feature = "test-support"))]
fake_adapter: Option<(
mpsc::UnboundedSender<lsp2::FakeLanguageServer>,
mpsc::UnboundedSender<lsp::FakeLanguageServer>,
Arc<FakeLspAdapter>,
)>,
}
@ -649,7 +649,7 @@ struct LanguageRegistryState {
pub struct PendingLanguageServer {
pub server_id: LanguageServerId,
pub task: Task<Result<lsp2::LanguageServer>>,
pub task: Task<Result<lsp::LanguageServer>>,
pub container_dir: Option<Arc<Path>>,
}
@ -905,7 +905,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) = lsp2::LanguageServer::fake(
let (server, mut fake_server) = lsp::LanguageServer::fake(
fake_adapter.name.to_string(),
fake_adapter.capabilities.clone(),
cx.clone(),
@ -919,7 +919,7 @@ impl LanguageRegistry {
cx.background_executor()
.spawn(async move {
if fake_server
.try_receive_notification::<lsp2::notification::Initialized>()
.try_receive_notification::<lsp::notification::Initialized>()
.await
.is_some()
{
@ -988,7 +988,7 @@ impl LanguageRegistry {
task.await?;
}
lsp2::LanguageServer::new(
lsp::LanguageServer::new(
stderr_capture,
server_id,
binary,
@ -1471,7 +1471,7 @@ impl Language {
pub async fn set_fake_lsp_adapter(
&mut self,
fake_lsp_adapter: Arc<FakeLspAdapter>,
) -> mpsc::UnboundedReceiver<lsp2::FakeLanguageServer> {
) -> mpsc::UnboundedReceiver<lsp::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;
@ -1501,7 +1501,7 @@ impl Language {
None
}
pub async fn process_completion(self: &Arc<Self>, completion: &mut lsp2::CompletionItem) {
pub async fn process_completion(self: &Arc<Self>, completion: &mut lsp::CompletionItem) {
for adapter in &self.adapters {
adapter.process_completion(completion).await;
}
@ -1509,7 +1509,7 @@ impl Language {
pub async fn label_for_completion(
self: &Arc<Self>,
completion: &lsp2::CompletionItem,
completion: &lsp::CompletionItem,
) -> Option<CodeLabel> {
self.adapters
.first()
@ -1521,7 +1521,7 @@ impl Language {
pub async fn label_for_symbol(
self: &Arc<Self>,
name: &str,
kind: lsp2::SymbolKind,
kind: lsp::SymbolKind,
) -> Option<CodeLabel> {
self.adapters
.first()
@ -1745,7 +1745,7 @@ impl Default for FakeLspAdapter {
fn default() -> Self {
Self {
name: "the-fake-language-server",
capabilities: lsp2::LanguageServer::full_capabilities(),
capabilities: lsp::LanguageServer::full_capabilities(),
initializer: None,
disk_based_diagnostics_progress_token: None,
initialization_options: None,
@ -1794,7 +1794,7 @@ impl LspAdapter for Arc<FakeLspAdapter> {
unreachable!();
}
fn process_diagnostics(&self, _: &mut lsp2::PublishDiagnosticsParams) {}
fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
async fn disk_based_diagnostic_sources(&self) -> Vec<String> {
self.disk_based_diagnostics_sources.clone()
@ -1824,22 +1824,22 @@ fn get_capture_indices(query: &Query, captures: &mut [(&str, &mut Option<u32>)])
}
}
pub fn point_to_lsp(point: PointUtf16) -> lsp2::Position {
lsp2::Position::new(point.row, point.column)
pub fn point_to_lsp(point: PointUtf16) -> lsp::Position {
lsp::Position::new(point.row, point.column)
}
pub fn point_from_lsp(point: lsp2::Position) -> Unclipped<PointUtf16> {
pub fn point_from_lsp(point: lsp::Position) -> Unclipped<PointUtf16> {
Unclipped(PointUtf16::new(point.line, point.character))
}
pub fn range_to_lsp(range: Range<PointUtf16>) -> lsp2::Range {
lsp2::Range {
pub fn range_to_lsp(range: Range<PointUtf16>) -> lsp::Range {
lsp::Range {
start: point_to_lsp(range.start),
end: point_to_lsp(range.end),
}
}
pub fn range_from_lsp(range: lsp2::Range) -> Range<Unclipped<PointUtf16>> {
pub fn range_from_lsp(range: lsp::Range) -> Range<Unclipped<PointUtf16>> {
let mut start = point_from_lsp(range.start);
let mut end = point_from_lsp(range.end);
if start > end {
@ -1851,9 +1851,9 @@ pub fn range_from_lsp(range: lsp2::Range) -> Range<Unclipped<PointUtf16>> {
#[cfg(test)]
mod tests {
use super::*;
use gpui2::TestAppContext;
use gpui::TestAppContext;
#[gpui2::test(iterations = 10)]
#[gpui::test(iterations = 10)]
async fn test_first_line_pattern(cx: &mut TestAppContext) {
let mut languages = LanguageRegistry::test();
@ -1891,7 +1891,7 @@ mod tests {
);
}
#[gpui2::test(iterations = 10)]
#[gpui::test(iterations = 10)]
async fn test_language_loading(cx: &mut TestAppContext) {
let mut languages = LanguageRegistry::test();
languages.set_executor(cx.executor().clone());

View file

@ -2,13 +2,13 @@ use crate::{File, Language};
use anyhow::Result;
use collections::{HashMap, HashSet};
use globset::GlobMatcher;
use gpui2::AppContext;
use gpui::AppContext;
use schemars::{
schema::{InstanceType, ObjectValidation, Schema, SchemaObject},
JsonSchema,
};
use serde::{Deserialize, Serialize};
use settings2::Settings;
use settings::Settings;
use std::{num::NonZeroU32, path::Path, sync::Arc};
pub fn init(cx: &mut AppContext) {
@ -255,7 +255,7 @@ impl InlayHintKind {
}
}
impl settings2::Settings for AllLanguageSettings {
impl settings::Settings for AllLanguageSettings {
const KEY: Option<&'static str> = None;
type FileContent = AllLanguageSettingsContent;
@ -332,7 +332,7 @@ impl settings2::Settings for AllLanguageSettings {
fn json_schema(
generator: &mut schemars::gen::SchemaGenerator,
params: &settings2::SettingsJsonSchemaParams,
params: &settings::SettingsJsonSchemaParams,
_: &AppContext,
) -> schemars::schema::RootSchema {
let mut root_schema = generator.root_schema_for::<Self::FileContent>();

View file

@ -1,5 +1,5 @@
use fuzzy2::{StringMatch, StringMatchCandidate};
use gpui2::{BackgroundExecutor, HighlightStyle};
use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{BackgroundExecutor, HighlightStyle};
use std::ops::Range;
#[derive(Debug)]
@ -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 = fuzzy2::match_strings(
let mut matches = fuzzy::match_strings(
if is_path_query {
&self.path_candidates
} else {

View file

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

View file

@ -78,7 +78,7 @@ fn test_splice_included_ranges() {
}
}
#[gpui2::test]
#[gpui::test]
fn test_syntax_map_layers_for_range() {
let registry = Arc::new(LanguageRegistry::test());
let language = Arc::new(rust_lang());
@ -175,7 +175,7 @@ fn test_syntax_map_layers_for_range() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_dynamic_language_injection() {
let registry = Arc::new(LanguageRegistry::test());
let markdown = Arc::new(markdown_lang());
@ -253,7 +253,7 @@ fn test_dynamic_language_injection() {
assert!(!syntax_map.contains_unknown_injections());
}
#[gpui2::test]
#[gpui::test]
fn test_typing_multiple_new_injections() {
let (buffer, syntax_map) = test_edit_sequence(
"Rust",
@ -282,7 +282,7 @@ fn test_typing_multiple_new_injections() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_pasting_new_injection_line_between_others() {
let (buffer, syntax_map) = test_edit_sequence(
"Rust",
@ -329,7 +329,7 @@ fn test_pasting_new_injection_line_between_others() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_joining_injections_with_child_injections() {
let (buffer, syntax_map) = test_edit_sequence(
"Rust",
@ -373,7 +373,7 @@ fn test_joining_injections_with_child_injections() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_editing_edges_of_injection() {
test_edit_sequence(
"Rust",
@ -402,7 +402,7 @@ fn test_editing_edges_of_injection() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_edits_preceding_and_intersecting_injection() {
test_edit_sequence(
"Rust",
@ -414,7 +414,7 @@ fn test_edits_preceding_and_intersecting_injection() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_non_local_changes_create_injections() {
test_edit_sequence(
"Rust",
@ -433,7 +433,7 @@ fn test_non_local_changes_create_injections() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_creating_many_injections_in_one_edit() {
test_edit_sequence(
"Rust",
@ -463,7 +463,7 @@ fn test_creating_many_injections_in_one_edit() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_editing_across_injection_boundary() {
test_edit_sequence(
"Rust",
@ -491,7 +491,7 @@ fn test_editing_across_injection_boundary() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_removing_injection_by_replacing_across_boundary() {
test_edit_sequence(
"Rust",
@ -517,7 +517,7 @@ fn test_removing_injection_by_replacing_across_boundary() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_combined_injections_simple() {
let (buffer, syntax_map) = test_edit_sequence(
"ERB",
@ -564,7 +564,7 @@ fn test_combined_injections_simple() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_combined_injections_empty_ranges() {
test_edit_sequence(
"ERB",
@ -582,7 +582,7 @@ fn test_combined_injections_empty_ranges() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_combined_injections_edit_edges_of_ranges() {
let (buffer, syntax_map) = test_edit_sequence(
"ERB",
@ -613,7 +613,7 @@ fn test_combined_injections_edit_edges_of_ranges() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_combined_injections_splitting_some_injections() {
let (_buffer, _syntax_map) = test_edit_sequence(
"ERB",
@ -638,7 +638,7 @@ fn test_combined_injections_splitting_some_injections() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_combined_injections_editing_after_last_injection() {
test_edit_sequence(
"ERB",
@ -658,7 +658,7 @@ fn test_combined_injections_editing_after_last_injection() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_combined_injections_inside_injections() {
let (buffer, syntax_map) = test_edit_sequence(
"Markdown",
@ -734,7 +734,7 @@ fn test_combined_injections_inside_injections() {
);
}
#[gpui2::test]
#[gpui::test]
fn test_empty_combined_injections_inside_injections() {
let (buffer, syntax_map) = test_edit_sequence(
"Markdown",
@ -762,7 +762,7 @@ fn test_empty_combined_injections_inside_injections() {
);
}
#[gpui2::test(iterations = 50)]
#[gpui::test(iterations = 50)]
fn test_random_syntax_map_edits_rust_macros(rng: StdRng) {
let text = r#"
fn test_something() {
@ -788,7 +788,7 @@ fn test_random_syntax_map_edits_rust_macros(rng: StdRng) {
test_random_edits(text, registry, language, rng);
}
#[gpui2::test(iterations = 50)]
#[gpui::test(iterations = 50)]
fn test_random_syntax_map_edits_with_erb(rng: StdRng) {
let text = r#"
<div id="main">
@ -817,7 +817,7 @@ fn test_random_syntax_map_edits_with_erb(rng: StdRng) {
test_random_edits(text, registry, language, rng);
}
#[gpui2::test(iterations = 50)]
#[gpui::test(iterations = 50)]
fn test_random_syntax_map_edits_with_heex(rng: StdRng) {
let text = r#"
defmodule TheModule do