mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(editor/vscode): Support window/showMessage event (#7085)
Whenever the language server sends a `window/showMessage` event, VS Code will listen and display a notification or log a message based on the severity level of the message. The language server doesn't currently send this event. I'm going to follow up with a separate PR for that. Ref https://github.com/oxc-project/oxc/issues/6988
This commit is contained in:
parent
79bf74a1a1
commit
7872927fca
2 changed files with 22 additions and 1 deletions
|
|
@ -2,6 +2,8 @@ import { promises as fsPromises } from 'node:fs';
|
|||
|
||||
import { commands, ExtensionContext, StatusBarAlignment, StatusBarItem, ThemeColor, window, workspace } from 'vscode';
|
||||
|
||||
import { MessageType, ShowMessageNotification } from 'vscode-languageclient';
|
||||
|
||||
import { Executable, LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient/node';
|
||||
|
||||
import { join } from 'node:path';
|
||||
|
|
@ -171,6 +173,25 @@ export async function activate(context: ExtensionContext) {
|
|||
serverOptions,
|
||||
clientOptions,
|
||||
);
|
||||
client.onNotification(ShowMessageNotification.type, (params) => {
|
||||
switch (params.type) {
|
||||
case MessageType.Log:
|
||||
case MessageType.Debug:
|
||||
outputChannel.appendLine(params.message);
|
||||
break;
|
||||
case MessageType.Info:
|
||||
window.showInformationMessage(params.message);
|
||||
break;
|
||||
case MessageType.Warning:
|
||||
window.showWarningMessage(params.message);
|
||||
break;
|
||||
case MessageType.Error:
|
||||
window.showErrorMessage(params.message);
|
||||
break;
|
||||
default:
|
||||
outputChannel.appendLine(params.message);
|
||||
}
|
||||
});
|
||||
|
||||
workspace.onDidDeleteFiles((event) => {
|
||||
event.files.forEach((fileUri) => {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
"oxc"
|
||||
],
|
||||
"engines": {
|
||||
"vscode": "^1.90.0"
|
||||
"vscode": "^1.95.0"
|
||||
},
|
||||
"sponsor": {
|
||||
"url": "https://github.com/sponsors/boshen"
|
||||
|
|
|
|||
Loading…
Reference in a new issue