Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create custom settings for a vs code extension?

I have been researching for hours but to no avail. Pretty much all VsCode extensions will have custom made settings, and they show up in the default settings json file like this from the Red Hat Java extension:

"java.dependency.showOutline": true,

I'm trying to write my own extension and I have found a lot of useful stuff, I can create custom themes, snippets, commands, etc. and it's all well documented on the VsCode API site, but I need to create custom user-defined settings, and I cannot find ANYWHERE that explains how to do so. Does anyone know?

like image 693
QuantumAbyss Avatar asked Sep 14 '25 18:09

QuantumAbyss


1 Answers

This is done using contribution points, JSON declarations in the contributes field of your extension's package.json file.

You want the configuration contribution point.

For example:

// package.json

{
  "contributes": {
    "configuration": {
      "title": "",
      "properties": {
        "scope.name": {
          "type": "",
          "default": "",
          "description": ""
        }
      }
    }
  }
}

Then you can read those values using

vscode.workspace.getConfiguration('your-extension-name')
like image 114
Al Duncanson Avatar answered Sep 16 '25 08:09

Al Duncanson