-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
add script to update VSCode config with proper excludes #110161
add script to update VSCode config with proper excludes #110161
Conversation
*/ | ||
export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [ | ||
{ | ||
key: 'files.watcherExclude', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's checked into the code so it makes sense to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
…up-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.json
file or create it if it doesn't exist, then add thefiles.watcherExclude
key 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.watcherExclude
is 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 MANAGED
at the top of the file.Additionally, individual settings can be proceeded with
// SELF MANAGED
to avoid having their values changed.