Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat: experimental code

hippietrail941274ee42b6
diff --git a/packages/vscode-plugin/src/extension.ts b/packages/vscode-plugin/src/extension.ts
index 41f06a185..a63ddff19 100644
--- a/packages/vscode-plugin/src/extension.ts
+++ b/packages/vscode-plugin/src/extension.ts
@@ -2,6 +2,7 @@ import type { ExtensionContext } from 'vscode';
import type { Executable, LanguageClientOptions } from 'vscode-languageclient/node';
import { Uri, commands, window, workspace } from 'vscode';
+// import { StatusBarAlignment, type StatusBarItem } from 'vscode';
import { LanguageClient, ResponseError, TransportKind } from 'vscode-languageclient/node';
// There's no publicly available extension manifest type except for the internal one from VS Code's
@@ -51,6 +52,8 @@ const clientOptions: LanguageClientOptions = {
},
};
+// let dialectStatusBarItem: StatusBarItem | undefined;
+
export async function activate(context: ExtensionContext): Promise<void> {
serverOptions.command = getExecutablePath(context);
@@ -99,6 +102,37 @@ export async function activate(context: ExtensionContext): Promise<void> {
);
await startLanguageServer();
+
+ // Add status bar item for dialect
+ // dialectStatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left, 1000);
+ // dialectStatusBarItem.command = 'harper.setDialect';
+ // context.subscriptions.push(dialectStatusBarItem);
+
+ // // Add command to change dialect
+ // context.subscriptions.push(
+ // commands.registerCommand('harper.setDialect', async () => {
+ // const selected = await window.showQuickPick(['American', 'British'], {
+ // placeHolder: 'Select dialect',
+ // });
+ // if (selected) {
+ // await workspace.getConfiguration('harper').update('dialect', selected, true);
+ // updateDialectStatusBar();
+ // }
+ // }),
+ // );
+
+ // // Update status bar when dialect changes
+ // context.subscriptions.push(
+ // workspace.onDidChangeConfiguration(async (event) => {
+ // if (event.affectsConfiguration('harper.dialect')) {
+ // updateDialectStatusBar();
+ // }
+ // // ... existing code ...
+ // }),
+ // );
+
+ // // Initialize status bar
+ // updateDialectStatusBar();
}
function getExecutablePath(context: ExtensionContext): string {
@@ -158,10 +192,24 @@ function showError(message: string, error: Error | unknown): void {
});
}
+// function updateDialectStatusBar(): void {
+// if (!dialectStatusBarItem) return;
+
+// const dialect = workspace.getConfiguration('harper').get<string>('dialect', 'American');
+// dialectStatusBarItem.text = `$(globe) ${dialect}`;
+// dialectStatusBarItem.tooltip = `Click to change dialect (currently: ${dialect})`;
+// dialectStatusBarItem.show();
+// console.log(`** Dialect set to ${dialect} **`, dialect);
+// }
+
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
+ // if (dialectStatusBarItem) {
+ // dialectStatusBarItem.dispose();
+ // }
+
return client.stop();
}