mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
Switches all samples to use eslint 9 with flat configs. I've tried to migrate existing settings as much as possible. However our eslint configs were also inconsistent so I've tried to align these too
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
// The module 'vscode' contains the VS Code extensibility API
|
|
// Import the module and reference it with the alias vscode in your code below
|
|
import { ExtensionContext, languages, commands, Disposable, workspace, window } from 'vscode';
|
|
import { CodelensProvider } from './CodelensProvider';
|
|
|
|
// this method is called when your extension is activated
|
|
// your extension is activated the very first time the command is executed
|
|
|
|
let disposables: Disposable[] = [];
|
|
|
|
export function activate(_context: ExtensionContext) {
|
|
const codelensProvider = new CodelensProvider();
|
|
|
|
languages.registerCodeLensProvider("*", codelensProvider);
|
|
|
|
commands.registerCommand("codelens-sample.enableCodeLens", () => {
|
|
workspace.getConfiguration("codelens-sample").update("enableCodeLens", true, true);
|
|
});
|
|
|
|
commands.registerCommand("codelens-sample.disableCodeLens", () => {
|
|
workspace.getConfiguration("codelens-sample").update("enableCodeLens", false, true);
|
|
});
|
|
|
|
commands.registerCommand("codelens-sample.codelensAction", (args: unknown) => {
|
|
window.showInformationMessage(`CodeLens action clicked with args=${args}`);
|
|
});
|
|
}
|
|
|
|
// this method is called when your extension is deactivated
|
|
export function deactivate() {
|
|
if (disposables) {
|
|
disposables.forEach(item => item.dispose());
|
|
}
|
|
disposables = [];
|
|
}
|