From 273299693b85996878907ad256ed55f072ec3f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 9 Dec 2019 20:57:55 +0200 Subject: Code: enable prettier trailing commas --- editors/code/src/utils/diagnostics/SuggestedFix.ts | 4 ++-- .../src/utils/diagnostics/SuggestedFixCollection.ts | 6 +++--- editors/code/src/utils/diagnostics/rust.ts | 20 ++++++++++---------- editors/code/src/utils/diagnostics/vscode.ts | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'editors/code/src/utils/diagnostics') diff --git a/editors/code/src/utils/diagnostics/SuggestedFix.ts b/editors/code/src/utils/diagnostics/SuggestedFix.ts index b1be2a225..6e660bb61 100644 --- a/editors/code/src/utils/diagnostics/SuggestedFix.ts +++ b/editors/code/src/utils/diagnostics/SuggestedFix.ts @@ -24,7 +24,7 @@ export default class SuggestedFix { title: string, location: vscode.Location, replacement: string, - applicability: SuggestionApplicability = SuggestionApplicability.Unspecified + applicability: SuggestionApplicability = SuggestionApplicability.Unspecified, ) { this.title = title; this.location = location; @@ -51,7 +51,7 @@ export default class SuggestedFix { public toCodeAction(): vscode.CodeAction { const codeAction = new vscode.CodeAction( this.title, - vscode.CodeActionKind.QuickFix + vscode.CodeActionKind.QuickFix, ); const edit = new vscode.WorkspaceEdit(); diff --git a/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts b/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts index 132ce12f8..57c9856cf 100644 --- a/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts +++ b/editors/code/src/utils/diagnostics/SuggestedFixCollection.ts @@ -38,13 +38,13 @@ export default class SuggestedFixCollection */ public addSuggestedFixForDiagnostic( suggestedFix: SuggestedFix, - diagnostic: vscode.Diagnostic + diagnostic: vscode.Diagnostic, ): void { const fileUriString = suggestedFix.location.uri.toString(); const fileSuggestions = this.suggestedFixes.get(fileUriString) || []; const existingSuggestion = fileSuggestions.find(s => - s.isEqual(suggestedFix) + s.isEqual(suggestedFix), ); if (existingSuggestion) { @@ -65,7 +65,7 @@ export default class SuggestedFixCollection */ public provideCodeActions( document: vscode.TextDocument, - range: vscode.Range + range: vscode.Range, ): vscode.CodeAction[] { const documentUriString = document.uri.toString(); diff --git a/editors/code/src/utils/diagnostics/rust.ts b/editors/code/src/utils/diagnostics/rust.ts index 0550d0372..b6efc0f56 100644 --- a/editors/code/src/utils/diagnostics/rust.ts +++ b/editors/code/src/utils/diagnostics/rust.ts @@ -7,7 +7,7 @@ export enum SuggestionApplicability { MachineApplicable = 'MachineApplicable', HasPlaceholders = 'HasPlaceholders', MaybeIncorrect = 'MaybeIncorrect', - Unspecified = 'Unspecified' + Unspecified = 'Unspecified', } // Reference: @@ -69,7 +69,7 @@ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { const range = new vscode.Range( new vscode.Position(span.line_start - 1, span.column_start - 1), - new vscode.Position(span.line_end - 1, span.column_end - 1) + new vscode.Position(span.line_end - 1, span.column_end - 1), ); return new vscode.Location(fileUri, range); @@ -81,7 +81,7 @@ function mapSpanToLocation(span: RustDiagnosticSpan): vscode.Location { * If the span is unlabelled this will return `undefined`. */ function mapSecondarySpanToRelated( - span: RustDiagnosticSpan + span: RustDiagnosticSpan, ): vscode.DiagnosticRelatedInformation | undefined { if (!span.label) { // Nothing to label this with @@ -107,7 +107,7 @@ function isUnusedOrUnnecessary(rd: RustDiagnostic): boolean { 'unused_attributes', 'unused_imports', 'unused_macros', - 'unused_variables' + 'unused_variables', ].includes(rd.code.code); } @@ -157,13 +157,13 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { title, location, span.suggested_replacement, - span.suggestion_applicability - ) + span.suggestion_applicability, + ), }; } else { const related = new vscode.DiagnosticRelatedInformation( location, - rd.message + rd.message, ); return { related }; @@ -183,7 +183,7 @@ function mapRustChildDiagnostic(rd: RustDiagnostic): MappedRustChildDiagnostic { * If the diagnostic has no primary span this will return `undefined` */ export function mapRustDiagnosticToVsCode( - rd: RustDiagnostic + rd: RustDiagnostic, ): MappedRustDiagnostic | undefined { const primarySpan = rd.spans.find(s => s.is_primary); if (!primarySpan) { @@ -223,7 +223,7 @@ export function mapRustDiagnosticToVsCode( const suggestedFixes = []; for (const child of rd.children) { const { related, suggestedFix, messageLine } = mapRustChildDiagnostic( - child + child, ); if (related) { @@ -256,6 +256,6 @@ export function mapRustDiagnosticToVsCode( return { location, diagnostic: vd, - suggestedFixes + suggestedFixes, }; } diff --git a/editors/code/src/utils/diagnostics/vscode.ts b/editors/code/src/utils/diagnostics/vscode.ts index d8b85b720..f4a5450e2 100644 --- a/editors/code/src/utils/diagnostics/vscode.ts +++ b/editors/code/src/utils/diagnostics/vscode.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; /** Compares two `vscode.Diagnostic`s for equality */ export function areDiagnosticsEqual( left: vscode.Diagnostic, - right: vscode.Diagnostic + right: vscode.Diagnostic, ): boolean { return ( left.source === right.source && -- cgit v1.2.3