mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #4372
4372: Add master config for inlayHints to make disabling easy r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
363c1f2f49
3 changed files with 13 additions and 7 deletions
|
@ -300,6 +300,11 @@
|
||||||
"default": true,
|
"default": true,
|
||||||
"markdownDescription": "Check with all features (will be passed as `--all-features`)"
|
"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": {
|
"rust-analyzer.inlayHints.typeHints": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
|
|
|
@ -94,6 +94,7 @@ export class Config {
|
||||||
|
|
||||||
get inlayHints() {
|
get inlayHints() {
|
||||||
return {
|
return {
|
||||||
|
enable: this.get<boolean>("inlayHints.enable"),
|
||||||
typeHints: this.get<boolean>("inlayHints.typeHints"),
|
typeHints: this.get<boolean>("inlayHints.typeHints"),
|
||||||
parameterHints: this.get<boolean>("inlayHints.parameterHints"),
|
parameterHints: this.get<boolean>("inlayHints.parameterHints"),
|
||||||
chainingHints: this.get<boolean>("inlayHints.chainingHints"),
|
chainingHints: this.get<boolean>("inlayHints.chainingHints"),
|
||||||
|
|
|
@ -10,13 +10,13 @@ export function activateInlayHints(ctx: Ctx) {
|
||||||
const maybeUpdater = {
|
const maybeUpdater = {
|
||||||
updater: null as null | HintsUpdater,
|
updater: null as null | HintsUpdater,
|
||||||
async onConfigChange() {
|
async onConfigChange() {
|
||||||
if (
|
const anyEnabled = ctx.config.inlayHints.typeHints
|
||||||
!ctx.config.inlayHints.typeHints &&
|
|| ctx.config.inlayHints.parameterHints
|
||||||
!ctx.config.inlayHints.parameterHints &&
|
|| ctx.config.inlayHints.chainingHints;
|
||||||
!ctx.config.inlayHints.chainingHints
|
const enabled = ctx.config.inlayHints.enable && anyEnabled;
|
||||||
) {
|
|
||||||
return this.dispose();
|
if (!enabled) return this.dispose();
|
||||||
}
|
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
if (this.updater) {
|
if (this.updater) {
|
||||||
this.updater.syncCacheAndRenderHints();
|
this.updater.syncCacheAndRenderHints();
|
||||||
|
|
Loading…
Reference in a new issue