microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 293 forks source link

Jupyter Notebook autocomplete bracket adds cursor placeholder '$0' #2835

Closed syan1 closed 4 years ago

syan1 commented 5 years ago

Bug: Notebook Editor, Interactive Window, Python Editor cells

Steps to cause the bug to occur

  1. When using autocomplete in jupyter cell, $0 appears within parenthesis.

Actual & Expected behavior

vscode_error

Your Jupyter and/or Python environment

Please provide as much info as you readily know

Developer Tools Console Output

greazer commented 5 years ago

This is dependent on a setting that tells the language server to automatically add closed brackets.

stevenlis commented 5 years ago

@rchiodo seems like someone got the same issue as mine. Btw, I still have this issue. https://github.com/microsoft/vscode-python/issues/6926 https://github.com/microsoft/vscode-python/issues/6471

rchiodo commented 5 years ago

Yes we found out yesterday this is a custom setting. We (the editor) are supposed replace the $0 with a cursor position

DavidKutu commented 4 years ago

@rchiodo @DonJayamanne I can't reproduce this. Can you try it?

rchiodo commented 4 years ago

I believe you need a custom setting for it to cause that. @StevenLi-DS can you share any settings you have set?

stevenlis commented 4 years ago

@rchiodo which settings?

rchiodo commented 4 years ago

The contents of your settings.json file. Example, this is what mine looks like:

{
    "breadcrumbs.enabled": false,
    "typescriptHero.imports.multiLineTrailingComma": false,
    "git.enableSmartCommit": true,
    "workbench.editor.enablePreview": false,
    "workbench.editor.enablePreviewFromQuickOpen": false,
    "typescript.referencesCodeLens.enabled": true,
    "javascript.referencesCodeLens.enabled": true,
    "typescript.implementationsCodeLens.enabled": true,
    "editor.renderWhitespace": "all",
    "typescript.updateImportsOnFileMove.enabled": "always",
    "explorer.confirmDragAndDrop": false,
    "python.dataScience.askForKernelRestart": false,
    "liveshare.allowGuestDebugControl": true,
    "liveshare.languages.allowGuestCommandControl": true,
    "python.dataScience.remoteDebuggerPort": 8895,
    "python.dataScience.runByLine": false,
    "python.dataScience.stopOnError": false,
    "window.zoomLevel": 0,
    "explorer.confirmDelete": false,
    "liveshare.diagnosticLogging": true,
    "python.languageServer": "microsoft",
    "python.dataScience.sendSelectionToInteractiveWindow": true,
    "python.dataScience.autoOpenNotebooks": false,
    "python.dataScience.useNotebookEditor": true,
    "python.dataScience.maxOutputSize": -1,
    "python.analysis.downloadChannel": "beta",
    "python.analysis.cachingLevel": "System",
    "files.hotExit": "off",
    "python.dataScience.exportWithOutputEnabled": true,
    "terminal.integrated.inheritEnv": false,
    "python.dataScience.defaultCellMarker": "# %% CODE CELL",
    "python.dataScience.enableGather": true,
    "extensions.autoUpdate": false,
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "name": "Non italic",
                "scope": [
                    "comment",
                    "punctuation.definition.comment",
                    "comment.line.double-slash",
                    "comment.block.documentation",
                    "keyword.control.import.python",
                    "keyword.control.flow.python",
                    "variable.parameter"
                ],
                "settings": {
                    "fontStyle": ""
                }
            }
        ]
    },
    "python.pythonPath": "C:\\Users\\rchiodo.REDMOND\\AppData\\Local\\Continuum\\miniconda3\\envs\\jupyter\\python.exe",
    "files.autoSave": "onFocusChange",
    "editor.fontLigatures": true,
    "editor.fontFamily": "Consolas",
    "python.jediEnabled": false,
    "python.dataScience.jupyterLaunchTimeout": 100000,
    "python.dataScience.codeLenses": "",
    "workbench.colorTheme": "Default Light+"

}

But I don't repro you bug. We believe there's a setting for that '$0' you're getting.

syan1 commented 4 years ago

I tried a month ago on a fresh install on Windows 10. These were the only two variables that I changed.

"python.jediEnabled": false,
"python.autoComplete.addBrackets": true,
stevenlis commented 4 years ago
{
    "[python]": {
        "editor.insertSpaces": true,
        "editor.tabSize": 4
    },
    "autoDocstring.docstringFormat": "google",
    "breadcrumbs.enabled": false,
    "editor.acceptSuggestionOnEnter": "off",
    "editor.cursorBlinking": "phase",
    "editor.detectIndentation": false,
    "editor.fontSize": 16,
    "editor.formatOnPaste": false,
    "editor.minimap.maxColumn": 80,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.quickSuggestions": {
        "comments": true,
        "other": true,
        "strings": true
    },
    "editor.rulers": [
        79
    ],
    "editor.suggestSelection": "first",
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "name": "Non italic",
                "scope": [
                    "comment",
                    "punctuation.definition.comment",
                    "comment.line.double-slash",
                    "comment.block.documentation",
                    "keyword.control.import.python",
                    "keyword.control.flow.python",
                    "variable.parameter"
                ],
                "settings": {
                    "fontStyle": ""
                }
            }
        ]
    },
    "editor.wordWrap": "on",
    "editor.wordWrapColumn": 79,
    "emmet.excludeLanguages": [
        "markdown",
        "python"
    ],
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    "files.trimTrailingWhitespace": true,
    "git.autofetch": false,
    "git.autorefresh": false,
    "git.enabled": false,
    "git.path": null,
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.intellisense.unimathsymbols.enabled": true,
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,
    "latex-workshop.progress.barStyle": "none",
    "latex-workshop.progress.runIconType": "Circled",
    "latex-workshop.view.pdf.invert": 0.88,
    "latex-workshop.view.pdf.viewer": "tab",
    "liveServer.settings.NoBrowser": false,
    "liveServer.settings.donotShowInfoMsg": true,
    "markdown-preview-enhanced.liveUpdate": true,
    "markdownConverter.ConversionType": [
        "PDF"
    ],
    "polacode.transparentBackground": true,
    "python.autoComplete.addBrackets": true,
    "python.dataScience.allowImportFromNotebook": false,
    "python.dataScience.askForKernelRestart": false,
    "python.dataScience.codeLenses": "python.datascience.runcell",
    "python.dataScience.colorizeInputBox": false,
    "python.dataScience.enableCellCodeLens": false,
    "python.dataScience.enablePlotViewer": false,
    "python.dataScience.jupyterLaunchTimeout": 20000,
    "python.dataScience.notebookFileRoot": "${workspaceFolder}",
    "python.jediEnabled": false,
    "python.linting.enabled": false,
    "python.pythonPath": "C:\\Users\\liqia\\Anaconda3\\python.exe",
    "rewrap.wholeComment": false,
    "rewrap.wrappingColumn": 75,
    "spellright.configurationScope": "user",
    "spellright.documentTypes": [
        "markdown",
        "latex",
        "plaintext",
        "python"
    ],
    "spellright.language": [
        "en"
    ],
    "telemetry.enableCrashReporter": false,
    "telemetry.enableTelemetry": false,
    "terminal.integrated.inheritEnv": false,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "trailing-spaces.highlightCurrentLine": false,
    "trailing-spaces.includeEmptyLines": false,
    "vscode-json-editor.theme": "dark",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "vsintellicode.python.completionsEnabled": true,
    "window.zoomLevel": 0,
    "workbench.activityBar.visible": true,
    "workbench.colorCustomizations": {
        "[One Dark Pro]": {
            "editor.lineHighlightBackground": "#252831",
            "editor.selectionHighlightBackground": "#3d3d3dd5",
            "editor.selectionHighlightBorder": "#e0e0e000",
            "editorRuler.foreground": "#4d4d4d88"
        }
    },
    "workbench.colorTheme": "One Dark Pro",
    "workbench.iconTheme": "material-icon-theme",
    "workbench.settings.useSplitJSON": true,
    "workbench.statusBar.visible": true
}
DavidKutu commented 4 years ago

thank you @StevenLi-DS

stevenlis commented 4 years ago

Does this those icons mean anything? Snipaste_407

rchiodo commented 4 years ago

Yes. About halfway down this page it explains what the icons mean: https://code.visualstudio.com/docs/editor/intellisense

rchiodo commented 4 years ago

Somebody else should validate this as both David and I made changes.

IanMatthewHuff commented 4 years ago

I've not reproed this myself. But I can validate that with the python.autoComplete.addBrackets setting on I don't get the $0 for autocomplete. Closing.

ghost commented 4 years ago

Is the update released already? I'm still having this problem.

rchiodo commented 4 years ago

This fix is in the insider's build, not the general release yet.