1
0
Fork
You've already forked vscode-settings
0
scaffolding for settings of vscode extensions
  • TypeScript 100%
2024年05月26日 23:23:23 +02:00
.vscode import 2024年05月10日 17:04:01 +02:00
src expose section 2024年05月26日 23:23:15 +02:00
.editorconfig import 2024年05月10日 17:04:01 +02:00
.eslintrc.json import 2024年05月10日 17:04:01 +02:00
.gitignore import 2024年05月10日 17:04:01 +02:00
.prettierignore import 2024年05月10日 17:04:01 +02:00
.prettierrc.json import 2024年05月10日 17:04:01 +02:00
package-lock.json 2.0.4 2024年05月26日 23:23:23 +02:00
package.json 2.0.4 2024年05月26日 23:23:23 +02:00
README.md Add resolver support 2024年05月26日 21:42:10 +02:00
tsconfig.json import 2024年05月10日 17:04:01 +02:00

scaffolding for settings of vscode extensions

Example

Define your extension settings, with default values:

import settings from '@mkhl/vscode-settings'
export default settings('section', {
	executablePath: 'worple',
	executableArgs: [] as string[],
	ignoreErrors: false,
})

then import these settings (as config, say), resolve their values for your scope (a workspace folder if you have one, the global scope otherwise), and access them:

config.resolve(workspaceFolder).executablePath // if you have one
config.resolve().executablePath // otherwise

or open them in the VSCode Settings UI:

await config.open('ignoreErrors')

Supported Variables

  • ${userHome} - the path of the user's home folder
  • ${cwd} - the task runner's current working directory upon the startup of VS Code
  • ${workspaceFolder} - the path of the folder opened in VS Code (if you passed one)
  • ${workspaceFolder:Name} - the path of the folder named Name in VS Code
  • ${env:VAR} - the value of the environment variable VAR