Fix ${config:a.b} https://github.com/Microsoft/vscode-cpptools/issues… by sean-mcmanus · Pull Request #2166 · microsoft/vscode-cpptools · GitHub
Skip to content

Fix ${config:a.b} https://github.com/Microsoft/vscode-cpptools/issues…#2166

Merged
sean-mcmanus merged 3 commits into
masterfrom
seanmcm/fixConfigWithDot
Jun 22, 2018
Merged

Fix ${config:a.b} https://github.com/Microsoft/vscode-cpptools/issues…#2166
sean-mcmanus merged 3 commits into
masterfrom
seanmcm/fixConfigWithDot

Conversation

@sean-mcmanus

@sean-mcmanus sean-mcmanus commented Jun 21, 2018

Copy link
Copy Markdown
Contributor

Fixes #2165 .

@sean-mcmanus

Copy link
Copy Markdown
Contributor Author

Comment thread Extension/src/common.ts Outdated
let keys: string[] = name.split('.');
keys.forEach((key: string) => { config = (config) ? config.get(key) : config; });
newValue = (config) ? config.toString() : undefined;
newValue = (config) ? config.get(name).toString() : undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure about this change. Basically you're removing a line of code that looks like it's trying to change config for a reason. However, based on my limited knowledge of this, I'm not sure what the point would be. The problem is that the code is so specific, that it seems questionable to change it so dramatically.

Comment thread Extension/src/common.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems backwards to me. The previous case first did the iteration over the key array and threw an exception (the bug we're trying to fix). So, we should try that first and if we throw, then we fall back to the direct setting.

@sean-mcmanus sean-mcmanus Jun 21, 2018

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It doesn't make sense to try the code that we expect to fail and have no repro which actually works. I think the VS Code API changed. I just added that try/catch in case there's some reason the single "get" might fail that we're not aware of. I'd prefer to avoid throwing an exception in the common/expected code path.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But what this means is that if there IS any behavior that we haven't been able to discover, then that behavior will break. If we do the opposite, that won't occur. It is a good point that we shouldn't regularly throw in a common code-path, so is there a way to do the same thing without relying on an exception?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The old code no longer matches the VS Code APIs used so it doesn't make sense to fall back to it. Either it never worked or the API/types changed.

@sean-mcmanus sean-mcmanus merged commit 7e7a522 into master Jun 22, 2018
@sean-mcmanus sean-mcmanus deleted the seanmcm/fixConfigWithDot branch July 2, 2018 22:35
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fails to resolve config variables containing colons

3 participants