Skip to content

Commit

Permalink
Stdio patch
Browse files Browse the repository at this point in the history
Do not log validation status on stdout, use connection logs instead.
See #540, ansible#541
  • Loading branch information
JosBritton committed Oct 18, 2023
1 parent a2f98f2 commit 8a1b6a9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/providers/validationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function doValidate(

const settings = await context.documentSettings.get(textDocument.uri);
if (!settings.validation.enabled) {
console.log("Validation disabled");
connection.console.log("Validation disabled");

// this is done to remove the cache as well
const blankDiagnostics = new Map<string, Diagnostic[]>();
Expand All @@ -54,10 +54,10 @@ export async function doValidate(
: settings.validation.lint.path;
const lintAvailability =
await commandRunner.getExecutablePath(lintExecutable);
console.debug("Path for lint: ", lintAvailability);
connection.console.log(`Path for lint: ${lintAvailability}`);

if (lintAvailability) {
console.debug("Validating using ansible-lint");
connection.console.log("Validating using ansible-lint");
diagnosticsByFile = await context.ansibleLint.doValidate(textDocument);
} else {
connection?.window.showErrorMessage(
Expand All @@ -68,14 +68,14 @@ export async function doValidate(

// validate using ansible-playbook --syntax-check
else {
console.debug("Validating using ansible syntax-check");
connection.console.log("Validating using ansible syntax-check");

if (isPlaybook(textDocument)) {
console.debug("playbook file");
connection.console.log("playbook file");
diagnosticsByFile =
await context.ansiblePlaybook.doValidate(textDocument);
} else {
console.debug("non-playbook file");
connection.console.log("non-playbook file");
diagnosticsByFile = new Map<string, Diagnostic[]>();
}
}
Expand Down

0 comments on commit 8a1b6a9

Please sign in to comment.