Enable allFeatures by default and fix lints

This commit is contained in:
oxalica 2019-12-14 00:48:47 +08:00
parent af4eb26645
commit f56a2a0790
No known key found for this signature in database
GPG key ID: CED392DE0C483D00
2 changed files with 17 additions and 10 deletions

View file

@ -286,7 +286,7 @@
},
"rust-analyzer.cargoFeatures.allFeatures": {
"type": "boolean",
"default": false,
"default": true,
"description": "Activate all available features"
},
"rust-analyzer.cargoFeatures.features": {

View file

@ -43,7 +43,7 @@ export class Config {
};
public cargoFeatures: CargoFeatures = {
noDefaultFeatures: false,
allFeatures: false,
allFeatures: true,
features: [],
};
@ -88,7 +88,8 @@ export class Config {
}
if (this.prevEnhancedTyping !== this.enableEnhancedTyping) {
requireReloadMessage = 'Changing enhanced typing setting requires a reload';
requireReloadMessage =
'Changing enhanced typing setting requires a reload';
this.prevEnhancedTyping = this.enableEnhancedTyping;
}
@ -165,7 +166,7 @@ export class Config {
if (config.has('cargoFeatures.allFeatures')) {
this.cargoFeatures.allFeatures = config.get(
'cargoFeatures.allFeatures',
false,
true,
);
}
if (config.has('cargoFeatures.features')) {
@ -175,12 +176,18 @@ export class Config {
);
}
if (this.prevCargoFeatures !== null && (
this.cargoFeatures.allFeatures !== this.prevCargoFeatures.allFeatures ||
this.cargoFeatures.noDefaultFeatures !== this.prevCargoFeatures.noDefaultFeatures ||
this.cargoFeatures.features.length !== this.prevCargoFeatures.features.length ||
this.cargoFeatures.features.some((v, i) => v !== this.prevCargoFeatures!.features[i])
)) {
if (
this.prevCargoFeatures !== null &&
(this.cargoFeatures.allFeatures !==
this.prevCargoFeatures.allFeatures ||
this.cargoFeatures.noDefaultFeatures !==
this.prevCargoFeatures.noDefaultFeatures ||
this.cargoFeatures.features.length !==
this.prevCargoFeatures.features.length ||
this.cargoFeatures.features.some(
(v, i) => v !== this.prevCargoFeatures!.features[i],
))
) {
requireReloadMessage = 'Changing cargo features requires a reload';
}
this.prevCargoFeatures = { ...this.cargoFeatures };