mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Add master config for inlayHints to make disabling easy
This commit is contained in:
parent
6f2f9049da
commit
3bf5ef02c0
@ -300,6 +300,11 @@
|
||||
"default": true,
|
||||
"markdownDescription": "Check with all features (will be passed as `--all-features`)"
|
||||
},
|
||||
"rust-analyzer.inlayHints.enable": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Disable all inlay hints"
|
||||
},
|
||||
"rust-analyzer.inlayHints.typeHints": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
|
@ -94,6 +94,7 @@ export class Config {
|
||||
|
||||
get inlayHints() {
|
||||
return {
|
||||
enable: this.get<boolean>("inlayHints.enable"),
|
||||
typeHints: this.get<boolean>("inlayHints.typeHints"),
|
||||
parameterHints: this.get<boolean>("inlayHints.parameterHints"),
|
||||
chainingHints: this.get<boolean>("inlayHints.chainingHints"),
|
||||
|
@ -10,13 +10,13 @@ export function activateInlayHints(ctx: Ctx) {
|
||||
const maybeUpdater = {
|
||||
updater: null as null | HintsUpdater,
|
||||
async onConfigChange() {
|
||||
if (
|
||||
!ctx.config.inlayHints.typeHints &&
|
||||
!ctx.config.inlayHints.parameterHints &&
|
||||
!ctx.config.inlayHints.chainingHints
|
||||
) {
|
||||
return this.dispose();
|
||||
}
|
||||
const anyEnabled = ctx.config.inlayHints.typeHints
|
||||
|| ctx.config.inlayHints.parameterHints
|
||||
|| ctx.config.inlayHints.chainingHints;
|
||||
const enabled = ctx.config.inlayHints.enable && anyEnabled;
|
||||
|
||||
if (!enabled) return this.dispose();
|
||||
|
||||
await sleep(100);
|
||||
if (this.updater) {
|
||||
this.updater.syncCacheAndRenderHints();
|
||||
|
Loading…
Reference in New Issue
Block a user