Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cea7576

Browse files
committed
Allow to configure the context menu commands
1 parent 205f443 commit cea7576

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ This extension contributes the following settings:
5353
* `phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.enabled`: Specifies whether to break the constructor into multiple lines if the given line length is exceeded
5454
* `phpAddProperty.constructor.breakIntoMultilineIfLengthExceeded.maxLineLength`: Specifies the maximum line length before using a multiline constructor
5555
* `phpAddProperty.showMessagesOnStatusBar`: Specifies whether to show messages on status bar instead of notification box
56-
* `phpAddProperty.showContextMenuOptions`: Specifies whether to show the context menu options
56+
* `phpAddProperty.contextMenuOptions.enable`: Specifies whether to show the context menu options
57+
* `phpAddProperty.contextMenuOptions.addProperty`: Specifies whether to show the add property command in the context menu options
58+
* `phpAddProperty.contextMenuOptions.appendProperty`: Specifies whether to show the append property command in the context menu options
59+
* `phpAddProperty.contextMenuOptions.removeProperty`: Specifies whether to show the remove property command in the context menu options

package.json

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,38 @@
4444
],
4545
"menus": {
4646
"commandPalette": [
47+
{
48+
"command": "phpAddProperty.add",
49+
"when": "editorLangId == php"
50+
},
4751
{
4852
"command": "phpAddProperty.append",
4953
"when": "editorLangId == php"
54+
},
55+
{
56+
"command": "phpAddProperty.remove",
57+
"when": "editorLangId == php"
58+
},
59+
{
60+
"command": "phpAddProperty.breakConstructorIntoMultiline",
61+
"when": "editorLangId == php"
5062
}
5163
],
5264
"editor/context": [
5365
{
54-
"when": "resourceLangId == php && config.phpAddProperty.showContextMenuOptions",
66+
"when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.addProperty",
5567
"command": "phpAddProperty.add",
5668
"alt": "phpAddProperty.add",
5769
"group": "0_phpAddProperty@1"
5870
},
5971
{
60-
"when": "resourceLangId == php && config.phpAddProperty.showContextMenuOptions",
72+
"when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.appendProperty",
6173
"command": "phpAddProperty.append",
6274
"alt": "phpAddProperty.append",
6375
"group": "0_phpAddProperty@2"
6476
},
6577
{
66-
"when": "resourceLangId == php && config.phpAddProperty.showContextMenuOptions",
78+
"when": "resourceLangId == php && config.phpAddProperty.contextMenuOptions.enable && config.phpAddProperty.contextMenuOptions.removeProperty",
6779
"command": "phpAddProperty.remove",
6880
"alt": "phpAddProperty.remove",
6981
"group": "0_phpAddProperty@3"
@@ -169,10 +181,25 @@
169181
"default": false,
170182
"description": "Specifies whether to show messages on status bar instead of notification box"
171183
},
172-
"phpAddProperty.showContextMenuOptions": {
184+
"phpAddProperty.contextMenuOptions.enable": {
173185
"type": "boolean",
174186
"default": false,
175187
"description": "Specifies whether to show the context menu options"
188+
},
189+
"phpAddProperty.contextMenuOptions.addProperty": {
190+
"type": "boolean",
191+
"default": true,
192+
"description": "Specifies whether to show the add property command in the context menu options"
193+
},
194+
"phpAddProperty.contextMenuOptions.appendProperty": {
195+
"type": "boolean",
196+
"default": true,
197+
"description": "Specifies whether to show the append property command in the context menu options"
198+
},
199+
"phpAddProperty.contextMenuOptions.removeProperty": {
200+
"type": "boolean",
201+
"default": true,
202+
"description": "Specifies whether to show the remove property command in the context menu options"
176203
}
177204
}
178205
}

0 commit comments

Comments
 (0)