-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
[Configuration] Get configuration doesn't return default value if not found. #9731
Comments
@rebornix How did you define the configuration property? If the default is defined to be |
@jrieken the thing is I didn't define its default value. A good proof is when we define a Number type configuration and don't add default value for it, we get |
I'm not aware of any recent changes, but there's a bug that we are missing the default for 'number' here. |
@aeschli Once you fix the the number default value, the second parameter The reason I want to know the source of the config is that we have overlap between Vim and Code configuration. For example, |
The 'defaultValue' parameter in WorkspaceConfiguration.get is useful if the key doesn't exist at all (e.g. if you access settings of an extension that is not present). No change for existing configurations: we already had the default value; it was just wrong for 'number', as you found out. |
@aeschli There is still an issue here in which the default for not having a default is |
Looked at it with Joh, he ran again in the number case. Tried again, an all seems fine now. |
Steps to Reproduce:
vscode.workspace.getConfiguration("section").get("optionName", undefined)
If user doesn't set a value for this config in his/her settings.json, the return result of this expression should be
undefined
. While what we get isfalse
.If the config is defined as
number
, this expression will returnnull
. If user sets this config explicitly, we can get the correct value.BTW, it seems we don't have a chance to know whether a Code config, for example
editor.tabSize
, is set by User or Workspace or just default value. It's a potential feature request.The text was updated successfully, but these errors were encountered: