Update lsp-types to properly handle brackets (#37166)
Closes #21062 See also this pull request: https://github.com/zed-industries/lsp-types/pull/6. Release Notes: - Fixed incorrect URL encoding of file paths with `[` `]` in them
This commit is contained in:
Generated
+1
-1
@@ -9770,7 +9770,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "lsp-types"
|
||||
version = "0.95.1"
|
||||
source = "git+https://github.com/zed-industries/lsp-types?rev=39f629bdd03d59abd786ed9fc27e8bca02c0c0ec#39f629bdd03d59abd786ed9fc27e8bca02c0c0ec"
|
||||
source = "git+https://github.com/zed-industries/lsp-types?rev=0874f8742fe55b4dc94308c1e3c0069710d8eeaf#0874f8742fe55b4dc94308c1e3c0069710d8eeaf"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"serde",
|
||||
|
||||
+1
-1
@@ -519,7 +519,7 @@ libc = "0.2"
|
||||
libsqlite3-sys = { version = "0.30.1", features = ["bundled"] }
|
||||
linkify = "0.10.0"
|
||||
log = { version = "0.4.16", features = ["kv_unstable_serde", "serde"] }
|
||||
lsp-types = { git = "https://github.com/zed-industries/lsp-types", rev = "39f629bdd03d59abd786ed9fc27e8bca02c0c0ec" }
|
||||
lsp-types = { git = "https://github.com/zed-industries/lsp-types", rev = "0874f8742fe55b4dc94308c1e3c0069710d8eeaf" }
|
||||
mach2 = "0.5"
|
||||
markup5ever_rcdom = "0.3.0"
|
||||
metal = "0.29"
|
||||
|
||||
@@ -2128,7 +2128,7 @@ mod tests {
|
||||
lsp::SymbolInformation {
|
||||
name: "MySymbol".into(),
|
||||
location: lsp::Location {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/a/one.txt")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/a/one.txt")).unwrap(),
|
||||
range: lsp::Range::new(
|
||||
lsp::Position::new(0, 0),
|
||||
lsp::Position::new(0, 1),
|
||||
|
||||
@@ -369,7 +369,7 @@ async fn test_collaborating_with_completion(cx_a: &mut TestAppContext, cx_b: &mu
|
||||
.set_request_handler::<lsp::request::Completion, _, _>(|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document_position.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(
|
||||
params.text_document_position.position,
|
||||
@@ -488,7 +488,7 @@ async fn test_collaborating_with_completion(cx_a: &mut TestAppContext, cx_b: &mu
|
||||
.set_request_handler::<lsp::request::Completion, _, _>(|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document_position.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(
|
||||
params.text_document_position.position,
|
||||
@@ -615,7 +615,7 @@ async fn test_collaborating_with_code_actions(
|
||||
.set_request_handler::<lsp::request::CodeActionRequest, _, _>(|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(params.range.start, lsp::Position::new(0, 0));
|
||||
assert_eq!(params.range.end, lsp::Position::new(0, 0));
|
||||
@@ -637,7 +637,7 @@ async fn test_collaborating_with_code_actions(
|
||||
.set_request_handler::<lsp::request::CodeActionRequest, _, _>(|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(params.range.start, lsp::Position::new(1, 31));
|
||||
assert_eq!(params.range.end, lsp::Position::new(1, 31));
|
||||
@@ -649,7 +649,7 @@ async fn test_collaborating_with_code_actions(
|
||||
changes: Some(
|
||||
[
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
vec![lsp::TextEdit::new(
|
||||
lsp::Range::new(
|
||||
lsp::Position::new(1, 22),
|
||||
@@ -659,7 +659,7 @@ async fn test_collaborating_with_code_actions(
|
||||
)],
|
||||
),
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/a/other.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/other.rs")).unwrap(),
|
||||
vec![lsp::TextEdit::new(
|
||||
lsp::Range::new(
|
||||
lsp::Position::new(0, 0),
|
||||
@@ -721,7 +721,7 @@ async fn test_collaborating_with_code_actions(
|
||||
changes: Some(
|
||||
[
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
vec![lsp::TextEdit::new(
|
||||
lsp::Range::new(
|
||||
lsp::Position::new(1, 22),
|
||||
@@ -731,7 +731,7 @@ async fn test_collaborating_with_code_actions(
|
||||
)],
|
||||
),
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/a/other.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/other.rs")).unwrap(),
|
||||
vec![lsp::TextEdit::new(
|
||||
lsp::Range::new(
|
||||
lsp::Position::new(0, 0),
|
||||
@@ -949,14 +949,14 @@ async fn test_collaborating_with_renames(cx_a: &mut TestAppContext, cx_b: &mut T
|
||||
changes: Some(
|
||||
[
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/dir/one.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/one.rs")).unwrap(),
|
||||
vec![lsp::TextEdit::new(
|
||||
lsp::Range::new(lsp::Position::new(0, 6), lsp::Position::new(0, 9)),
|
||||
"THREE".to_string(),
|
||||
)],
|
||||
),
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/dir/two.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/two.rs")).unwrap(),
|
||||
vec![
|
||||
lsp::TextEdit::new(
|
||||
lsp::Range::new(
|
||||
@@ -1574,7 +1574,7 @@ async fn test_on_input_format_from_host_to_guest(
|
||||
|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document_position.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(
|
||||
params.text_document_position.position,
|
||||
@@ -1717,7 +1717,7 @@ async fn test_on_input_format_from_guest_to_host(
|
||||
.set_request_handler::<lsp::request::OnTypeFormatting, _, _>(|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document_position.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(
|
||||
params.text_document_position.position,
|
||||
@@ -1901,7 +1901,7 @@ async fn test_mutual_editor_inlay_hint_cache_update(
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
let edits_made = task_edits_made.load(atomic::Ordering::Acquire);
|
||||
Ok(Some(vec![lsp::InlayHint {
|
||||
@@ -2151,7 +2151,7 @@ async fn test_inlay_hint_refresh_is_forwarded(
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
let other_hints = task_other_hints.load(atomic::Ordering::Acquire);
|
||||
let character = if other_hints { 0 } else { 2 };
|
||||
@@ -2332,7 +2332,7 @@ async fn test_lsp_document_color(cx_a: &mut TestAppContext, cx_b: &mut TestAppCo
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
requests_made.fetch_add(1, atomic::Ordering::Release);
|
||||
Ok(vec![lsp::ColorInformation {
|
||||
@@ -2621,11 +2621,11 @@ async fn test_lsp_pull_diagnostics(
|
||||
let requests_made = closure_diagnostics_pulls_made.clone();
|
||||
let diagnostics_pulls_result_ids = closure_diagnostics_pulls_result_ids.clone();
|
||||
async move {
|
||||
let message = if lsp::Url::from_file_path(path!("/a/main.rs")).unwrap()
|
||||
let message = if lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap()
|
||||
== params.text_document.uri
|
||||
{
|
||||
expected_pull_diagnostic_main_message.to_string()
|
||||
} else if lsp::Url::from_file_path(path!("/a/lib.rs")).unwrap()
|
||||
} else if lsp::Uri::from_file_path(path!("/a/lib.rs")).unwrap()
|
||||
== params.text_document.uri
|
||||
{
|
||||
expected_pull_diagnostic_lib_message.to_string()
|
||||
@@ -2717,7 +2717,7 @@ async fn test_lsp_pull_diagnostics(
|
||||
items: vec![
|
||||
lsp::WorkspaceDocumentDiagnosticReport::Full(
|
||||
lsp::WorkspaceFullDocumentDiagnosticReport {
|
||||
uri: lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
version: None,
|
||||
full_document_diagnostic_report:
|
||||
lsp::FullDocumentDiagnosticReport {
|
||||
@@ -2746,7 +2746,7 @@ async fn test_lsp_pull_diagnostics(
|
||||
),
|
||||
lsp::WorkspaceDocumentDiagnosticReport::Full(
|
||||
lsp::WorkspaceFullDocumentDiagnosticReport {
|
||||
uri: lsp::Url::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
version: None,
|
||||
full_document_diagnostic_report:
|
||||
lsp::FullDocumentDiagnosticReport {
|
||||
@@ -2821,7 +2821,7 @@ async fn test_lsp_pull_diagnostics(
|
||||
|
||||
fake_language_server.notify::<lsp::notification::PublishDiagnostics>(
|
||||
&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range {
|
||||
start: lsp::Position {
|
||||
@@ -2842,7 +2842,7 @@ async fn test_lsp_pull_diagnostics(
|
||||
);
|
||||
fake_language_server.notify::<lsp::notification::PublishDiagnostics>(
|
||||
&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range {
|
||||
start: lsp::Position {
|
||||
@@ -2870,7 +2870,7 @@ async fn test_lsp_pull_diagnostics(
|
||||
items: vec![
|
||||
lsp::WorkspaceDocumentDiagnosticReport::Full(
|
||||
lsp::WorkspaceFullDocumentDiagnosticReport {
|
||||
uri: lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
version: None,
|
||||
full_document_diagnostic_report:
|
||||
lsp::FullDocumentDiagnosticReport {
|
||||
@@ -2902,7 +2902,7 @@ async fn test_lsp_pull_diagnostics(
|
||||
),
|
||||
lsp::WorkspaceDocumentDiagnosticReport::Full(
|
||||
lsp::WorkspaceFullDocumentDiagnosticReport {
|
||||
uri: lsp::Url::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
version: None,
|
||||
full_document_diagnostic_report:
|
||||
lsp::FullDocumentDiagnosticReport {
|
||||
@@ -3051,7 +3051,7 @@ async fn test_lsp_pull_diagnostics(
|
||||
lsp::WorkspaceDiagnosticReportResult::Report(lsp::WorkspaceDiagnosticReport {
|
||||
items: vec![lsp::WorkspaceDocumentDiagnosticReport::Full(
|
||||
lsp::WorkspaceFullDocumentDiagnosticReport {
|
||||
uri: lsp::Url::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/lib.rs")).unwrap(),
|
||||
version: None,
|
||||
full_document_diagnostic_report: lsp::FullDocumentDiagnosticReport {
|
||||
result_id: Some(format!(
|
||||
@@ -4040,7 +4040,7 @@ async fn test_client_can_query_lsp_ext(cx_a: &mut TestAppContext, cx_b: &mut Tes
|
||||
|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(params.position, lsp::Position::new(0, 0));
|
||||
Ok(Some(ExpandedMacro {
|
||||
@@ -4075,7 +4075,7 @@ async fn test_client_can_query_lsp_ext(cx_a: &mut TestAppContext, cx_b: &mut Tes
|
||||
|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(
|
||||
params.position,
|
||||
|
||||
@@ -4075,7 +4075,7 @@ async fn test_collaborating_with_diagnostics(
|
||||
.await;
|
||||
fake_language_server.notify::<lsp::notification::PublishDiagnostics>(
|
||||
&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
severity: Some(lsp::DiagnosticSeverity::WARNING),
|
||||
@@ -4095,7 +4095,7 @@ async fn test_collaborating_with_diagnostics(
|
||||
.unwrap();
|
||||
fake_language_server.notify::<lsp::notification::PublishDiagnostics>(
|
||||
&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
severity: Some(lsp::DiagnosticSeverity::ERROR),
|
||||
@@ -4169,7 +4169,7 @@ async fn test_collaborating_with_diagnostics(
|
||||
// Simulate a language server reporting more errors for a file.
|
||||
fake_language_server.notify::<lsp::notification::PublishDiagnostics>(
|
||||
&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
@@ -4265,7 +4265,7 @@ async fn test_collaborating_with_diagnostics(
|
||||
// Simulate a language server reporting no errors for a file.
|
||||
fake_language_server.notify::<lsp::notification::PublishDiagnostics>(
|
||||
&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: Vec::new(),
|
||||
},
|
||||
@@ -4372,7 +4372,7 @@ async fn test_collaborating_with_lsp_progress_updates_and_diagnostics_ordering(
|
||||
for file_name in file_names {
|
||||
fake_language_server.notify::<lsp::notification::PublishDiagnostics>(
|
||||
&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(Path::new(path!("/test")).join(file_name)).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(Path::new(path!("/test")).join(file_name)).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
severity: Some(lsp::DiagnosticSeverity::WARNING),
|
||||
@@ -4838,7 +4838,7 @@ async fn test_definition(
|
||||
|_, _| async move {
|
||||
Ok(Some(lsp::GotoDefinitionResponse::Scalar(
|
||||
lsp::Location::new(
|
||||
lsp::Url::from_file_path(path!("/root/dir-2/b.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/root/dir-2/b.rs")).unwrap(),
|
||||
lsp::Range::new(lsp::Position::new(0, 6), lsp::Position::new(0, 9)),
|
||||
),
|
||||
)))
|
||||
@@ -4876,7 +4876,7 @@ async fn test_definition(
|
||||
|_, _| async move {
|
||||
Ok(Some(lsp::GotoDefinitionResponse::Scalar(
|
||||
lsp::Location::new(
|
||||
lsp::Url::from_file_path(path!("/root/dir-2/b.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/root/dir-2/b.rs")).unwrap(),
|
||||
lsp::Range::new(lsp::Position::new(1, 6), lsp::Position::new(1, 11)),
|
||||
),
|
||||
)))
|
||||
@@ -4914,7 +4914,7 @@ async fn test_definition(
|
||||
);
|
||||
Ok(Some(lsp::GotoDefinitionResponse::Scalar(
|
||||
lsp::Location::new(
|
||||
lsp::Url::from_file_path(path!("/root/dir-2/c.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/root/dir-2/c.rs")).unwrap(),
|
||||
lsp::Range::new(lsp::Position::new(0, 5), lsp::Position::new(0, 7)),
|
||||
),
|
||||
)))
|
||||
@@ -5049,15 +5049,15 @@ async fn test_references(
|
||||
lsp_response_tx
|
||||
.unbounded_send(Ok(Some(vec![
|
||||
lsp::Location {
|
||||
uri: lsp::Url::from_file_path(path!("/root/dir-1/two.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/dir-1/two.rs")).unwrap(),
|
||||
range: lsp::Range::new(lsp::Position::new(0, 24), lsp::Position::new(0, 27)),
|
||||
},
|
||||
lsp::Location {
|
||||
uri: lsp::Url::from_file_path(path!("/root/dir-1/two.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/dir-1/two.rs")).unwrap(),
|
||||
range: lsp::Range::new(lsp::Position::new(0, 35), lsp::Position::new(0, 38)),
|
||||
},
|
||||
lsp::Location {
|
||||
uri: lsp::Url::from_file_path(path!("/root/dir-2/three.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/dir-2/three.rs")).unwrap(),
|
||||
range: lsp::Range::new(lsp::Position::new(0, 37), lsp::Position::new(0, 40)),
|
||||
},
|
||||
])))
|
||||
@@ -5625,7 +5625,7 @@ async fn test_project_symbols(
|
||||
lsp::SymbolInformation {
|
||||
name: "TWO".into(),
|
||||
location: lsp::Location {
|
||||
uri: lsp::Url::from_file_path(path!("/code/crate-2/two.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/code/crate-2/two.rs")).unwrap(),
|
||||
range: lsp::Range::new(lsp::Position::new(0, 6), lsp::Position::new(0, 9)),
|
||||
},
|
||||
kind: lsp::SymbolKind::CONSTANT,
|
||||
@@ -5737,7 +5737,7 @@ async fn test_open_buffer_while_getting_definition_pointing_to_it(
|
||||
|_, _| async move {
|
||||
Ok(Some(lsp::GotoDefinitionResponse::Scalar(
|
||||
lsp::Location::new(
|
||||
lsp::Url::from_file_path(path!("/root/b.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/root/b.rs")).unwrap(),
|
||||
lsp::Range::new(lsp::Position::new(0, 6), lsp::Position::new(0, 9)),
|
||||
),
|
||||
)))
|
||||
|
||||
@@ -1101,7 +1101,7 @@ impl RandomizedTest for ProjectCollaborationTest {
|
||||
files
|
||||
.into_iter()
|
||||
.map(|file| lsp::Location {
|
||||
uri: lsp::Url::from_file_path(file).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(file).unwrap(),
|
||||
range: Default::default(),
|
||||
})
|
||||
.collect(),
|
||||
|
||||
@@ -197,7 +197,7 @@ impl Status {
|
||||
}
|
||||
|
||||
struct RegisteredBuffer {
|
||||
uri: lsp::Url,
|
||||
uri: lsp::Uri,
|
||||
language_id: String,
|
||||
snapshot: BufferSnapshot,
|
||||
snapshot_version: i32,
|
||||
@@ -1108,9 +1108,9 @@ fn id_for_language(language: Option<&Arc<Language>>) -> String {
|
||||
.unwrap_or_else(|| "plaintext".to_string())
|
||||
}
|
||||
|
||||
fn uri_for_buffer(buffer: &Entity<Buffer>, cx: &App) -> Result<lsp::Url, ()> {
|
||||
fn uri_for_buffer(buffer: &Entity<Buffer>, cx: &App) -> Result<lsp::Uri, ()> {
|
||||
if let Some(file) = buffer.read(cx).file().and_then(|file| file.as_local()) {
|
||||
lsp::Url::from_file_path(file.abs_path(cx))
|
||||
lsp::Uri::from_file_path(file.abs_path(cx))
|
||||
} else {
|
||||
format!("buffer://{}", buffer.entity_id())
|
||||
.parse()
|
||||
@@ -1201,7 +1201,7 @@ mod tests {
|
||||
let (copilot, mut lsp) = Copilot::fake(cx);
|
||||
|
||||
let buffer_1 = cx.new(|cx| Buffer::local("Hello", cx));
|
||||
let buffer_1_uri: lsp::Url = format!("buffer://{}", buffer_1.entity_id().as_u64())
|
||||
let buffer_1_uri: lsp::Uri = format!("buffer://{}", buffer_1.entity_id().as_u64())
|
||||
.parse()
|
||||
.unwrap();
|
||||
copilot.update(cx, |copilot, cx| copilot.register_buffer(&buffer_1, cx));
|
||||
@@ -1219,7 +1219,7 @@ mod tests {
|
||||
);
|
||||
|
||||
let buffer_2 = cx.new(|cx| Buffer::local("Goodbye", cx));
|
||||
let buffer_2_uri: lsp::Url = format!("buffer://{}", buffer_2.entity_id().as_u64())
|
||||
let buffer_2_uri: lsp::Uri = format!("buffer://{}", buffer_2.entity_id().as_u64())
|
||||
.parse()
|
||||
.unwrap();
|
||||
copilot.update(cx, |copilot, cx| copilot.register_buffer(&buffer_2, cx));
|
||||
@@ -1270,7 +1270,7 @@ mod tests {
|
||||
text_document: lsp::TextDocumentIdentifier::new(buffer_1_uri),
|
||||
}
|
||||
);
|
||||
let buffer_1_uri = lsp::Url::from_file_path(path!("/root/child/buffer-1")).unwrap();
|
||||
let buffer_1_uri = lsp::Uri::from_file_path(path!("/root/child/buffer-1")).unwrap();
|
||||
assert_eq!(
|
||||
lsp.receive_notification::<lsp::notification::DidOpenTextDocument>()
|
||||
.await,
|
||||
|
||||
@@ -102,7 +102,7 @@ pub struct GetCompletionsDocument {
|
||||
pub tab_size: u32,
|
||||
pub indent_size: u32,
|
||||
pub insert_spaces: bool,
|
||||
pub uri: lsp::Url,
|
||||
pub uri: lsp::Uri,
|
||||
pub relative_path: String,
|
||||
pub position: lsp::Position,
|
||||
pub version: usize,
|
||||
|
||||
@@ -24,6 +24,7 @@ use settings::SettingsStore;
|
||||
use std::{
|
||||
env,
|
||||
path::{Path, PathBuf},
|
||||
str::FromStr,
|
||||
};
|
||||
use unindent::Unindent as _;
|
||||
use util::{RandomCharIter, path, post_inc};
|
||||
@@ -70,7 +71,7 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
|
||||
let window = cx.add_window(|window, cx| Workspace::test_new(project.clone(), window, cx));
|
||||
let cx = &mut VisualTestContext::from_window(*window, cx);
|
||||
let workspace = window.root(cx).unwrap();
|
||||
let uri = lsp::Url::from_file_path(path!("/test/main.rs")).unwrap();
|
||||
let uri = lsp::Uri::from_file_path(path!("/test/main.rs")).unwrap();
|
||||
|
||||
// Create some diagnostics
|
||||
lsp_store.update(cx, |lsp_store, cx| {
|
||||
@@ -167,7 +168,7 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
language_server_id,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/consts.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/consts.rs")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(
|
||||
lsp::Position::new(0, 15),
|
||||
@@ -243,7 +244,7 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
language_server_id,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/consts.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/consts.rs")).unwrap(),
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
range: lsp::Range::new(
|
||||
@@ -356,14 +357,14 @@ async fn test_diagnostics_with_folds(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id_1,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(4, 0), lsp::Position::new(4, 4)),
|
||||
severity: Some(lsp::DiagnosticSeverity::WARNING),
|
||||
message: "no method `tset`".to_string(),
|
||||
related_information: Some(vec![lsp::DiagnosticRelatedInformation {
|
||||
location: lsp::Location::new(
|
||||
lsp::Url::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
lsp::Range::new(
|
||||
lsp::Position::new(0, 9),
|
||||
lsp::Position::new(0, 13),
|
||||
@@ -465,7 +466,7 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id_1,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 0), lsp::Position::new(0, 1)),
|
||||
severity: Some(lsp::DiagnosticSeverity::WARNING),
|
||||
@@ -509,7 +510,7 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id_2,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(1, 0), lsp::Position::new(1, 1)),
|
||||
severity: Some(lsp::DiagnosticSeverity::ERROR),
|
||||
@@ -552,7 +553,7 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id_1,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(2, 0), lsp::Position::new(2, 1)),
|
||||
severity: Some(lsp::DiagnosticSeverity::WARNING),
|
||||
@@ -571,7 +572,7 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id_2,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/main.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/main.rs")).unwrap(),
|
||||
diagnostics: vec![],
|
||||
version: None,
|
||||
},
|
||||
@@ -608,7 +609,7 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id_2,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/test/main.js")).unwrap(),
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(3, 0), lsp::Position::new(3, 1)),
|
||||
severity: Some(lsp::DiagnosticSeverity::WARNING),
|
||||
@@ -745,8 +746,8 @@ async fn test_random_diagnostics_blocks(cx: &mut TestAppContext, mut rng: StdRng
|
||||
.update_diagnostics(
|
||||
server_id,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(&path).unwrap_or_else(|_| {
|
||||
lsp::Url::parse("file:///test/fallback.rs").unwrap()
|
||||
uri: lsp::Uri::from_file_path(&path).unwrap_or_else(|_| {
|
||||
lsp::Uri::from_str("file:///test/fallback.rs").unwrap()
|
||||
}),
|
||||
diagnostics: diagnostics.clone(),
|
||||
version: None,
|
||||
@@ -934,8 +935,8 @@ async fn test_random_diagnostics_with_inlays(cx: &mut TestAppContext, mut rng: S
|
||||
.update_diagnostics(
|
||||
server_id,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(&path).unwrap_or_else(|_| {
|
||||
lsp::Url::parse("file:///test/fallback.rs").unwrap()
|
||||
uri: lsp::Uri::from_file_path(&path).unwrap_or_else(|_| {
|
||||
lsp::Uri::from_str("file:///test/fallback.rs").unwrap()
|
||||
}),
|
||||
diagnostics: diagnostics.clone(),
|
||||
version: None,
|
||||
@@ -985,7 +986,7 @@ async fn active_diagnostics_dismiss_after_invalidation(cx: &mut TestAppContext)
|
||||
.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/root/file")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/file")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(
|
||||
@@ -1028,7 +1029,7 @@ async fn active_diagnostics_dismiss_after_invalidation(cx: &mut TestAppContext)
|
||||
.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/root/file")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/file")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: Vec::new(),
|
||||
},
|
||||
@@ -1078,7 +1079,7 @@ async fn cycle_through_same_place_diagnostics(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/root/file")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/file")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
@@ -1246,7 +1247,7 @@ async fn test_diagnostics_with_links(cx: &mut TestAppContext) {
|
||||
lsp_store.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/root/file")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/file")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 8), lsp::Position::new(0, 12)),
|
||||
@@ -1299,7 +1300,7 @@ async fn test_hover_diagnostic_and_info_popovers(cx: &mut gpui::TestAppContext)
|
||||
lsp_store.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/root/dir/file.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/dir/file.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range,
|
||||
@@ -1376,7 +1377,7 @@ async fn test_diagnostics_with_code(cx: &mut TestAppContext) {
|
||||
let window = cx.add_window(|window, cx| Workspace::test_new(project.clone(), window, cx));
|
||||
let cx = &mut VisualTestContext::from_window(*window, cx);
|
||||
let workspace = window.root(cx).unwrap();
|
||||
let uri = lsp::Url::from_file_path(path!("/root/main.js")).unwrap();
|
||||
let uri = lsp::Uri::from_file_path(path!("/root/main.js")).unwrap();
|
||||
|
||||
// Create diagnostics with code fields
|
||||
lsp_store.update(cx, |lsp_store, cx| {
|
||||
@@ -1460,7 +1461,7 @@ async fn go_to_diagnostic_with_severity(cx: &mut TestAppContext) {
|
||||
.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/root/file")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/file")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
@@ -1673,7 +1674,7 @@ fn random_lsp_diagnostic(
|
||||
);
|
||||
|
||||
related_info.push(lsp::DiagnosticRelatedInformation {
|
||||
location: lsp::Location::new(lsp::Url::from_file_path(path).unwrap(), info_range),
|
||||
location: lsp::Location::new(lsp::Uri::from_file_path(path).unwrap(), info_range),
|
||||
message: format!("related info {i} for diagnostic {unique_id}"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9909,7 +9909,7 @@ async fn test_document_format_during_save(cx: &mut TestAppContext) {
|
||||
move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
assert_eq!(params.options.tab_size, 4);
|
||||
Ok(Some(vec![lsp::TextEdit::new(
|
||||
@@ -9952,7 +9952,7 @@ async fn test_document_format_during_save(cx: &mut TestAppContext) {
|
||||
move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
futures::future::pending::<()>().await;
|
||||
unreachable!()
|
||||
@@ -10000,7 +10000,7 @@ async fn test_document_format_during_save(cx: &mut TestAppContext) {
|
||||
.set_request_handler::<lsp::request::Formatting, _, _>(move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
assert_eq!(params.options.tab_size, 8);
|
||||
Ok(Some(vec![]))
|
||||
@@ -10548,7 +10548,7 @@ async fn test_range_format_on_save_success(cx: &mut TestAppContext) {
|
||||
.set_request_handler::<lsp::request::RangeFormatting, _, _>(move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
assert_eq!(params.options.tab_size, 4);
|
||||
Ok(Some(vec![lsp::TextEdit::new(
|
||||
@@ -10581,7 +10581,7 @@ async fn test_range_format_on_save_timeout(cx: &mut TestAppContext) {
|
||||
move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
futures::future::pending::<()>().await;
|
||||
unreachable!()
|
||||
@@ -10674,7 +10674,7 @@ async fn test_range_format_respects_language_tab_size_override(cx: &mut TestAppC
|
||||
.set_request_handler::<lsp::request::RangeFormatting, _, _>(move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
assert_eq!(params.options.tab_size, 8);
|
||||
Ok(Some(Vec::new()))
|
||||
@@ -10761,7 +10761,7 @@ async fn test_document_format_manual_trigger(cx: &mut TestAppContext) {
|
||||
.set_request_handler::<lsp::request::Formatting, _, _>(move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
assert_eq!(params.options.tab_size, 4);
|
||||
Ok(Some(vec![lsp::TextEdit::new(
|
||||
@@ -10786,7 +10786,7 @@ async fn test_document_format_manual_trigger(cx: &mut TestAppContext) {
|
||||
move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap()
|
||||
);
|
||||
futures::future::pending::<()>().await;
|
||||
unreachable!()
|
||||
@@ -10882,7 +10882,7 @@ async fn test_multiple_formatters(cx: &mut TestAppContext) {
|
||||
params.context.only,
|
||||
Some(vec!["code-action-1".into(), "code-action-2".into()])
|
||||
);
|
||||
let uri = lsp::Url::from_file_path(path!("/file.rs")).unwrap();
|
||||
let uri = lsp::Uri::from_file_path(path!("/file.rs")).unwrap();
|
||||
Ok(Some(vec![
|
||||
lsp::CodeActionOrCommand::CodeAction(lsp::CodeAction {
|
||||
kind: Some("code-action-1".into()),
|
||||
@@ -10942,7 +10942,7 @@ async fn test_multiple_formatters(cx: &mut TestAppContext) {
|
||||
edit: lsp::WorkspaceEdit {
|
||||
changes: Some(
|
||||
[(
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap(),
|
||||
vec![lsp::TextEdit {
|
||||
range: lsp::Range::new(
|
||||
lsp::Position::new(0, 0),
|
||||
@@ -11153,7 +11153,7 @@ async fn test_organize_imports_manual_trigger(cx: &mut TestAppContext) {
|
||||
.set_request_handler::<lsp::request::CodeActionRequest, _, _>(move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.ts")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.ts")).unwrap()
|
||||
);
|
||||
Ok(Some(vec![lsp::CodeActionOrCommand::CodeAction(
|
||||
lsp::CodeAction {
|
||||
@@ -11201,7 +11201,7 @@ async fn test_organize_imports_manual_trigger(cx: &mut TestAppContext) {
|
||||
move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/file.ts")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/file.ts")).unwrap()
|
||||
);
|
||||
futures::future::pending::<()>().await;
|
||||
unreachable!()
|
||||
@@ -15478,7 +15478,7 @@ async fn go_to_prev_overlapping_diagnostic(executor: BackgroundExecutor, cx: &mu
|
||||
.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/root/file")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/root/file")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
@@ -15874,7 +15874,7 @@ async fn test_on_type_formatting_not_triggered(cx: &mut TestAppContext) {
|
||||
|params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document_position.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
assert_eq!(
|
||||
params.text_document_position.position,
|
||||
@@ -16399,7 +16399,7 @@ async fn test_context_menus_hide_hover_popover(cx: &mut gpui::TestAppContext) {
|
||||
edit: Some(lsp::WorkspaceEdit {
|
||||
changes: Some(
|
||||
[(
|
||||
lsp::Url::from_file_path(path!("/file.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/file.rs")).unwrap(),
|
||||
vec![lsp::TextEdit {
|
||||
range: lsp::Range::new(
|
||||
lsp::Position::new(5, 4),
|
||||
@@ -22067,7 +22067,7 @@ async fn test_apply_code_lens_actions_with_commands(cx: &mut gpui::TestAppContex
|
||||
edit: lsp::WorkspaceEdit {
|
||||
changes: Some(
|
||||
[(
|
||||
lsp::Url::from_file_path(path!("/dir/a.ts")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/a.ts")).unwrap(),
|
||||
vec![lsp::TextEdit {
|
||||
range: lsp::Range::new(
|
||||
lsp::Position::new(0, 0),
|
||||
@@ -24039,7 +24039,7 @@ async fn test_pulling_diagnostics(cx: &mut TestAppContext) {
|
||||
let result_id = Some(new_result_id.to_string());
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/first.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/a/first.rs")).unwrap()
|
||||
);
|
||||
async move {
|
||||
Ok(lsp::DocumentDiagnosticReportResult::Report(
|
||||
@@ -24254,7 +24254,7 @@ async fn test_document_colors(cx: &mut TestAppContext) {
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/first.rs")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/a/first.rs")).unwrap()
|
||||
);
|
||||
requests_made.fetch_add(1, atomic::Ordering::Release);
|
||||
Ok(vec![
|
||||
|
||||
@@ -1339,7 +1339,7 @@ pub mod tests {
|
||||
let i = task_lsp_request_count.fetch_add(1, Ordering::Release) + 1;
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(file_with_hints).unwrap(),
|
||||
lsp::Uri::from_file_path(file_with_hints).unwrap(),
|
||||
);
|
||||
Ok(Some(vec![lsp::InlayHint {
|
||||
position: lsp::Position::new(0, i),
|
||||
@@ -1449,7 +1449,7 @@ pub mod tests {
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(file_with_hints).unwrap(),
|
||||
lsp::Uri::from_file_path(file_with_hints).unwrap(),
|
||||
);
|
||||
let current_call_id =
|
||||
Arc::clone(&task_lsp_request_count).fetch_add(1, Ordering::SeqCst);
|
||||
@@ -1594,7 +1594,7 @@ pub mod tests {
|
||||
"Rust" => {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs"))
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs"))
|
||||
.unwrap(),
|
||||
);
|
||||
rs_lsp_request_count.fetch_add(1, Ordering::Release)
|
||||
@@ -1603,7 +1603,7 @@ pub mod tests {
|
||||
"Markdown" => {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/other.md"))
|
||||
lsp::Uri::from_file_path(path!("/a/other.md"))
|
||||
.unwrap(),
|
||||
);
|
||||
md_lsp_request_count.fetch_add(1, Ordering::Release)
|
||||
@@ -1789,7 +1789,7 @@ pub mod tests {
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(file_with_hints).unwrap(),
|
||||
lsp::Uri::from_file_path(file_with_hints).unwrap(),
|
||||
);
|
||||
Ok(Some(vec![
|
||||
lsp::InlayHint {
|
||||
@@ -2127,7 +2127,7 @@ pub mod tests {
|
||||
let i = lsp_request_count.fetch_add(1, Ordering::SeqCst) + 1;
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(file_with_hints).unwrap(),
|
||||
lsp::Uri::from_file_path(file_with_hints).unwrap(),
|
||||
);
|
||||
Ok(Some(vec![lsp::InlayHint {
|
||||
position: lsp::Position::new(0, i),
|
||||
@@ -2290,7 +2290,7 @@ pub mod tests {
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
|
||||
task_lsp_request_ranges.lock().push(params.range);
|
||||
@@ -2633,11 +2633,11 @@ pub mod tests {
|
||||
let task_editor_edited = Arc::clone(&closure_editor_edited);
|
||||
async move {
|
||||
let hint_text = if params.text_document.uri
|
||||
== lsp::Url::from_file_path(path!("/a/main.rs")).unwrap()
|
||||
== lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap()
|
||||
{
|
||||
"main hint"
|
||||
} else if params.text_document.uri
|
||||
== lsp::Url::from_file_path(path!("/a/other.rs")).unwrap()
|
||||
== lsp::Uri::from_file_path(path!("/a/other.rs")).unwrap()
|
||||
{
|
||||
"other hint"
|
||||
} else {
|
||||
@@ -2944,11 +2944,11 @@ pub mod tests {
|
||||
let task_editor_edited = Arc::clone(&closure_editor_edited);
|
||||
async move {
|
||||
let hint_text = if params.text_document.uri
|
||||
== lsp::Url::from_file_path(path!("/a/main.rs")).unwrap()
|
||||
== lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap()
|
||||
{
|
||||
"main hint"
|
||||
} else if params.text_document.uri
|
||||
== lsp::Url::from_file_path(path!("/a/other.rs")).unwrap()
|
||||
== lsp::Uri::from_file_path(path!("/a/other.rs")).unwrap()
|
||||
{
|
||||
"other hint"
|
||||
} else {
|
||||
@@ -3116,7 +3116,7 @@ pub mod tests {
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
let query_start = params.range.start;
|
||||
Ok(Some(vec![lsp::InlayHint {
|
||||
@@ -3188,7 +3188,7 @@ pub mod tests {
|
||||
async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(file_with_hints).unwrap(),
|
||||
lsp::Uri::from_file_path(file_with_hints).unwrap(),
|
||||
);
|
||||
|
||||
let i = lsp_request_count.fetch_add(1, Ordering::SeqCst) + 1;
|
||||
@@ -3351,7 +3351,7 @@ pub mod tests {
|
||||
move |params, _| async move {
|
||||
assert_eq!(
|
||||
params.text_document.uri,
|
||||
lsp::Url::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/a/main.rs")).unwrap(),
|
||||
);
|
||||
Ok(Some(
|
||||
serde_json::from_value(json!([
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct EditorLspTestContext {
|
||||
pub cx: EditorTestContext,
|
||||
pub lsp: lsp::FakeLanguageServer,
|
||||
pub workspace: Entity<Workspace>,
|
||||
pub buffer_lsp_url: lsp::Url,
|
||||
pub buffer_lsp_url: lsp::Uri,
|
||||
}
|
||||
|
||||
pub(crate) fn rust_lang() -> Arc<Language> {
|
||||
@@ -189,7 +189,7 @@ impl EditorLspTestContext {
|
||||
},
|
||||
lsp,
|
||||
workspace,
|
||||
buffer_lsp_url: lsp::Url::from_file_path(root.join("dir").join(file_name)).unwrap(),
|
||||
buffer_lsp_url: lsp::Uri::from_file_path(root.join("dir").join(file_name)).unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ impl EditorLspTestContext {
|
||||
where
|
||||
T: 'static + request::Request,
|
||||
T::Params: 'static + Send,
|
||||
F: 'static + Send + FnMut(lsp::Url, T::Params, gpui::AsyncApp) -> Fut,
|
||||
F: 'static + Send + FnMut(lsp::Uri, T::Params, gpui::AsyncApp) -> Fut,
|
||||
Fut: 'static + Future<Output = Result<T::Result>>,
|
||||
{
|
||||
let url = self.buffer_lsp_url.clone();
|
||||
|
||||
@@ -202,7 +202,7 @@ pub struct Diagnostic {
|
||||
pub source: Option<String>,
|
||||
/// A machine-readable code that identifies this diagnostic.
|
||||
pub code: Option<NumberOrString>,
|
||||
pub code_description: Option<lsp::Url>,
|
||||
pub code_description: Option<lsp::Uri>,
|
||||
/// Whether this diagnostic is a hint, warning, or error.
|
||||
pub severity: DiagnosticSeverity,
|
||||
/// The human-readable message associated with this diagnostic.
|
||||
|
||||
@@ -431,7 +431,7 @@ pub fn deserialize_diagnostics(
|
||||
code: diagnostic.code.map(lsp::NumberOrString::from_string),
|
||||
code_description: diagnostic
|
||||
.code_description
|
||||
.and_then(|s| lsp::Url::parse(&s).ok()),
|
||||
.and_then(|s| lsp::Uri::from_str(&s).ok()),
|
||||
is_primary: diagnostic.is_primary,
|
||||
is_disk_based: diagnostic.is_disk_based,
|
||||
is_unnecessary: diagnostic.is_unnecessary,
|
||||
|
||||
@@ -1058,7 +1058,7 @@ mod tests {
|
||||
#[gpui::test]
|
||||
async fn test_process_rust_diagnostics() {
|
||||
let mut params = lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/a")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/a")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![
|
||||
// no newlines
|
||||
|
||||
+19
-19
@@ -100,8 +100,8 @@ pub struct LanguageServer {
|
||||
io_tasks: Mutex<Option<(Task<Option<()>>, Task<Option<()>>)>>,
|
||||
output_done_rx: Mutex<Option<barrier::Receiver>>,
|
||||
server: Arc<Mutex<Option<Child>>>,
|
||||
workspace_folders: Option<Arc<Mutex<BTreeSet<Url>>>>,
|
||||
root_uri: Url,
|
||||
workspace_folders: Option<Arc<Mutex<BTreeSet<Uri>>>>,
|
||||
root_uri: Uri,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
@@ -310,7 +310,7 @@ impl LanguageServer {
|
||||
binary: LanguageServerBinary,
|
||||
root_path: &Path,
|
||||
code_action_kinds: Option<Vec<CodeActionKind>>,
|
||||
workspace_folders: Option<Arc<Mutex<BTreeSet<Url>>>>,
|
||||
workspace_folders: Option<Arc<Mutex<BTreeSet<Uri>>>>,
|
||||
cx: &mut AsyncApp,
|
||||
) -> Result<Self> {
|
||||
let working_dir = if root_path.is_dir() {
|
||||
@@ -318,7 +318,7 @@ impl LanguageServer {
|
||||
} else {
|
||||
root_path.parent().unwrap_or_else(|| Path::new("/"))
|
||||
};
|
||||
let root_uri = Url::from_file_path(&working_dir)
|
||||
let root_uri = Uri::from_file_path(&working_dir)
|
||||
.map_err(|()| anyhow!("{working_dir:?} is not a valid URI"))?;
|
||||
|
||||
log::info!(
|
||||
@@ -384,8 +384,8 @@ impl LanguageServer {
|
||||
server: Option<Child>,
|
||||
code_action_kinds: Option<Vec<CodeActionKind>>,
|
||||
binary: LanguageServerBinary,
|
||||
root_uri: Url,
|
||||
workspace_folders: Option<Arc<Mutex<BTreeSet<Url>>>>,
|
||||
root_uri: Uri,
|
||||
workspace_folders: Option<Arc<Mutex<BTreeSet<Uri>>>>,
|
||||
cx: &mut AsyncApp,
|
||||
on_unhandled_notification: F,
|
||||
) -> Self
|
||||
@@ -1350,7 +1350,7 @@ impl LanguageServer {
|
||||
}
|
||||
|
||||
/// Add new workspace folder to the list.
|
||||
pub fn add_workspace_folder(&self, uri: Url) {
|
||||
pub fn add_workspace_folder(&self, uri: Uri) {
|
||||
if self
|
||||
.capabilities()
|
||||
.workspace
|
||||
@@ -1385,7 +1385,7 @@ impl LanguageServer {
|
||||
}
|
||||
|
||||
/// Remove existing workspace folder from the list.
|
||||
pub fn remove_workspace_folder(&self, uri: Url) {
|
||||
pub fn remove_workspace_folder(&self, uri: Uri) {
|
||||
if self
|
||||
.capabilities()
|
||||
.workspace
|
||||
@@ -1417,7 +1417,7 @@ impl LanguageServer {
|
||||
self.notify::<DidChangeWorkspaceFolders>(¶ms).ok();
|
||||
}
|
||||
}
|
||||
pub fn set_workspace_folders(&self, folders: BTreeSet<Url>) {
|
||||
pub fn set_workspace_folders(&self, folders: BTreeSet<Uri>) {
|
||||
let Some(workspace_folders) = self.workspace_folders.as_ref() else {
|
||||
return;
|
||||
};
|
||||
@@ -1450,7 +1450,7 @@ impl LanguageServer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn workspace_folders(&self) -> BTreeSet<Url> {
|
||||
pub fn workspace_folders(&self) -> BTreeSet<Uri> {
|
||||
self.workspace_folders.as_ref().map_or_else(
|
||||
|| BTreeSet::from_iter([self.root_uri.clone()]),
|
||||
|folders| folders.lock().clone(),
|
||||
@@ -1459,7 +1459,7 @@ impl LanguageServer {
|
||||
|
||||
pub fn register_buffer(
|
||||
&self,
|
||||
uri: Url,
|
||||
uri: Uri,
|
||||
language_id: String,
|
||||
version: i32,
|
||||
initial_text: String,
|
||||
@@ -1470,7 +1470,7 @@ impl LanguageServer {
|
||||
.ok();
|
||||
}
|
||||
|
||||
pub fn unregister_buffer(&self, uri: Url) {
|
||||
pub fn unregister_buffer(&self, uri: Uri) {
|
||||
self.notify::<notification::DidCloseTextDocument>(&DidCloseTextDocumentParams {
|
||||
text_document: TextDocumentIdentifier::new(uri),
|
||||
})
|
||||
@@ -1587,7 +1587,7 @@ impl FakeLanguageServer {
|
||||
let server_name = LanguageServerName(name.clone().into());
|
||||
let process_name = Arc::from(name.as_str());
|
||||
let root = Self::root_path();
|
||||
let workspace_folders: Arc<Mutex<BTreeSet<Url>>> = Default::default();
|
||||
let workspace_folders: Arc<Mutex<BTreeSet<Uri>>> = Default::default();
|
||||
let mut server = LanguageServer::new_internal(
|
||||
server_id,
|
||||
server_name.clone(),
|
||||
@@ -1657,13 +1657,13 @@ impl FakeLanguageServer {
|
||||
(server, fake)
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
fn root_path() -> Url {
|
||||
Url::from_file_path("C:/").unwrap()
|
||||
fn root_path() -> Uri {
|
||||
Uri::from_file_path("C:/").unwrap()
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn root_path() -> Url {
|
||||
Url::from_file_path("/").unwrap()
|
||||
fn root_path() -> Uri {
|
||||
Uri::from_file_path("/").unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1865,7 +1865,7 @@ mod tests {
|
||||
server
|
||||
.notify::<notification::DidOpenTextDocument>(&DidOpenTextDocumentParams {
|
||||
text_document: TextDocumentItem::new(
|
||||
Url::from_str("file://a/b").unwrap(),
|
||||
Uri::from_str("file://a/b").unwrap(),
|
||||
"rust".to_string(),
|
||||
0,
|
||||
"".to_string(),
|
||||
@@ -1886,7 +1886,7 @@ mod tests {
|
||||
message: "ok".to_string(),
|
||||
});
|
||||
fake.notify::<notification::PublishDiagnostics>(&PublishDiagnosticsParams {
|
||||
uri: Url::from_str("file://b/c").unwrap(),
|
||||
uri: Uri::from_str("file://b/c").unwrap(),
|
||||
version: Some(5),
|
||||
diagnostics: vec![],
|
||||
});
|
||||
|
||||
@@ -50,8 +50,8 @@ pub fn lsp_formatting_options(settings: &LanguageSettings) -> lsp::FormattingOpt
|
||||
}
|
||||
}
|
||||
|
||||
pub fn file_path_to_lsp_url(path: &Path) -> Result<lsp::Url> {
|
||||
match lsp::Url::from_file_path(path) {
|
||||
pub fn file_path_to_lsp_url(path: &Path) -> Result<lsp::Uri> {
|
||||
match lsp::Uri::from_file_path(path) {
|
||||
Ok(url) => Ok(url),
|
||||
Err(()) => anyhow::bail!("Invalid file path provided to LSP request: {path:?}"),
|
||||
}
|
||||
@@ -3135,7 +3135,7 @@ impl InlayHints {
|
||||
Some(((uri, range), server_id)) => Some((
|
||||
LanguageServerId(server_id as usize),
|
||||
lsp::Location {
|
||||
uri: lsp::Url::parse(&uri)
|
||||
uri: lsp::Uri::from_str(&uri)
|
||||
.context("invalid uri in hint part {part:?}")?,
|
||||
range: lsp::Range::new(
|
||||
point_to_lsp(PointUtf16::new(
|
||||
@@ -3733,7 +3733,7 @@ impl GetDocumentDiagnostics {
|
||||
.filter_map(|diagnostics| {
|
||||
Some(LspPullDiagnostics::Response {
|
||||
server_id: LanguageServerId::from_proto(diagnostics.server_id),
|
||||
uri: lsp::Url::from_str(diagnostics.uri.as_str()).log_err()?,
|
||||
uri: lsp::Uri::from_str(diagnostics.uri.as_str()).log_err()?,
|
||||
diagnostics: if diagnostics.changed {
|
||||
PulledDiagnostics::Unchanged {
|
||||
result_id: diagnostics.result_id?,
|
||||
@@ -3788,7 +3788,7 @@ impl GetDocumentDiagnostics {
|
||||
start: point_to_lsp(PointUtf16::new(start.row, start.column)),
|
||||
end: point_to_lsp(PointUtf16::new(end.row, end.column)),
|
||||
},
|
||||
uri: lsp::Url::parse(&info.location_url.unwrap()).unwrap(),
|
||||
uri: lsp::Uri::from_str(&info.location_url.unwrap()).unwrap(),
|
||||
},
|
||||
message: info.message,
|
||||
}
|
||||
@@ -3821,7 +3821,7 @@ impl GetDocumentDiagnostics {
|
||||
code_description: diagnostic
|
||||
.code_description
|
||||
.map(|code_description| CodeDescription {
|
||||
href: Some(lsp::Url::parse(&code_description).unwrap()),
|
||||
href: Some(lsp::Uri::from_str(&code_description).unwrap()),
|
||||
}),
|
||||
related_information: Some(related_information),
|
||||
tags: Some(tags),
|
||||
@@ -3961,7 +3961,7 @@ pub struct WorkspaceLspPullDiagnostics {
|
||||
}
|
||||
|
||||
fn process_full_workspace_diagnostics_report(
|
||||
diagnostics: &mut HashMap<lsp::Url, WorkspaceLspPullDiagnostics>,
|
||||
diagnostics: &mut HashMap<lsp::Uri, WorkspaceLspPullDiagnostics>,
|
||||
server_id: LanguageServerId,
|
||||
report: lsp::WorkspaceFullDocumentDiagnosticReport,
|
||||
) {
|
||||
@@ -3984,7 +3984,7 @@ fn process_full_workspace_diagnostics_report(
|
||||
}
|
||||
|
||||
fn process_unchanged_workspace_diagnostics_report(
|
||||
diagnostics: &mut HashMap<lsp::Url, WorkspaceLspPullDiagnostics>,
|
||||
diagnostics: &mut HashMap<lsp::Uri, WorkspaceLspPullDiagnostics>,
|
||||
server_id: LanguageServerId,
|
||||
report: lsp::WorkspaceUnchangedDocumentDiagnosticReport,
|
||||
) {
|
||||
@@ -4343,9 +4343,9 @@ impl LspCommand for GetDocumentColor {
|
||||
}
|
||||
|
||||
fn process_related_documents(
|
||||
diagnostics: &mut HashMap<lsp::Url, LspPullDiagnostics>,
|
||||
diagnostics: &mut HashMap<lsp::Uri, LspPullDiagnostics>,
|
||||
server_id: LanguageServerId,
|
||||
documents: impl IntoIterator<Item = (lsp::Url, lsp::DocumentDiagnosticReportKind)>,
|
||||
documents: impl IntoIterator<Item = (lsp::Uri, lsp::DocumentDiagnosticReportKind)>,
|
||||
) {
|
||||
for (url, report_kind) in documents {
|
||||
match report_kind {
|
||||
@@ -4360,9 +4360,9 @@ fn process_related_documents(
|
||||
}
|
||||
|
||||
fn process_unchanged_diagnostics_report(
|
||||
diagnostics: &mut HashMap<lsp::Url, LspPullDiagnostics>,
|
||||
diagnostics: &mut HashMap<lsp::Uri, LspPullDiagnostics>,
|
||||
server_id: LanguageServerId,
|
||||
uri: lsp::Url,
|
||||
uri: lsp::Uri,
|
||||
report: lsp::UnchangedDocumentDiagnosticReport,
|
||||
) {
|
||||
let result_id = report.result_id;
|
||||
@@ -4404,9 +4404,9 @@ fn process_unchanged_diagnostics_report(
|
||||
}
|
||||
|
||||
fn process_full_diagnostics_report(
|
||||
diagnostics: &mut HashMap<lsp::Url, LspPullDiagnostics>,
|
||||
diagnostics: &mut HashMap<lsp::Uri, LspPullDiagnostics>,
|
||||
server_id: LanguageServerId,
|
||||
uri: lsp::Url,
|
||||
uri: lsp::Uri,
|
||||
report: lsp::FullDocumentDiagnosticReport,
|
||||
) {
|
||||
let result_id = report.result_id;
|
||||
@@ -4540,7 +4540,7 @@ mod tests {
|
||||
fn test_related_information() {
|
||||
let related_info = lsp::DiagnosticRelatedInformation {
|
||||
location: lsp::Location {
|
||||
uri: lsp::Url::parse("file:///test.rs").unwrap(),
|
||||
uri: lsp::Uri::from_str("file:///test.rs").unwrap(),
|
||||
range: lsp::Range {
|
||||
start: lsp::Position::new(1, 1),
|
||||
end: lsp::Position::new(1, 5),
|
||||
|
||||
@@ -79,7 +79,7 @@ use lsp::{
|
||||
LSP_REQUEST_TIMEOUT, LanguageServer, LanguageServerBinary, LanguageServerBinaryOptions,
|
||||
LanguageServerId, LanguageServerName, LanguageServerSelector, LspRequestFuture,
|
||||
MessageActionItem, MessageType, OneOf, RenameFilesParams, SymbolKind,
|
||||
TextDocumentSyncSaveOptions, TextEdit, WillRenameFiles, WorkDoneProgressCancelParams,
|
||||
TextDocumentSyncSaveOptions, TextEdit, Uri, WillRenameFiles, WorkDoneProgressCancelParams,
|
||||
WorkspaceFolder, notification::DidRenameFiles,
|
||||
};
|
||||
use node_runtime::read_package_installed_version;
|
||||
@@ -114,7 +114,7 @@ use std::{
|
||||
};
|
||||
use sum_tree::Dimensions;
|
||||
use text::{Anchor, BufferId, LineEnding, OffsetRangeExt};
|
||||
use url::Url;
|
||||
|
||||
use util::{
|
||||
ConnectionResult, ResultExt as _, debug_panic, defer, maybe, merge_json_value_into,
|
||||
paths::{PathExt, SanitizedPath},
|
||||
@@ -314,7 +314,7 @@ impl LocalLspStore {
|
||||
true,
|
||||
cx,
|
||||
);
|
||||
let pending_workspace_folders: Arc<Mutex<BTreeSet<Url>>> = Default::default();
|
||||
let pending_workspace_folders: Arc<Mutex<BTreeSet<Uri>>> = Default::default();
|
||||
|
||||
let pending_server = cx.spawn({
|
||||
let adapter = adapter.clone();
|
||||
@@ -2405,7 +2405,7 @@ impl LocalLspStore {
|
||||
|
||||
{
|
||||
let uri =
|
||||
Url::from_file_path(worktree.read(cx).abs_path().join(&path.path));
|
||||
Uri::from_file_path(worktree.read(cx).abs_path().join(&path.path));
|
||||
|
||||
let server_id = self.get_or_insert_language_server(
|
||||
&worktree,
|
||||
@@ -2565,7 +2565,7 @@ impl LocalLspStore {
|
||||
None => return,
|
||||
};
|
||||
|
||||
let Ok(file_url) = lsp::Url::from_file_path(old_path.as_path()) else {
|
||||
let Ok(file_url) = lsp::Uri::from_file_path(old_path.as_path()) else {
|
||||
debug_panic!(
|
||||
"`{}` is not parseable as an URI",
|
||||
old_path.to_string_lossy()
|
||||
@@ -2578,7 +2578,7 @@ impl LocalLspStore {
|
||||
pub(crate) fn unregister_buffer_from_language_servers(
|
||||
&mut self,
|
||||
buffer: &Entity<Buffer>,
|
||||
file_url: &lsp::Url,
|
||||
file_url: &lsp::Uri,
|
||||
cx: &mut App,
|
||||
) {
|
||||
buffer.update(cx, |buffer, cx| {
|
||||
@@ -4694,7 +4694,7 @@ impl LspStore {
|
||||
for node in nodes {
|
||||
let server_id = node.server_id_or_init(|disposition| {
|
||||
let path = &disposition.path;
|
||||
let uri = Url::from_file_path(worktree_root.join(&path.path));
|
||||
let uri = Uri::from_file_path(worktree_root.join(&path.path));
|
||||
let key = LanguageServerSeed {
|
||||
worktree_id,
|
||||
name: disposition.server_name.clone(),
|
||||
@@ -6578,7 +6578,7 @@ impl LspStore {
|
||||
File::from_dyn(buffer.file())
|
||||
.and_then(|file| {
|
||||
let abs_path = file.as_local()?.abs_path(cx);
|
||||
lsp::Url::from_file_path(abs_path).ok()
|
||||
lsp::Uri::from_file_path(abs_path).ok()
|
||||
})
|
||||
.is_none_or(|buffer_uri| {
|
||||
unchanged_buffers.contains(&buffer_uri)
|
||||
@@ -7179,7 +7179,7 @@ impl LspStore {
|
||||
let buffer = buffer.read(cx);
|
||||
let file = File::from_dyn(buffer.file())?;
|
||||
let abs_path = file.as_local()?.abs_path(cx);
|
||||
let uri = lsp::Url::from_file_path(abs_path).unwrap();
|
||||
let uri = lsp::Uri::from_file_path(abs_path).unwrap();
|
||||
let next_snapshot = buffer.text_snapshot();
|
||||
for language_server in language_servers {
|
||||
let language_server = language_server.clone();
|
||||
@@ -7816,7 +7816,7 @@ impl LspStore {
|
||||
};
|
||||
|
||||
let symbol_abs_path = resolve_path(&worktree_abs_path, &symbol.path.path);
|
||||
let symbol_uri = if let Ok(uri) = lsp::Url::from_file_path(symbol_abs_path) {
|
||||
let symbol_uri = if let Ok(uri) = lsp::Uri::from_file_path(symbol_abs_path) {
|
||||
uri
|
||||
} else {
|
||||
return Task::ready(Err(anyhow!("invalid symbol path")));
|
||||
@@ -7830,14 +7830,14 @@ impl LspStore {
|
||||
|
||||
pub(crate) fn open_local_buffer_via_lsp(
|
||||
&mut self,
|
||||
mut abs_path: lsp::Url,
|
||||
abs_path: lsp::Uri,
|
||||
language_server_id: LanguageServerId,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<Entity<Buffer>>> {
|
||||
cx.spawn(async move |lsp_store, cx| {
|
||||
// Escape percent-encoded string.
|
||||
let current_scheme = abs_path.scheme().to_owned();
|
||||
let _ = abs_path.set_scheme("file");
|
||||
// Uri is immutable, so we can't modify the scheme
|
||||
|
||||
let abs_path = abs_path
|
||||
.to_file_path()
|
||||
@@ -9230,8 +9230,12 @@ impl LspStore {
|
||||
maybe!({
|
||||
let local_store = self.as_local()?;
|
||||
|
||||
let old_uri = lsp::Url::from_file_path(old_path).ok().map(String::from)?;
|
||||
let new_uri = lsp::Url::from_file_path(new_path).ok().map(String::from)?;
|
||||
let old_uri = lsp::Uri::from_file_path(old_path)
|
||||
.ok()
|
||||
.map(|uri| uri.to_string())?;
|
||||
let new_uri = lsp::Uri::from_file_path(new_path)
|
||||
.ok()
|
||||
.map(|uri| uri.to_string())?;
|
||||
|
||||
for language_server in local_store.language_servers_for_worktree(worktree_id) {
|
||||
let Some(filter) = local_store
|
||||
@@ -9264,8 +9268,12 @@ impl LspStore {
|
||||
is_dir: bool,
|
||||
cx: AsyncApp,
|
||||
) -> Task<ProjectTransaction> {
|
||||
let old_uri = lsp::Url::from_file_path(old_path).ok().map(String::from);
|
||||
let new_uri = lsp::Url::from_file_path(new_path).ok().map(String::from);
|
||||
let old_uri = lsp::Uri::from_file_path(old_path)
|
||||
.ok()
|
||||
.map(|uri| uri.to_string());
|
||||
let new_uri = lsp::Uri::from_file_path(new_path)
|
||||
.ok()
|
||||
.map(|uri| uri.to_string());
|
||||
cx.spawn(async move |cx| {
|
||||
let mut tasks = vec![];
|
||||
this.update(cx, |this, cx| {
|
||||
@@ -10878,7 +10886,7 @@ impl LspStore {
|
||||
language_server: Arc<LanguageServer>,
|
||||
server_id: LanguageServerId,
|
||||
key: LanguageServerSeed,
|
||||
workspace_folders: Arc<Mutex<BTreeSet<Url>>>,
|
||||
workspace_folders: Arc<Mutex<BTreeSet<Uri>>>,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let Some(local) = self.as_local_mut() else {
|
||||
@@ -11038,7 +11046,7 @@ impl LspStore {
|
||||
let snapshot = versions.last().unwrap();
|
||||
let version = snapshot.version;
|
||||
let initial_snapshot = &snapshot.snapshot;
|
||||
let uri = lsp::Url::from_file_path(file.abs_path(cx)).unwrap();
|
||||
let uri = lsp::Uri::from_file_path(file.abs_path(cx)).unwrap();
|
||||
language_server.register_buffer(
|
||||
uri,
|
||||
adapter.language_id(&language.name()),
|
||||
@@ -11277,7 +11285,7 @@ impl LspStore {
|
||||
PathChange::AddedOrUpdated => lsp::FileChangeType::CHANGED,
|
||||
};
|
||||
Some(lsp::FileEvent {
|
||||
uri: lsp::Url::from_file_path(abs_path.join(path)).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(abs_path.join(path)).unwrap(),
|
||||
typ,
|
||||
})
|
||||
})
|
||||
@@ -11689,7 +11697,7 @@ impl LspStore {
|
||||
File::from_dyn(buffer.file())
|
||||
.and_then(|file| {
|
||||
let abs_path = file.as_local()?.abs_path(cx);
|
||||
lsp::Url::from_file_path(abs_path).ok()
|
||||
lsp::Uri::from_file_path(abs_path).ok()
|
||||
})
|
||||
.is_none_or(|buffer_uri| {
|
||||
unchanged_buffers.contains(&buffer_uri)
|
||||
@@ -12821,7 +12829,7 @@ pub enum LanguageServerState {
|
||||
Starting {
|
||||
startup: Task<Option<Arc<LanguageServer>>>,
|
||||
/// List of language servers that will be added to the workspace once it's initialization completes.
|
||||
pending_workspace_folders: Arc<Mutex<BTreeSet<Url>>>,
|
||||
pending_workspace_folders: Arc<Mutex<BTreeSet<Uri>>>,
|
||||
},
|
||||
|
||||
Running {
|
||||
@@ -12833,7 +12841,7 @@ pub enum LanguageServerState {
|
||||
}
|
||||
|
||||
impl LanguageServerState {
|
||||
fn add_workspace_folder(&self, uri: Url) {
|
||||
fn add_workspace_folder(&self, uri: Uri) {
|
||||
match self {
|
||||
LanguageServerState::Starting {
|
||||
pending_workspace_folders,
|
||||
@@ -12846,7 +12854,7 @@ impl LanguageServerState {
|
||||
}
|
||||
}
|
||||
}
|
||||
fn _remove_workspace_folder(&self, uri: Url) {
|
||||
fn _remove_workspace_folder(&self, uri: Uri) {
|
||||
match self {
|
||||
LanguageServerState::Starting {
|
||||
pending_workspace_folders,
|
||||
|
||||
@@ -213,7 +213,7 @@ impl LspCommand for OpenDocs {
|
||||
) -> Result<OpenDocsParams> {
|
||||
Ok(OpenDocsParams {
|
||||
text_document: lsp::TextDocumentIdentifier {
|
||||
uri: lsp::Url::from_file_path(path).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path).unwrap(),
|
||||
},
|
||||
position: point_to_lsp(self.position),
|
||||
})
|
||||
|
||||
@@ -930,7 +930,7 @@ pub enum LspPullDiagnostics {
|
||||
/// The id of the language server that produced diagnostics.
|
||||
server_id: LanguageServerId,
|
||||
/// URI of the resource,
|
||||
uri: lsp::Url,
|
||||
uri: lsp::Uri,
|
||||
/// The diagnostics produced by this language server.
|
||||
diagnostics: PulledDiagnostics,
|
||||
},
|
||||
@@ -3599,7 +3599,7 @@ impl Project {
|
||||
|
||||
pub fn open_local_buffer_via_lsp(
|
||||
&mut self,
|
||||
abs_path: lsp::Url,
|
||||
abs_path: lsp::Uri,
|
||||
language_server_id: LanguageServerId,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<Entity<Buffer>>> {
|
||||
|
||||
@@ -18,7 +18,6 @@ use git::{
|
||||
};
|
||||
use git2::RepositoryInitOptions;
|
||||
use gpui::{App, BackgroundExecutor, SemanticVersion, UpdateGlobal};
|
||||
use http_client::Url;
|
||||
use itertools::Itertools;
|
||||
use language::{
|
||||
Diagnostic, DiagnosticEntry, DiagnosticSet, DiagnosticSourceKind, DiskState, FakeLspAdapter,
|
||||
@@ -29,7 +28,7 @@ use language::{
|
||||
};
|
||||
use lsp::{
|
||||
DiagnosticSeverity, DocumentChanges, FileOperationFilter, NumberOrString, TextDocumentEdit,
|
||||
WillRenameFiles, notification::DidRenameFiles,
|
||||
Uri, WillRenameFiles, notification::DidRenameFiles,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use paths::{config_dir, tasks_file};
|
||||
@@ -701,7 +700,7 @@ async fn test_running_multiple_instances_of_a_single_server_in_one_worktree(
|
||||
assert_eq!(
|
||||
server.workspace_folders(),
|
||||
BTreeSet::from_iter(
|
||||
[Url::from_file_path(path!("/the-root/project-a")).unwrap()].into_iter()
|
||||
[Uri::from_file_path(path!("/the-root/project-a")).unwrap()].into_iter()
|
||||
)
|
||||
);
|
||||
|
||||
@@ -891,7 +890,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/test.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/test.rs")).unwrap(),
|
||||
version: 0,
|
||||
text: "const A: i32 = 1;".to_string(),
|
||||
language_id: "rust".to_string(),
|
||||
@@ -921,7 +920,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::VersionedTextDocumentIdentifier::new(
|
||||
lsp::Url::from_file_path(path!("/dir/test.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/test.rs")).unwrap(),
|
||||
1
|
||||
)
|
||||
);
|
||||
@@ -942,7 +941,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/package.json")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/package.json")).unwrap(),
|
||||
version: 0,
|
||||
text: "{\"a\": 1}".to_string(),
|
||||
language_id: "json".to_string(),
|
||||
@@ -992,7 +991,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::VersionedTextDocumentIdentifier::new(
|
||||
lsp::Url::from_file_path(path!("/dir/test2.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/test2.rs")).unwrap(),
|
||||
1
|
||||
)
|
||||
);
|
||||
@@ -1008,7 +1007,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentIdentifier::new(
|
||||
lsp::Url::from_file_path(path!("/dir/Cargo.toml")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/dir/Cargo.toml")).unwrap()
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -1017,7 +1016,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentIdentifier::new(
|
||||
lsp::Url::from_file_path(path!("/dir/Cargo.toml")).unwrap()
|
||||
lsp::Uri::from_file_path(path!("/dir/Cargo.toml")).unwrap()
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1034,7 +1033,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.receive_notification::<lsp::notification::DidCloseTextDocument>()
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentIdentifier::new(lsp::Url::from_file_path(path!("/dir/test2.rs")).unwrap()),
|
||||
lsp::TextDocumentIdentifier::new(lsp::Uri::from_file_path(path!("/dir/test2.rs")).unwrap()),
|
||||
);
|
||||
assert_eq!(
|
||||
fake_rust_server
|
||||
@@ -1042,7 +1041,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/test3.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/test3.rs")).unwrap(),
|
||||
version: 0,
|
||||
text: rust_buffer2.update(cx, |buffer, _| buffer.text()),
|
||||
language_id: "rust".to_string(),
|
||||
@@ -1084,7 +1083,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.receive_notification::<lsp::notification::DidCloseTextDocument>()
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentIdentifier::new(lsp::Url::from_file_path(path!("/dir/test3.rs")).unwrap()),
|
||||
lsp::TextDocumentIdentifier::new(lsp::Uri::from_file_path(path!("/dir/test3.rs")).unwrap()),
|
||||
);
|
||||
assert_eq!(
|
||||
fake_json_server
|
||||
@@ -1092,7 +1091,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/test3.json")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/test3.json")).unwrap(),
|
||||
version: 0,
|
||||
text: rust_buffer2.update(cx, |buffer, _| buffer.text()),
|
||||
language_id: "json".to_string(),
|
||||
@@ -1118,7 +1117,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::VersionedTextDocumentIdentifier::new(
|
||||
lsp::Url::from_file_path(path!("/dir/test3.json")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/test3.json")).unwrap(),
|
||||
1
|
||||
)
|
||||
);
|
||||
@@ -1148,7 +1147,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/test.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/test.rs")).unwrap(),
|
||||
version: 0,
|
||||
text: rust_buffer.update(cx, |buffer, _| buffer.text()),
|
||||
language_id: "rust".to_string(),
|
||||
@@ -1169,13 +1168,13 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
],
|
||||
[
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/package.json")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/package.json")).unwrap(),
|
||||
version: 0,
|
||||
text: json_buffer.update(cx, |buffer, _| buffer.text()),
|
||||
language_id: "json".to_string(),
|
||||
},
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/test3.json")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/test3.json")).unwrap(),
|
||||
version: 0,
|
||||
text: rust_buffer2.update(cx, |buffer, _| buffer.text()),
|
||||
language_id: "json".to_string(),
|
||||
@@ -1187,7 +1186,7 @@ async fn test_managing_language_servers(cx: &mut gpui::TestAppContext) {
|
||||
cx.update(|_| drop(_json_handle));
|
||||
let close_message = lsp::DidCloseTextDocumentParams {
|
||||
text_document: lsp::TextDocumentIdentifier::new(
|
||||
lsp::Url::from_file_path(path!("/dir/package.json")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/package.json")).unwrap(),
|
||||
),
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -1316,7 +1315,7 @@ async fn test_reporting_fs_changes_to_language_servers(cx: &mut gpui::TestAppCon
|
||||
let _out_of_worktree_buffer = project
|
||||
.update(cx, |project, cx| {
|
||||
project.open_local_buffer_via_lsp(
|
||||
lsp::Url::from_file_path(path!("/the-registry/dep1/src/dep1.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/the-registry/dep1/src/dep1.rs")).unwrap(),
|
||||
server_id,
|
||||
cx,
|
||||
)
|
||||
@@ -1476,23 +1475,23 @@ async fn test_reporting_fs_changes_to_language_servers(cx: &mut gpui::TestAppCon
|
||||
&*file_changes.lock(),
|
||||
&[
|
||||
lsp::FileEvent {
|
||||
uri: lsp::Url::from_file_path(path!("/the-root/Cargo.lock")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/the-root/Cargo.lock")).unwrap(),
|
||||
typ: lsp::FileChangeType::CHANGED,
|
||||
},
|
||||
lsp::FileEvent {
|
||||
uri: lsp::Url::from_file_path(path!("/the-root/src/b.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/the-root/src/b.rs")).unwrap(),
|
||||
typ: lsp::FileChangeType::DELETED,
|
||||
},
|
||||
lsp::FileEvent {
|
||||
uri: lsp::Url::from_file_path(path!("/the-root/src/c.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/the-root/src/c.rs")).unwrap(),
|
||||
typ: lsp::FileChangeType::CREATED,
|
||||
},
|
||||
lsp::FileEvent {
|
||||
uri: lsp::Url::from_file_path(path!("/the-root/target/y/out/y2.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/the-root/target/y/out/y2.rs")).unwrap(),
|
||||
typ: lsp::FileChangeType::CREATED,
|
||||
},
|
||||
lsp::FileEvent {
|
||||
uri: lsp::Url::from_file_path(path!("/the/stdlib/src/string.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/the/stdlib/src/string.rs")).unwrap(),
|
||||
typ: lsp::FileChangeType::CHANGED,
|
||||
},
|
||||
]
|
||||
@@ -1539,7 +1538,7 @@ async fn test_single_file_worktrees_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 4), lsp::Position::new(0, 5)),
|
||||
@@ -1558,7 +1557,7 @@ async fn test_single_file_worktrees_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
.update_diagnostics(
|
||||
LanguageServerId(0),
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/dir/b.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/dir/b.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 4), lsp::Position::new(0, 5)),
|
||||
@@ -1650,7 +1649,7 @@ async fn test_omitted_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/root/dir/b.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/root/dir/b.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 4), lsp::Position::new(0, 5)),
|
||||
@@ -1669,7 +1668,7 @@ async fn test_omitted_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
.update_diagnostics(
|
||||
server_id,
|
||||
lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/root/other.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/root/other.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 8), lsp::Position::new(0, 9)),
|
||||
@@ -1813,7 +1812,7 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
|
||||
);
|
||||
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 9), lsp::Position::new(0, 10)),
|
||||
@@ -1866,7 +1865,7 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
|
||||
|
||||
// Ensure publishing empty diagnostics twice only results in one update event.
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: Default::default(),
|
||||
});
|
||||
@@ -1879,7 +1878,7 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
|
||||
);
|
||||
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: Default::default(),
|
||||
});
|
||||
@@ -2011,7 +2010,7 @@ async fn test_restarting_server_with_diagnostics_published(cx: &mut gpui::TestAp
|
||||
// Publish diagnostics
|
||||
let fake_server = fake_servers.next().await.unwrap();
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
range: lsp::Range::new(lsp::Position::new(0, 0), lsp::Position::new(0, 0)),
|
||||
@@ -2092,7 +2091,7 @@ async fn test_restarted_server_reporting_invalid_buffer_version(cx: &mut gpui::T
|
||||
// Before restarting the server, report diagnostics with an unknown buffer version.
|
||||
let fake_server = fake_servers.next().await.unwrap();
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: Some(10000),
|
||||
diagnostics: Vec::new(),
|
||||
});
|
||||
@@ -2343,7 +2342,7 @@ async fn test_transforming_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
|
||||
// Report some diagnostics for the initial version of the buffer
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: Some(open_notification.text_document.version),
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
@@ -2431,7 +2430,7 @@ async fn test_transforming_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
|
||||
// Ensure overlapping diagnostics are highlighted correctly.
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: Some(open_notification.text_document.version),
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
@@ -2525,7 +2524,7 @@ async fn test_transforming_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
|
||||
// Handle out-of-order diagnostics
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
version: Some(change_notification_2.text_document.version),
|
||||
diagnostics: vec![
|
||||
lsp::Diagnostic {
|
||||
@@ -3206,7 +3205,7 @@ async fn test_definition(cx: &mut gpui::TestAppContext) {
|
||||
|
||||
Ok(Some(lsp::GotoDefinitionResponse::Scalar(
|
||||
lsp::Location::new(
|
||||
lsp::Url::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/a.rs")).unwrap(),
|
||||
lsp::Range::new(lsp::Position::new(0, 9), lsp::Position::new(0, 10)),
|
||||
),
|
||||
)))
|
||||
@@ -3765,7 +3764,7 @@ async fn test_apply_code_actions_with_commands(cx: &mut gpui::TestAppContext) {
|
||||
edit: lsp::WorkspaceEdit {
|
||||
changes: Some(
|
||||
[(
|
||||
lsp::Url::from_file_path(path!("/dir/a.ts")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/a.ts")).unwrap(),
|
||||
vec![lsp::TextEdit {
|
||||
range: lsp::Range::new(
|
||||
lsp::Position::new(0, 0),
|
||||
@@ -3904,7 +3903,7 @@ async fn test_save_file_spawns_language_server(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.text_document,
|
||||
lsp::TextDocumentItem {
|
||||
uri: lsp::Url::from_file_path(path!("/dir/file.rs")).unwrap(),
|
||||
uri: lsp::Uri::from_file_path(path!("/dir/file.rs")).unwrap(),
|
||||
version: 0,
|
||||
text: "".to_string(),
|
||||
language_id: "rust".to_string(),
|
||||
@@ -4742,7 +4741,7 @@ async fn test_grouped_diagnostics(cx: &mut gpui::TestAppContext) {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let buffer_uri = Url::from_file_path(path!("/dir/a.rs")).unwrap();
|
||||
let buffer_uri = Uri::from_file_path(path!("/dir/a.rs")).unwrap();
|
||||
let message = lsp::PublishDiagnosticsParams {
|
||||
uri: buffer_uri.clone(),
|
||||
diagnostics: vec![
|
||||
@@ -5064,7 +5063,7 @@ async fn test_lsp_rename_notifications(cx: &mut gpui::TestAppContext) {
|
||||
new_text: "This is not a drill".to_owned(),
|
||||
})],
|
||||
text_document: lsp::OptionalVersionedTextDocumentIdentifier {
|
||||
uri: Url::from_str(uri!("file:///dir/two/two.rs")).unwrap(),
|
||||
uri: Uri::from_str(uri!("file:///dir/two/two.rs")).unwrap(),
|
||||
version: Some(1337),
|
||||
},
|
||||
}]
|
||||
@@ -5189,14 +5188,14 @@ async fn test_rename(cx: &mut gpui::TestAppContext) {
|
||||
changes: Some(
|
||||
[
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/dir/one.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/one.rs")).unwrap(),
|
||||
vec![lsp::TextEdit::new(
|
||||
lsp::Range::new(lsp::Position::new(0, 6), lsp::Position::new(0, 9)),
|
||||
"THREE".to_string(),
|
||||
)],
|
||||
),
|
||||
(
|
||||
lsp::Url::from_file_path(path!("/dir/two.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/dir/two.rs")).unwrap(),
|
||||
vec![
|
||||
lsp::TextEdit::new(
|
||||
lsp::Range::new(
|
||||
|
||||
@@ -437,7 +437,7 @@ mod tests {
|
||||
deprecated: None,
|
||||
container_name: None,
|
||||
location: lsp::Location::new(
|
||||
lsp::Url::from_file_path(path.as_ref()).unwrap(),
|
||||
lsp::Uri::from_file_path(path.as_ref()).unwrap(),
|
||||
lsp::Range::new(lsp::Position::new(0, 0), lsp::Position::new(0, 0)),
|
||||
),
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ async fn test_remote_lsp(cx: &mut TestAppContext, server_cx: &mut TestAppContext
|
||||
Ok(Some(lsp::WorkspaceEdit {
|
||||
changes: Some(
|
||||
[(
|
||||
lsp::Url::from_file_path(path!("/code/project1/src/lib.rs")).unwrap(),
|
||||
lsp::Uri::from_file_path(path!("/code/project1/src/lib.rs")).unwrap(),
|
||||
vec![lsp::TextEdit::new(
|
||||
lsp::Range::new(lsp::Position::new(0, 3), lsp::Position::new(0, 6)),
|
||||
"two".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user