add script to update VSCode config with proper excludes#110161
add script to update VSCode config with proper excludes#110161spalger merged 19 commits intoelastic:masterfrom
Conversation
| */ | ||
| export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [ | ||
| { | ||
| key: 'files.watcherExclude', |
There was a problem hiding this comment.
I'm wondering if we should list artifacts in search.exclude setting to speed up the default experience for search operations.
There was a problem hiding this comment.
I only ask because I've never felt like search was slow and I definitely prefer to rely on the existing ignore files if we can.
There was a problem hiding this comment.
One example that may be useful here is the kbn-pm dist. That's the only one I'm running in to on first glance though, doesn't impact me much.
There was a problem hiding this comment.
Yeah, it's checked into the code so it makes sense to me
There was a problem hiding this comment.
So, in order to support managing the search.exclude property it felt like people needed to be able to add exclusions for themselves, so I've updated the logic to define management comments on each property it writes like so:
/**
* @managed
*
* Some settings in this file are managed by @kbn/dev-utils. When a setting is managed it is preceeded
* with a comment "// @managed" comment. Replace that with "// self managed" and the scripts will not
* touch that value. Put a "// self managed" comment at the top of the file, or above a group of settings
* to disable management of that entire section.
*/
{
"workbench.colorTheme": "Noctis Obscuro",
"files.watcherExclude": {
// self managed
"**/.eslintcache": false,
// @managed
"**/.es": true,
// @managed
"**/.yarn-local-mirror": true,
// @managed
"**/.chromium": true,
// @managed
"**/bazel-*": true,
// @managed
"**/node_modules": true,
// @managed
"**/target": true,
// @managed
"**/*.log": true,
// @managed
"**/packages/kbn-pm/dist/index.js": true
},
"search.exclude": {
// @managed
"**/packages/kbn-pm/dist/index.js": true
}
}
Now, when the script runs it will ignore any property which doesn't have a @managed comment, and delete @managed properties which are no longer managed. Additionally, users can self manage a property by replacing the @managed comment with // self managed and then customize things further.
…up-vscode-workspace-settings
…up-vscode-workspace-settings
|
Pinging @elastic/kibana-operations (Team:Operations) |
…up-vscode-workspace-settings
|
@elasticmachine merge upstream |
…m:spalger/kibana into implement/setup-vscode-workspace-settings
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…10554) Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Spencer <email@spalger.com> Co-authored-by: spalger <spalger@users.noreply.github.com>
…10553) Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Spencer <email@spalger.com> Co-authored-by: spalger <spalger@users.noreply.github.com>

Fixes #85782
Adds a step to bootstrap which will update the
.vscode/settings.jsonfile or create it if it doesn't exist, then add thefiles.watcherExcludekey to it or override that value if it doesn't exist. The process of updating this file uses babel to parse the file to an AST, updates the AST, and then prints it again using babel, then formats it using Prettier. This allows users to keep comments in their file as supported by VSCode and as is very useful if you want to temporarily disable some configuration but keep the values around for later use.For now the
files.watcherExcludeis the only key we're setting in the config, but we might expand this to include settings for eslint, prettier, Typescript version, etc in the future.The settings which will be written/overwritten to the file are defined in https://github.com/spalger/kibana/blob/implement/setup-vscode-workspace-settings/packages/kbn-dev-utils/src/vscode_config/managed_config_keys.ts
Users who want to manage their VSCode settings manually can do so by putting the comment
// SELF MANAGEDat the top of the file.Additionally, individual settings can be proceeded with
// SELF MANAGEDto avoid having their values changed.