Skip to content

🔧🚗 Migrate setting value of codeFormatting.whitespaceAroundPipe (if present) to new setting codeFormatting.addWhitespaceAroundPipe automatically. #2689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
try use quotes around undefined to see if it fixes codacy warning
  • Loading branch information
Christoph Bergmeister committed May 10, 2020
commit c69d197d441f2fac7db4464dcf04578b4a7dde4f
9 changes: 5 additions & 4 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,22 @@ export async function getEffectiveConfigurationTarget(settingName: string): Prom

const detail = configuration.inspect(settingName);
let configurationTarget = null;
if (typeof detail.workspaceFolderValue !== undefined) {
if (typeof detail.workspaceFolderValue !== "undefined") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be this?

Suggested change
if (typeof detail.workspaceFolderValue !== "undefined") {
if (detail.workspaceFolderValue !== undefined) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Codacy/ESLint will complain because of not using typeof and not using double quotes around undefined:
https://eslint.org/docs/rules/no-undefined
Unfortunately, Codacy seems to lose its history but those were the complaints that made the build red in my previous commits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the link. I think that advice is fine.

configurationTarget = vscode.ConfigurationTarget.WorkspaceFolder;
}
else if (typeof detail.workspaceValue !== undefined) {
else if (typeof detail.workspaceValue !== "undefined") {
configurationTarget = vscode.ConfigurationTarget.Workspace;
}
else if (typeof detail.globalValue !== undefined) {
else if (typeof detail.globalValue !== "undefined") {
configurationTarget = vscode.ConfigurationTarget.Global;
}
return configurationTarget;
}

export async function change(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is functionally still the same , only the configurationTarget parameter has been optimized to match exactly the called VS-Code API underneath.

settingName: string,
newValue: any, configurationTarget?: vscode.ConfigurationTarget | boolean): Promise<void> {
newValue: any,
configurationTarget?: vscode.ConfigurationTarget | boolean): Promise<void> {

const configuration = vscode.workspace.getConfiguration(utils.PowerShellLanguageId);

Expand Down