export async function registerLinter()

in src/provider/linter.ts [100:126]


export async function registerLinter(context: vscode.ExtensionContext) {
  // 插件诊断器
  const collection = vscode.languages.createDiagnosticCollection("alicloud-linter");
  if (vscode.window.activeTextEditor) {
    updateDiagnostics(vscode.window.activeTextEditor.document, collection);
  }
  context.subscriptions.push(
    vscode.window.onDidChangeActiveTextEditor((editor) => {
      if (editor) {
        updateDiagnostics(editor.document, collection);
      }
    }),
  );
  context.subscriptions.push(
    vscode.workspace.onDidCloseTextDocument((document) => {
      // 文件关闭(删除)后清空诊断
      collection.clear();
    }),
  );
  context.subscriptions.push(
    vscode.workspace.onDidChangeTextDocument((editor) => {
      if (editor) {
        updateDiagnostics(editor.document, collection);
      }
    }),
  );
}