Skip to content

Commit

Permalink
feat: analyseCurrentPath command in the explorer context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Dec 7, 2020
1 parent 2a19232 commit ecbec20
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- `phpstan.showOutput`: show output.
- `phpstan.analyse`: analyse.
- `phpstan.analyseCurrentPath`: analyse current path.
- Also available in the explorer context menu.
- `phpstan.pauseFileWatcher`: pause file watcher.
- `phpstan.resumeFileWatcher`: resume file watcher.
- `phpstan.toggleFileWatcher`: toggle file watcher.
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@
"title": "PHPStan: Clear cache"
}
],
"menus": {
"explorer/context": [
{
"command": "phpstan.analyseCurrentPath",
"when": "resourceLangId == php && phpstan:enabled"
},
{
"command": "phpstan.analyseCurrentPath",
"when": "explorerResourceIsFolder && phpstan:enabled"
}
]
},
"configuration": {
"type": "object",
"title": "PHPStan",
Expand Down
3 changes: 3 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export function activate(context: vscode.ExtensionContext): void {

if (!settings.enabled) return

vscode.commands.executeCommand("setContext", `${EXT_NAME}:enabled`, true)

PHPStan.settings = {
basenames: settings.configFileWatcherBasenames,
path: settings.path,
Expand Down Expand Up @@ -158,6 +160,7 @@ export function deactivate(): void {
}
delete $[key]
}
vscode.commands.executeCommand("setContext", `${EXT_NAME}:enabled`, false)
}

function onFileWatcherEvent(
Expand Down

0 comments on commit ecbec20

Please sign in to comment.