Skip to content
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

Warnings in extension development #98

Open
Eskibear opened this issue Jan 17, 2019 · 5 comments
Open

Warnings in extension development #98

Eskibear opened this issue Jan 17, 2019 · 5 comments
Assignees

Comments

@Eskibear
Copy link

Eskibear commented Jan 17, 2019

Not a blocking issue. Just some annoying warning messages in debug console if I have xml extension installed.

[redhat.vscode-xml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[xml]', provide the URI of a resource or 'null' for any resource.
[redhat.vscode-xml] Accessing a window scoped configuration for a resource is not expected. To associate 'xml.completion.autoCloseTags' to a resource, define its scope to 'resource' in configuration contributions in 'package.json'.

The first one:

let closeBrackets = configXML.get("[xml]")["editor.autoClosingBrackets"];

let configXML = workspace.getConfiguration(undefined, null), ConfigXML.get("[xml]") should work.

The second one:

disposable = activateTagClosing(tagRequestor, { xml: true, xsl: true }, 'xml.completion.autoCloseTags');

if (!workspace.getConfiguration(void 0, document.uri).get<boolean>(configName)) {

vscode-xml/package.json

Lines 152 to 156 in 32b586c

"xml.completion.autoCloseTags": {
"type": "boolean",
"default": true,
"description": "Enable/disable autoclosing of XML tags. \n\nIMPORTANT: Turn off editor.autoClosingTags for this to work",
"scope": "window"

@fbricon
Copy link
Collaborator

fbricon commented Jan 17, 2019

@Eskibear do you think you could provide a PR?

@Eskibear
Copy link
Author

It's a one-line change for the first one.

For the second one, the statement is written in such way because html.autoClosingTags is a resource scoped conf. I notice all configs are window scoped in this extension, that means it's not supported to use different configs for each workspace folder (in a multi-root workspace). I've no idea how largely you will re-used this function, so I think either of the following works.

  • Simply remove "document.uri" when getting the config. (one-line change, ok for now but blocks multi-root workspace support)
  • Change the config to resource scoped. (suggest to be within multi-root workspace support)

@datho7561 datho7561 assigned datho7561 and unassigned datho7561 Aug 25, 2020
datho7561 added a commit to datho7561/vscode-xml that referenced this issue Aug 25, 2020
Use method described by Eskibear to access [xml] autoclosing settings.
Rescope `xml.completion.autoCloseTags` as a resource setting.

Closes redhat-developer#98

Signed-off-by: David Thompson <[email protected]>
datho7561 added a commit to datho7561/vscode-xml that referenced this issue Sep 9, 2020
Use method described by Eskibear to access [xml] autoclosing settings.
Do not provide a document when getting the settings, since LemMinX doesn't
support multi-root projects right now.

Closes redhat-developer#98

Signed-off-by: David Thompson <[email protected]>
@datho7561
Copy link
Contributor

@Eskibear I worked on a quick PR to address these warnings. I used the method you described to fix the first warning to address both the warnings, since LemMinX doesn't support multi-root workspaces yet. Does this solution make sense?

@Eskibear
Copy link
Author

@datho7561 commented, you shall refer to vscode's API spec.

@datho7561
Copy link
Contributor

@Eskibear, Thanks for your help!

datho7561 added a commit to datho7561/vscode-xml that referenced this issue Sep 11, 2020
Use method described by Eskibear to access [xml] autoclosing settings.
Do not provide a document when accessing vscode-xml settings,
since LemMinX doesn't support multi-root projects right now.

Closes redhat-developer#98

Signed-off-by: David Thompson <[email protected]>
@datho7561 datho7561 self-assigned this Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants