Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't open the output pane when sorting imports on save fails #2522

Closed
JostCrow opened this issue Sep 7, 2018 · 4 comments · Fixed by #4565
Closed

Don't open the output pane when sorting imports on save fails #2522

JostCrow opened this issue Sep 7, 2018 · 4 comments · Fixed by #4565
Assignees
Labels
area-formatting feature-request Request for new features or functionality good first issue

Comments

@JostCrow
Copy link

JostCrow commented Sep 7, 2018

When I have my terminal open and I edit a file where I get a linting error (always happens for Django migrations) it jumps from my terminal to the output pane. This is really annoying behavior especially if you want to use the terminal again.

Environment data

  • VS Code version: 1.26.1
  • Extension version (available under the Extensions sidebar): 2018.8.0
  • OS and version: Solus 3.99999
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Relevant/affected Python packages and their versions: django 1.11

Actual behavior

When a linting error pops up, it opens the output pane. It does not matter if the bottom pane is open or not.

Expected behavior

It only shows the notification message and does not open the output pane.

Steps to reproduce:

  1. Have your pylint on.
  2. Save django migration file.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Error: Invalid patch string: Skipped 1 files

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

workbench.main.js:129319 Invalid patch string: Skipped 1 files
NotificationsAlerts.onDidNotificationChange @ workbench.main.js:129319
(anonymous) @ workbench.main.js:129307
Emitter.fire @ workbench.main.js:13823
NotificationsModel.notify @ workbench.main.js:128923
NotificationService.notify @ workbench.main.js:185068
MainThreadMessageService._showMessage @ workbench.main.js:170596
MainThreadMessageService._showMessage @ workbench.main.js:170561
MainThreadMessageService.$showMessage @ workbench.main.js:170556
RPCProtocol._doInvokeHandler @ workbench.main.js:172387
RPCProtocol._invokeHandler @ workbench.main.js:172372
RPCProtocol._receiveRequest @ workbench.main.js:172327
RPCProtocol._receiveOneMessage @ workbench.main.js:172310
(anonymous) @ workbench.main.js:172247
(anonymous) @ workbench.main.js:172420
Emitter.fire @ workbench.main.js:13823
acceptChunk @ workbench.main.js:23007
Protocol.Protocol.firstDataChunk._socketDataListener @ workbench.main.js:23033
emitOne @ events.js:116
emit @ events.js:211
addChunk @ _stream_readable.js:263
readableAddChunk @ _stream_readable.js:250
Readable.push @ _stream_readable.js:208
onread @ net.js:594
workbench.main.js:20410 [Extension Host] rejected promise not handled within 1 second (at Timeout._onTimeout (/usr/share/vscode/resources/app/out/vs/workbench/node/extensionHostProcess.js:50805:37))
log @ workbench.main.js:20410
ExtensionHostProcessWorker._logExtensionHostMessage @ workbench.main.js:167806
(anonymous) @ workbench.main.js:167645
emitTwo @ events.js:126
emit @ events.js:214
emit @ internal/child_process.js:772
_combinedTickCallback @ internal/process/next_tick.js:141
_tickCallback @ internal/process/next_tick.js:180
workbench.main.js:81025   ERR Invalid patch string: Skipped 1 files: Error: Invalid patch string: Skipped 1 files
    at diff_match_patch.patch_fromText (/home/jorik/.vscode/extensions/ms-python.python-2018.8.0/out/client/common/editor.js:234:19)
    at Object.getTextEditsFromPatch (/home/jorik/.vscode/extensions/ms-python.python-2018.8.0/out/client/common/editor.js:51:36)
    at PythonImportSortProvider.<anonymous> (/home/jorik/.vscode/extensions/ms-python.python-2018.8.0/out/client/providers/importSortProvider.js:57:33)
    at Generator.next (<anonymous>)
    at fulfilled (/home/jorik/.vscode/extensions/ms-python.python-2018.8.0/out/client/providers/importSortProvider.js:10:58)
    at <anonymous>
@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug needs verification area-terminal labels Sep 7, 2018
@brettcannon brettcannon changed the title Please stop opening the output pane on linting error. Don't open the output pane on linting error Sep 7, 2018
@brettcannon
Copy link
Member

Can you verify this, @DonJayamanne ?

@DonJayamanne
Copy link

DonJayamanne commented Sep 8, 2018

Error: Invalid patch string: Skipped 1 files

@JostCrow

Please could you provide a copy of the django migrations file.

@JostCrow
Copy link
Author

@DonJayamanne This should already do the job for me. Just an empty migration.

# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-09-10 07:03
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
    ]

    operations = [
    ]

After some testing I did this weekend. The error that causes the output pane to be opened is the same as #2435 This also happens when I have the following in my settings.

"[python]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        },
    },

So I know for a fact that isort is causing the issue. But again it would be nice if it would only show the error notification and not show the output pane.

Because the isort function is a really nice one and only the notification message should be enough.

@DonJayamanne DonJayamanne changed the title Don't open the output pane on linting error Don't open the output pane when sorting imports on save fails Sep 12, 2018
@DonJayamanne
Copy link

DonJayamanne commented Sep 12, 2018

Agreed, will disable showing the output panel. After all an error message (popup) is displayed.

Solution - Remove the following line:
https://github.com/Microsoft/vscode-python/blob/2f7715aaf51bd1a2b29d89a5ca50c1d20fcddc2f/src/client/providers/importSortProvider.ts#L117

@DonJayamanne DonJayamanne added feature-request Request for new features or functionality needs PR area-formatting and removed area-terminal needs verification bug Issue identified by VS Code Team member as probable bug labels Sep 12, 2018
@DonJayamanne DonJayamanne removed their assignment Sep 12, 2018
@ghost ghost removed the needs PR label Feb 28, 2019
DonJayamanne pushed a commit that referenced this issue Feb 28, 2019
As per @DonJayamanne's suggestion in the conversation for issue #2522.

I've been patching this locally for the past few months, so thought I should probably feed it back up.

Fixes #2522
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-formatting feature-request Request for new features or functionality good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants