|
42 | 42 |
|
43 | 43 | class CommandUsagePackageJsonMenuItem extends CommandUsage, JsonObject { |
44 | 44 | CommandUsagePackageJsonMenuItem() { |
45 | | - this.getFile().getBaseName() = "package.json" and |
46 | 45 | exists(this.getPropValue("command")) and |
47 | | - exists(JsonObject topObject, string menuName | |
48 | | - not exists(topObject.getParent()) and |
49 | | - topObject |
| 46 | + exists(PackageJson packageJson, string menuName | |
| 47 | + packageJson |
50 | 48 | .getPropValue("contributes") |
51 | 49 | .getPropValue("menus") |
52 | 50 | .getPropValue(menuName) |
|
59 | 57 | } |
60 | 58 |
|
61 | 59 | predicate isDisabledInCommandPalette(string commandName) { |
62 | | - exists(JsonObject topObject, JsonObject commandPaletteObject | |
63 | | - not exists(topObject.getParent()) and |
64 | | - topObject |
| 60 | + exists(PackageJson packageJson, JsonObject commandPaletteObject | |
| 61 | + packageJson |
65 | 62 | .getPropValue("contributes") |
66 | 63 | .getPropValue("menus") |
67 | 64 | .getPropValue("commandPalette") |
|
75 | 72 | CommandUsagePackageJsonCommandPalette() { |
76 | 73 | this.getFile().getBaseName() = "package.json" and |
77 | 74 | exists(this.getPropValue("command")) and |
78 | | - exists(JsonObject topObject | |
79 | | - not exists(topObject.getParent()) and |
80 | | - topObject.getPropValue("contributes").getPropValue("commands").getElementValue(_) = this |
| 75 | + exists(PackageJson packageJson | |
| 76 | + packageJson.getPropValue("contributes").getPropValue("commands").getElementValue(_) = this |
81 | 77 | ) and |
82 | 78 | not isDisabledInCommandPalette(this.getPropValue("command").getStringValue()) |
83 | 79 | } |
|
0 commit comments