Skip to content

Commit

Permalink
fix(configuration): supply resource uri when retrieving configuration…
Browse files Browse the repository at this point in the history
… to stop all the crazy warning msgs
  • Loading branch information
jpoon committed Nov 12, 2017
1 parent c6fa410 commit b80db76
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ class ConfigurationClass {
cmdLineInitialColon = false;
}

function getConfiguration(): vscode.WorkspaceConfiguration {
let resource: vscode.Uri | undefined = undefined;
let activeTextEditor = vscode.window.activeTextEditor;
if (activeTextEditor !== undefined) {
resource = activeTextEditor.document.uri;
}
return vscode.workspace.getConfiguration('editor', resource);
}

function overlapSetting(args: {
codeName: string;
default: OptionValue;
Expand All @@ -336,7 +345,7 @@ function overlapSetting(args: {
return this['_' + propertyKey];
}

let val = vscode.workspace.getConfiguration('editor').get(args.codeName, args.default);
let val = getConfiguration().get(args.codeName, args.default);
if (args.codeValueMapping && val !== undefined) {
val = args.codeValueMapping[val as string];
}
Expand All @@ -357,9 +366,11 @@ function overlapSetting(args: {
codeValue = args.codeValueMapping[value];
}

await vscode.workspace
.getConfiguration('editor')
.update(args.codeName, codeValue, vscode.ConfigurationTarget.Global);
await getConfiguration().update(
args.codeName,
codeValue,
vscode.ConfigurationTarget.Global
);
}, 'config');
},
enumerable: true,
Expand Down

0 comments on commit b80db76

Please sign in to comment.