Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit b778f53

Browse files
authored
Merge pull request #1426 from Xanewok/lsp-window-progress
Use initially proposed LSP window/progress message
2 parents 032b47d + 3d44b05 commit b778f53

File tree

7 files changed

+12
-52
lines changed

7 files changed

+12
-52
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ failure = "0.1.1"
3737
home = "0.3"
3838
itertools = "0.8"
3939
jsonrpc-core = "10"
40-
lsp-types = "0.55.2"
40+
lsp-types = { version = "0.57", features = ["proposed"] }
4141
lazy_static = "1"
4242
log = "0.4"
4343
num_cpus = "1"

rls/src/actions/progress.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
use std::sync::atomic::{AtomicUsize, Ordering};
22

3-
use crate::lsp_data::{
4-
MessageType, Progress, ProgressParams, PublishDiagnosticsParams, ShowMessageParams,
5-
};
63
use crate::server::{Notification, Output};
74
use lazy_static::lazy_static;
8-
use lsp_types::notification::{PublishDiagnostics, ShowMessage};
5+
use lsp_types::notification::{Progress, PublishDiagnostics, ShowMessage};
6+
use lsp_types::{MessageType, ProgressParams, PublishDiagnosticsParams, ShowMessageParams};
97

108
/// Communication of build progress back to the client.
119
pub trait ProgressNotifier: Send {
@@ -40,7 +38,7 @@ fn new_progress_params(title: String) -> ProgressParams {
4038

4139
ProgressParams {
4240
id: format!("progress_{}", PROGRESS_ID_COUNTER.fetch_add(1, Ordering::SeqCst)),
43-
title: Some(title),
41+
title,
4442
message: None,
4543
percentage: None,
4644
done: None,

rls/src/cmd.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use lsp_types::{
1313
ClientCapabilities, CodeActionContext, CodeActionParams, CompletionItem,
1414
DocumentFormattingParams, DocumentRangeFormattingParams, DocumentSymbolParams,
1515
FormattingOptions, InitializeParams, Position, Range, RenameParams, TextDocumentIdentifier,
16-
TextDocumentPositionParams, TraceOption, WorkspaceSymbolParams,
16+
TextDocumentPositionParams, TraceOption, WindowClientCapabilities, WorkspaceSymbolParams,
1717
};
1818

1919
use std::collections::HashMap;
@@ -291,6 +291,7 @@ fn initialize(root_path: String) -> Request<server::InitializeRequest> {
291291
initialization_options: None,
292292
capabilities: ClientCapabilities {
293293
workspace: None,
294+
window: Some(WindowClientCapabilities { progress: Some(true) }),
294295
text_document: None,
295296
experimental: None,
296297
},

rls/src/lsp_data.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -341,45 +341,3 @@ impl ClientCapabilities {
341341
ClientCapabilities { code_completion_has_snippet_support, related_information_support }
342342
}
343343
}
344-
345-
/* ---------- Temporary LSP type until window/progress proposal is done --------- */
346-
347-
// Notification from server to client for build progress.
348-
#[derive(Debug)]
349-
pub struct Progress;
350-
351-
impl notification::Notification for Progress {
352-
type Params = ProgressParams;
353-
const METHOD: &'static str = NOTIFICATION__Progress;
354-
}
355-
356-
// The progress notification is sent from the server to the client to ask the client
357-
// to indicate progress.
358-
#[allow(non_upper_case_globals)]
359-
pub const NOTIFICATION__Progress: &str = "window/progress";
360-
361-
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
362-
pub struct ProgressParams {
363-
// A unique identifier to associate multiple progress notifications with the same progress.
364-
pub id: String,
365-
366-
// The title of the progress.
367-
// This should be the same for all ProgressParams with the same id.
368-
#[serde(skip_serializing_if = "Option::is_none")]
369-
pub title: Option<String>,
370-
371-
// Optional progress message to display.
372-
// If unset, the previous progress message (if any) is still valid.
373-
#[serde(skip_serializing_if = "Option::is_none")]
374-
pub message: Option<String>,
375-
376-
// Optional progress percentage to display.
377-
// If unset, the previous progress percentage (if any) is still valid.
378-
#[serde(skip_serializing_if = "Option::is_none")]
379-
pub percentage: Option<f64>,
380-
381-
// Set to true on the final progress update.
382-
// No more progress notifications with the same ID should be sent.
383-
#[serde(skip_serializing_if = "Option::is_none")]
384-
pub done: Option<bool>,
385-
}

rls/src/server/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ mod test {
462462
initialization_options: None,
463463
capabilities: lsp_types::ClientCapabilities {
464464
workspace: None,
465+
window: None,
465466
text_document: None,
466467
experimental: None,
467468
},

tests/client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn initialize_params(root_path: &Path) -> InitializeParams {
2020
initialization_options: None,
2121
capabilities: ClientCapabilities {
2222
workspace: None,
23+
window: Some(WindowClientCapabilities { progress: Some(true) }),
2324
text_document: None,
2425
experimental: None,
2526
},
@@ -503,6 +504,7 @@ fn client_completion_suggests_arguments_in_statements() {
503504
initialization_options: None,
504505
capabilities: lsp_types::ClientCapabilities {
505506
workspace: None,
507+
window: Some(WindowClientCapabilities { progress: Some(true) }),
506508
text_document: Some(TextDocumentClientCapabilities {
507509
completion: Some(CompletionCapability {
508510
completion_item: Some(CompletionItemCapability {

0 commit comments

Comments
 (0)