From 88b16bf9c841abed6b867522cb9d25fbaaeb0b71 Mon Sep 17 00:00:00 2001 From: Mikalai Kukhta Date: Sun, 17 Dec 2023 19:46:46 +0100 Subject: [PATCH] new settings option to show problems panel after initial pass (#183) * add an option `showProblemsView`. It controls if Problems View should open once after initial lint pass * updated Changelog * add option to README.md * Update CHANGELOG.md * Fix * Fix MegaLinter --------- Co-authored-by: Mikalai Kukhta Co-authored-by: Nicolas Vuillamy Co-authored-by: Nicolas Vuillamy --- .github/workflows/mega-linter.yml | 2 +- CHANGELOG.md | 1 + README.md | 31 ++++++++++++++++--------------- client/src/extension.ts | 5 +++-- docs/index.md | 31 ++++++++++++++++--------------- package.json | 6 ++++++ 6 files changed, 43 insertions(+), 33 deletions(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 847dc00..5a25059 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -7,7 +7,7 @@ on: # Trigger mega-linter at every push. Action will also be visible from Pull Requests to master push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions) pull_request: - branches: [master] + branches: [main] env: #Uncomment to activate variables below # Apply linter fixes configuration diff --git a/CHANGELOG.md b/CHANGELOG.md index eb31c09..0c5b51c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix doc deployment - Add stale workflow +- Added new setting `showProblemsView` that controls if Problems View should open after initial lint pass ## [3.0.0] 2023-12-17 diff --git a/README.md b/README.md index 9add663..c0ad719 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ ## Features | Command | Description | Access | -|----------------------------------------|--------------------------------------------------------------------------------------------------|----------------------------------------------------------| +| -------------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------- | | **Analyze code** | Lint the code of the current file | Ctrl+Shift+F9
Contextual
Status bar
Commands | | **Format** | Format the code of the current file | Shift+Alt+F
Contextual
Commands | | **Fix all auto-fixable problems** | Fix the code of the current file | Contextual
Commands | @@ -40,20 +40,21 @@ ## Extension Settings -| Parameter | Description | Default | -|------------------------------|-----------------------------------------------------------------------------------------------------------------|----------------------| -| `groovyLint.enable` | Controls whether GroovyLint is enabled or not | true | -| `groovyLint.lint.trigger` | Run the linter on save (onSave), on type (onType) , or on user request | onSave | -| `groovyLint.format.enable` | Controls whether the groovy formatter is enabled or not | true | -| `groovyLint.fix.enable` | Run the auto-fixer on save (onSave), on type (onType) , or on user request | true | -| `groovyLint.fix.trigger` | Run the fixer on save (onSave), or on user request | user | -| `groovyLint.basic.loglevel` | Linting error level (error, warning,info) | info | -| `groovyLint.basic.verbose` | Turn on to have verbose logs | false | -| `groovyLint.basic.config` | [NPM groovy lint configuration file](https://github.com/nvuillam/npm-groovy-lint#configuration) | .groovylintrc.json | -| `groovyLint.debug.enable` | Display more logs in VsCode Output panel (select "GroovyLint") for issue investigation | false | -| `groovyLint.java.executable` | Override java executable to use
Example: C:\\Program Files\\Java\\jdk1.8.0_144\\bin\\java.exe | java | -| `groovyLint.java.options` | Override java options to use | "-Xms256m,-Xmx2048m" | -| `groovyLint.insight.enable` | Allow to send anonymous usage statistics used only to improve the tool (we will of course never send your code) | false | +| Parameter | Description | Default | +| ----------------------------- | --------------------------------------------------------------------------------------------------------------- | -------------------- | +| `groovyLint.enable` | Controls whether GroovyLint is enabled or not | true | +| `groovyLint.lint.trigger` | Run the linter on save (onSave), on type (onType) , or on user request | onSave | +| `groovyLint.format.enable` | Controls whether the groovy formatter is enabled or not | true | +| `groovyLint.fix.enable` | Run the auto-fixer on save (onSave), on type (onType) , or on user request | true | +| `groovyLint.fix.trigger` | Run the fixer on save (onSave), or on user request | user | +| `groovyLint.basic.loglevel` | Linting error level (error, warning,info) | info | +| `groovyLint.basic.verbose` | Turn on to have verbose logs | false | +| `groovyLint.basic.config` | [NPM groovy lint configuration file](https://github.com/nvuillam/npm-groovy-lint#configuration) | .groovylintrc.json | +| `groovyLint.debug.enable` | Display more logs in VsCode Output panel (select "GroovyLint") for issue investigation | false | +| `groovyLint.java.executable` | Override java executable to use
Example: C:\\Program Files\\Java\\jdk1.8.0_144\\bin\\java.exe | java | +| `groovyLint.java.options` | Override java options to use | "-Xms256m,-Xmx2048m" | +| `groovyLint.insight.enable` | Allow to send anonymous usage statistics used only to improve the tool (we will of course never send your code) | false | +| `groovyLint.showProblemsView` | Show Problems View once after start | false | ## Troubleshooting diff --git a/client/src/extension.ts b/client/src/extension.ts index 5f97b73..8355a27 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -150,8 +150,9 @@ async function updateStatus(status: StatusParams): Promise { else if (status.state.startsWith('lint.end')) { // Update status list statusList = statusList.filter(statusObj => statusObj.id !== status.id); - // Show markers panel just once (after the user can choose to close it) - if (outputChannelShowedOnce === false) { + + // Show Problems panel just once (if user didn't choose otherwise) + if (outputChannelShowedOnce === false && vscode.workspace.getConfiguration('groovyLint').get('showProblemsView', true) === true) { vscode.commands.executeCommand('workbench.panel.markers.view.focus'); outputChannelShowedOnce = true; } diff --git a/docs/index.md b/docs/index.md index 9add663..c0ad719 100644 --- a/docs/index.md +++ b/docs/index.md @@ -21,7 +21,7 @@ ## Features | Command | Description | Access | -|----------------------------------------|--------------------------------------------------------------------------------------------------|----------------------------------------------------------| +| -------------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------- | | **Analyze code** | Lint the code of the current file | Ctrl+Shift+F9
Contextual
Status bar
Commands | | **Format** | Format the code of the current file | Shift+Alt+F
Contextual
Commands | | **Fix all auto-fixable problems** | Fix the code of the current file | Contextual
Commands | @@ -40,20 +40,21 @@ ## Extension Settings -| Parameter | Description | Default | -|------------------------------|-----------------------------------------------------------------------------------------------------------------|----------------------| -| `groovyLint.enable` | Controls whether GroovyLint is enabled or not | true | -| `groovyLint.lint.trigger` | Run the linter on save (onSave), on type (onType) , or on user request | onSave | -| `groovyLint.format.enable` | Controls whether the groovy formatter is enabled or not | true | -| `groovyLint.fix.enable` | Run the auto-fixer on save (onSave), on type (onType) , or on user request | true | -| `groovyLint.fix.trigger` | Run the fixer on save (onSave), or on user request | user | -| `groovyLint.basic.loglevel` | Linting error level (error, warning,info) | info | -| `groovyLint.basic.verbose` | Turn on to have verbose logs | false | -| `groovyLint.basic.config` | [NPM groovy lint configuration file](https://github.com/nvuillam/npm-groovy-lint#configuration) | .groovylintrc.json | -| `groovyLint.debug.enable` | Display more logs in VsCode Output panel (select "GroovyLint") for issue investigation | false | -| `groovyLint.java.executable` | Override java executable to use
Example: C:\\Program Files\\Java\\jdk1.8.0_144\\bin\\java.exe | java | -| `groovyLint.java.options` | Override java options to use | "-Xms256m,-Xmx2048m" | -| `groovyLint.insight.enable` | Allow to send anonymous usage statistics used only to improve the tool (we will of course never send your code) | false | +| Parameter | Description | Default | +| ----------------------------- | --------------------------------------------------------------------------------------------------------------- | -------------------- | +| `groovyLint.enable` | Controls whether GroovyLint is enabled or not | true | +| `groovyLint.lint.trigger` | Run the linter on save (onSave), on type (onType) , or on user request | onSave | +| `groovyLint.format.enable` | Controls whether the groovy formatter is enabled or not | true | +| `groovyLint.fix.enable` | Run the auto-fixer on save (onSave), on type (onType) , or on user request | true | +| `groovyLint.fix.trigger` | Run the fixer on save (onSave), or on user request | user | +| `groovyLint.basic.loglevel` | Linting error level (error, warning,info) | info | +| `groovyLint.basic.verbose` | Turn on to have verbose logs | false | +| `groovyLint.basic.config` | [NPM groovy lint configuration file](https://github.com/nvuillam/npm-groovy-lint#configuration) | .groovylintrc.json | +| `groovyLint.debug.enable` | Display more logs in VsCode Output panel (select "GroovyLint") for issue investigation | false | +| `groovyLint.java.executable` | Override java executable to use
Example: C:\\Program Files\\Java\\jdk1.8.0_144\\bin\\java.exe | java | +| `groovyLint.java.options` | Override java options to use | "-Xms256m,-Xmx2048m" | +| `groovyLint.insight.enable` | Allow to send anonymous usage statistics used only to improve the tool (we will of course never send your code) | false | +| `groovyLint.showProblemsView` | Show Problems View once after start | false | ## Troubleshooting diff --git a/package.json b/package.json index 2c371b8..7cb4c6f 100644 --- a/package.json +++ b/package.json @@ -191,6 +191,12 @@ "default": true, "description": "Controls whether GroovyLint is enabled or not." }, + "groovyLint.showProblemsView": { + "scope": "resource", + "type": "boolean", + "default": true, + "description": "Show Problems View once after start." + }, "groovyLint.lint.trigger": { "scope": "resource", "type": "string",