Merge branch 'main' into kvark-linux

This commit is contained in:
Mikayla 2024-02-07 11:49:49 -08:00
commit 67555ee5b4
No known key found for this signature in database
238 changed files with 6624 additions and 3524 deletions

View file

@ -25,62 +25,62 @@ aho-corasick = "1.1"
anyhow.workspace = true
async-trait.workspace = true
backtrace = "0.3"
client = { path = "../client" }
clock = { path = "../clock" }
collections = { path = "../collections" }
copilot = { path = "../copilot" }
db = { path = "../db" }
fs = { path = "../fs" }
fsevent = { path = "../fsevent" }
client.workspace = true
clock.workspace = true
collections.workspace = true
copilot.workspace = true
db.workspace = true
fs.workspace = true
fsevent.workspace = true
futures.workspace = true
fuzzy = { path = "../fuzzy" }
git = { path = "../git" }
fuzzy.workspace = true
git.workspace = true
globset.workspace = true
gpui = { path = "../gpui" }
gpui.workspace = true
ignore = "0.4"
itertools = "0.10"
language = { path = "../language" }
language.workspace = true
lazy_static.workspace = true
log.workspace = true
lsp = { path = "../lsp" }
node_runtime = { path = "../node_runtime" }
lsp.workspace = true
node_runtime.workspace = true
parking_lot.workspace = true
postage.workspace = true
prettier = { path = "../prettier" }
prettier.workspace = true
rand.workspace = true
regex.workspace = true
rpc = { path = "../rpc" }
rpc.workspace = true
schemars.workspace = true
serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
settings = { path = "../settings" }
settings.workspace = true
sha2 = "0.10"
similar = "1.3"
smol.workspace = true
sum_tree = { path = "../sum_tree" }
terminal = { path = "../terminal" }
text = { path = "../text" }
sum_tree.workspace = true
terminal.workspace = true
text.workspace = true
thiserror.workspace = true
toml.workspace = true
util = { path = "../util" }
util.workspace = true
[dev-dependencies]
client = { path = "../client", features = ["test-support"] }
collections = { path = "../collections", features = ["test-support"] }
client = { workspace = true, features = ["test-support"] }
collections = { workspace = true, features = ["test-support"] }
ctor.workspace = true
db = { path = "../db", features = ["test-support"] }
db = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
fs = { path = "../fs", features = ["test-support"] }
fs = { workspace = true, features = ["test-support"] }
git2.workspace = true
gpui = { path = "../gpui", features = ["test-support"] }
language = { path = "../language", features = ["test-support"] }
release_channel = { path = "../release_channel" }
lsp = { path = "../lsp", features = ["test-support"] }
prettier = { path = "../prettier", features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] }
release_channel.workspace = true
lsp = { workspace = true, features = ["test-support"] }
prettier = { workspace = true, features = ["test-support"] }
pretty_assertions.workspace = true
rpc = { path = "../rpc", features = ["test-support"] }
settings = { path = "../settings", features = ["test-support"] }
rpc = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] }
tempfile.workspace = true
unindent.workspace = true
util = { path = "../util", features = ["test-support"] }
util = { workspace = true, features = ["test-support"] }

View file

@ -4414,13 +4414,13 @@ impl Project {
}
}
pub fn definition<T: ToPointUtf16>(
#[inline(never)]
fn definition_impl(
&self,
buffer: &Model<Buffer>,
position: T,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<LocationLink>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
@ -4428,14 +4428,22 @@ impl Project {
cx,
)
}
pub fn type_definition<T: ToPointUtf16>(
pub fn definition<T: ToPointUtf16>(
&self,
buffer: &Model<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<LocationLink>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.definition_impl(buffer, position, cx)
}
fn type_definition_impl(
&self,
buffer: &Model<Buffer>,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<LocationLink>>> {
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
@ -4443,7 +4451,30 @@ impl Project {
cx,
)
}
pub fn type_definition<T: ToPointUtf16>(
&self,
buffer: &Model<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<LocationLink>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.type_definition_impl(buffer, position, cx)
}
fn references_impl(
&self,
buffer: &Model<Buffer>,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<Location>>> {
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
GetReferences { position },
cx,
)
}
pub fn references<T: ToPointUtf16>(
&self,
buffer: &Model<Buffer>,
@ -4451,10 +4482,19 @@ impl Project {
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<Location>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.references_impl(buffer, position, cx)
}
fn document_highlights_impl(
&self,
buffer: &Model<Buffer>,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<DocumentHighlight>>> {
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
GetReferences { position },
GetDocumentHighlights { position },
cx,
)
}
@ -4466,12 +4506,7 @@ impl Project {
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<DocumentHighlight>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
GetDocumentHighlights { position },
cx,
)
self.document_highlights_impl(buffer, position, cx)
}
pub fn symbols(&self, query: &str, cx: &mut ModelContext<Self>) -> Task<Result<Vec<Symbol>>> {
@ -4694,13 +4729,12 @@ impl Project {
}
}
pub fn hover<T: ToPointUtf16>(
fn hover_impl(
&self,
buffer: &Model<Buffer>,
position: T,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<Hover>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer.clone(),
LanguageServerToQuery::Primary,
@ -4708,14 +4742,23 @@ impl Project {
cx,
)
}
pub fn completions<T: ToOffset + ToPointUtf16>(
pub fn hover<T: ToPointUtf16>(
&self,
buffer: &Model<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<Completion>>> {
) -> Task<Result<Option<Hover>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.hover_impl(buffer, position, cx)
}
#[inline(never)]
fn completions_impl(
&self,
buffer: &Model<Buffer>,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<Completion>>> {
if self.is_local() {
let snapshot = buffer.read(cx).snapshot();
let offset = position.to_offset(&snapshot);
@ -4762,6 +4805,15 @@ impl Project {
Task::ready(Ok(Default::default()))
}
}
pub fn completions<T: ToOffset + ToPointUtf16>(
&self,
buffer: &Model<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<Completion>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.completions_impl(buffer, position, cx)
}
pub fn resolve_completions(
&self,
@ -5038,6 +5090,20 @@ impl Project {
}
}
fn code_actions_impl(
&self,
buffer_handle: &Model<Buffer>,
range: Range<Anchor>,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<CodeAction>>> {
self.request_lsp(
buffer_handle.clone(),
LanguageServerToQuery::Primary,
GetCodeActions { range },
cx,
)
}
pub fn code_actions<T: Clone + ToOffset>(
&self,
buffer_handle: &Model<Buffer>,
@ -5046,12 +5112,7 @@ impl Project {
) -> Task<Result<Vec<CodeAction>>> {
let buffer = buffer_handle.read(cx);
let range = buffer.anchor_before(range.start)..buffer.anchor_before(range.end);
self.request_lsp(
buffer_handle.clone(),
LanguageServerToQuery::Primary,
GetCodeActions { range },
cx,
)
self.code_actions_impl(buffer_handle, range, cx)
}
pub fn apply_code_action(
@ -5420,13 +5481,12 @@ impl Project {
Ok(project_transaction)
}
pub fn prepare_rename<T: ToPointUtf16>(
fn prepare_rename_impl(
&self,
buffer: Model<Buffer>,
position: T,
position: PointUtf16,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<Range<Anchor>>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.request_lsp(
buffer,
LanguageServerToQuery::Primary,
@ -5434,11 +5494,20 @@ impl Project {
cx,
)
}
pub fn perform_rename<T: ToPointUtf16>(
pub fn prepare_rename<T: ToPointUtf16>(
&self,
buffer: Model<Buffer>,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<Range<Anchor>>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.prepare_rename_impl(buffer, position, cx)
}
fn perform_rename_impl(
&self,
buffer: Model<Buffer>,
position: PointUtf16,
new_name: String,
push_to_history: bool,
cx: &mut ModelContext<Self>,
@ -5455,22 +5524,28 @@ impl Project {
cx,
)
}
pub fn on_type_format<T: ToPointUtf16>(
pub fn perform_rename<T: ToPointUtf16>(
&self,
buffer: Model<Buffer>,
position: T,
new_name: String,
push_to_history: bool,
cx: &mut ModelContext<Self>,
) -> Task<Result<ProjectTransaction>> {
let position = position.to_point_utf16(buffer.read(cx));
self.perform_rename_impl(buffer, position, new_name, push_to_history, cx)
}
pub fn on_type_format_impl(
&self,
buffer: Model<Buffer>,
position: PointUtf16,
trigger: String,
push_to_history: bool,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<Transaction>>> {
let (position, tab_size) = buffer.update(cx, |buffer, cx| {
let position = position.to_point_utf16(buffer);
(
position,
language_settings(buffer.language_at(position).as_ref(), buffer.file(), cx)
.tab_size,
)
let tab_size = buffer.update(cx, |buffer, cx| {
language_settings(buffer.language_at(position).as_ref(), buffer.file(), cx).tab_size
});
self.request_lsp(
buffer.clone(),
@ -5485,6 +5560,18 @@ impl Project {
)
}
pub fn on_type_format<T: ToPointUtf16>(
&self,
buffer: Model<Buffer>,
position: T,
trigger: String,
push_to_history: bool,
cx: &mut ModelContext<Self>,
) -> Task<Result<Option<Transaction>>> {
let position = position.to_point_utf16(buffer.read(cx));
self.on_type_format_impl(buffer, position, trigger, push_to_history, cx)
}
pub fn inlay_hints<T: ToOffset>(
&self,
buffer_handle: Model<Buffer>,
@ -5493,6 +5580,15 @@ impl Project {
) -> Task<anyhow::Result<Vec<InlayHint>>> {
let buffer = buffer_handle.read(cx);
let range = buffer.anchor_before(range.start)..buffer.anchor_before(range.end);
self.inlay_hints_impl(buffer_handle, range, cx)
}
fn inlay_hints_impl(
&self,
buffer_handle: Model<Buffer>,
range: Range<Anchor>,
cx: &mut ModelContext<Self>,
) -> Task<anyhow::Result<Vec<InlayHint>>> {
let buffer = buffer_handle.read(cx);
let range_start = range.start;
let range_end = range.end;
let buffer_id = buffer.remote_id().into();