Skip to content
This repository was archived by the owner on Oct 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"lodash": "^4.17.21",
"vscode-languageserver": "^7.0.0",
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-uri": "^3.0.2",
"yaml": "^1.10.2"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/services/ansibleConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as child_process from 'child_process';
import * as ini from 'ini';
import * as _ from 'lodash';
import * as path from 'path';
import { URL } from 'url';
import { URI } from 'vscode-uri';
import { Connection } from 'vscode-languageserver';
import { withInterpreter } from '../utils/misc';
import { WorkspaceFolderContext } from './workspaceManager';
Expand Down Expand Up @@ -35,7 +35,7 @@ export class AnsibleConfig {

const ansibleConfigResult = child_process.execSync(ansibleConfigCommand, {
encoding: 'utf-8',
cwd: decodeURI(new URL(this.context.workspaceFolder.uri).pathname),
cwd: URI.parse(this.context.workspaceFolder.uri).path,
env: ansibleConfigEnv,
});

Expand Down
16 changes: 6 additions & 10 deletions src/services/ansibleLint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as child_process from 'child_process';
import { ExecException } from 'child_process';
import { promises as fs } from 'fs';
import * as path from 'path';
import { URL } from 'url';
import { URI } from 'vscode-uri';
import { promisify } from 'util';
import {
Connection,
Expand Down Expand Up @@ -53,9 +53,7 @@ export class AnsibleLint {
): Promise<Map<string, Diagnostic[]>> {
let diagnostics: Map<string, Diagnostic[]> = new Map();

const workingDirectory = decodeURI(
new URL(this.context.workspaceFolder.uri).pathname
);
const workingDirectory = URI.parse(this.context.workspaceFolder.uri).path;

const settings = await this.context.documentSettings.get(textDocument.uri);

Expand All @@ -73,15 +71,13 @@ export class AnsibleLint {
textDocument.uri
);
if (ansibleLintConfigFile) {
ansibleLintConfigPath = decodeURI(
new URL(ansibleLintConfigFile).pathname
);
ansibleLintConfigPath = URI.parse(ansibleLintConfigFile).path;
linterArguments = `${linterArguments} -c "${ansibleLintConfigPath}"`;
}
}
linterArguments = `${linterArguments} --offline --nocolor -f codeclimate`;

const docPath = decodeURI(new URL(textDocument.uri).pathname);
const docPath = URI.parse(textDocument.uri).path;
let progressTracker;
if (this.useProgressTracker) {
progressTracker = await this.connection.window.createWorkDoneProgress();
Expand All @@ -102,7 +98,7 @@ export class AnsibleLint {

const [command, env] = withInterpreter(
settings.ansibleLint.path,
`${linterArguments} --offline --nocolor -f codeclimate "${docPath}"`,
`${linterArguments} "${docPath}"`,
settings.python.interpreterPath,
settings.python.activationScript
);
Expand Down Expand Up @@ -216,7 +212,7 @@ export class AnsibleLint {
}
}
const path = `${workingDirectory}/${item.location.path}`;
const locationUri = `file://${encodeURI(path)}`;
const locationUri = URI.file(path).toString();

let fileDiagnostics = diagnostics.get(locationUri);
if (!fileDiagnostics) {
Expand Down
Loading