getConfiguration

Get a workspace configuration object.

Introduction

Parameter

Name Type Description
section String A dot-separated identifier.

Returns

Type Description
Configuration The full configuration or a subset.

Example

  1. let config = hx.workspace.getConfiguration()
  2. let fontSize = config.get("editor.fontSize");
  3. or
  4. let config = hx.workspace.getConfiguration("editor")
  5. let fontSize = config.get("fontSize");

get

get: Get configuration items

Parameter

Name Type Description
section String Configuration name。
defaultValue Any A value should be returned when no value could be found, is undefined.

Returns

Type Description
Any Return a value from this configuration.

Example

  1. let eslintConfig = hx.workspace.getConfiguration("eslint-js")
  2. let validateOnDocumentChanged = eslintConfig.get("validateOnDocumentChanged",false);

update

update: Update configuration items

Parameter

Name Type Description
section String Configuration name
value Any Configuration item value

Returns

Type Description
Promise<void> Promise

Example

  1. let eslintConfig = hx.workspace.getConfiguration("eslint-js")
  2. eslintConfig.update("validateOnDocumentChanged",true).then(()=>{
  3. console.log("Successfully updated the configuration.");
  4. });