@@ -65,13 +65,15 @@ local function toggle_feature(ctx, line)
65
65
local parent_name = string.sub (feat_name , 5 )
66
66
local parent_feat = features .map [parent_name ]
67
67
68
- if parent_feat and vim .tbl_contains (parent_feat .members , feat_name ) then
68
+ if not parent_feat then
69
+ -- no direct explicit parent feature, so just toggle the implicit feature
70
+ elseif vim .tbl_contains (parent_feat .members , feat_name ) then
69
71
if # parent_feat .members > 1 then
70
72
util .notify (vim .log .levels .INFO , " Cannot enable/disable '%s' directly; instead toggle its parent feature '%s'" , feat_name , parent_name )
71
73
return
74
+ else
75
+ -- the explicit parent feature only contains the dependency feature, so toggle it instead
72
76
end
73
- elseif not parent_feat then
74
- -- no direct explicit parent feature, so just toggle the implicit feature
75
77
else
76
78
-- the parent feature named like the dependency, doesn't include the `dep:` feature,
77
79
-- so find other features, that include it.
@@ -103,7 +105,7 @@ local function toggle_feature(ctx, line)
103
105
if crate_feature then
104
106
line_span = edit .disable_feature (ctx .buf , ctx .crate , crate_feature )
105
107
else
106
- line_span = edit .enable_feature (ctx .buf , ctx .crate , selected_feature )
108
+ line_span = edit .enable_feature (ctx .buf , ctx .crate , feat_name )
107
109
end
108
110
end
109
111
0 commit comments