mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +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 { 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 { Executable, LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient/node';
|
||||||
|
|
||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
|
|
@ -171,6 +173,25 @@ export async function activate(context: ExtensionContext) {
|
||||||
serverOptions,
|
serverOptions,
|
||||||
clientOptions,
|
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) => {
|
workspace.onDidDeleteFiles((event) => {
|
||||||
event.files.forEach((fileUri) => {
|
event.files.forEach((fileUri) => {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
"oxc"
|
"oxc"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.90.0"
|
"vscode": "^1.95.0"
|
||||||
},
|
},
|
||||||
"sponsor": {
|
"sponsor": {
|
||||||
"url": "https://github.com/sponsors/boshen"
|
"url": "https://github.com/sponsors/boshen"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue