UNPKG

2.01 kBTypeScriptView Raw
1import { LanguageClientConnection, MessageActionItem, ShowMessageParams, ShowMessageRequestParams } from "../languageclient";
2export interface NotificationButton {
3 text: string;
4}
5/** Public: Adapts Atom's user notifications to those of the language server protocol. */
6export default class NotificationsAdapter {
7 /** Public: Attach to a {LanguageClientConnection} to recieve events indicating when user notifications should be displayed. */
8 static attach(connection: LanguageClientConnection, name: string, projectPath: string): void;
9 /**
10 * Public: Show a notification message with buttons using the Atom notifications API.
11 *
12 * @param params The {ShowMessageRequestParams} received from the language server indicating the details of the
13 * notification to be displayed.
14 * @param name The name of the language server so the user can identify the context of the message.
15 * @param projectPath The path of the current project.
16 */
17 static onShowMessageRequest(params: ShowMessageRequestParams, name: string, projectPath: string): Promise<MessageActionItem | null>;
18 /**
19 * Public: Show a notification message using the Atom notifications API.
20 *
21 * @param params The {ShowMessageParams} received from the language server indicating the details of the notification
22 * to be displayed.
23 * @param name The name of the language server so the user can identify the context of the message.
24 * @param projectPath The path of the current project.
25 */
26 static onShowMessage(params: ShowMessageParams, name: string, projectPath: string): void;
27 /**
28 * Public: Convert a {MessageActionItem} from the language server into an equivalent {NotificationButton} within Atom.
29 *
30 * @param actionItem The {MessageActionItem} to be converted.
31 * @returns A {NotificationButton} equivalent to the {MessageActionItem} given.
32 */
33 static actionItemToNotificationButton(actionItem: MessageActionItem): NotificationButton;
34}