diff --git a/src/AutoFixProvider.ts b/src/AutoFixProvider.ts index 2989176..e4dbc6a 100644 --- a/src/AutoFixProvider.ts +++ b/src/AutoFixProvider.ts @@ -27,16 +27,6 @@ interface RuleSet { rules: Record; } -// export function activate(context: vscode.ExtensionContext): void { -// const codeActionProvider = new DiagnosticFixProvider(); -// context.subscriptions.push( -// vscode.languages.registerCodeActionsProvider( -// { scheme: 'file', language: 'yaml' }, -// codeActionProvider -// ) -// ); -// } - class DiagnosticFixProvider implements vscode.CodeActionProvider { public provideCodeActions( document: vscode.TextDocument, @@ -48,9 +38,7 @@ class DiagnosticFixProvider implements vscode.CodeActionProvider { if (!this.isFileYAML(document.fileName)) { return; } - // console.log(context.diagnostics); context.diagnostics.forEach(diagnostic => { - // console.log(diagnostic); if (diagnostic.message.startsWith("The latest version is not used.")) { const versionPattern = /"(\d+\.\d+\.\d+)"/; const match = diagnostic.message.match(versionPattern); @@ -59,7 +47,6 @@ class DiagnosticFixProvider implements vscode.CodeActionProvider { } } const rule = this.getRuleFromDiagnostic(diagnostic); - // console.log(rule); if (rule) { const fixAction = this.createFixAction(document, diagnostic.range, rule); if (fixAction) { @@ -102,11 +89,6 @@ class DiagnosticFixProvider implements vscode.CodeActionProvider { const codeActions: vscode.CodeAction[] = []; if (Array.isArray(fix)) { - // return fix.map(fixItem => { - // const given = fixItem.given; - // const quickFixObj = fixItem.function(document, range, given, fixItem.field); - // return performFix(document, range, fixItem.name, quickFixObj); - // }); fix.forEach(fixItem => { const action = new vscode.CodeAction(fixItem.name, vscode.CodeActionKind.QuickFix); action.command = { @@ -118,9 +100,6 @@ class DiagnosticFixProvider implements vscode.CodeActionProvider { }); } else { - // const given = fix.given; - // const quickFixObj = fix.function(document, range, given, fix.field); - // return [performFix(document, range, fix.name, quickFixObj)]; const action = new vscode.CodeAction(fix.name, vscode.CodeActionKind.QuickFix); action.command = { command: 'extension.applyFix', diff --git a/src/ruleset/defaultFormat.ts b/src/ruleset/defaultFormat.ts index cfb4826..e123fe6 100644 --- a/src/ruleset/defaultFormat.ts +++ b/src/ruleset/defaultFormat.ts @@ -1,5 +1,4 @@ export default { - // Contains good examples tags: [ { name: "tag1", diff --git a/src/ruleset/functions/createNewID.ts b/src/ruleset/functions/createNewID.ts index fb4fb1f..b535a80 100644 --- a/src/ruleset/functions/createNewID.ts +++ b/src/ruleset/functions/createNewID.ts @@ -1,7 +1,6 @@ import * as vscode from 'vscode'; import * as yaml from 'js-yaml'; import { JSONPath } from 'jsonpath-plus'; -import { count } from 'console'; function getMessageIDMap(documentContent: string, given: string, field: string) { const IDMap = new Set(); diff --git a/src/ruleset/functions/deleteEmptyVariables.ts b/src/ruleset/functions/deleteEmptyVariables.ts index 462ac2e..c10d8fa 100644 --- a/src/ruleset/functions/deleteEmptyVariables.ts +++ b/src/ruleset/functions/deleteEmptyVariables.ts @@ -1,7 +1,4 @@ import * as vscode from 'vscode'; -import * as yaml from 'js-yaml'; -import { JSONPath } from 'jsonpath-plus'; -import { off } from 'process'; const emptyCurlyBracesPattern = /\{\}/g; const extraDotsPattern = /\.\./g;