microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.72k stars 766 forks source link

Can't turn off autcomplete addBrackets setting #2526

Closed VaustXIII closed 2 years ago

VaustXIII commented 2 years ago

Issue Type: Bug

Behaviour

Expected vs. Actual

When typing function and choosing an autocomplete option, the extension automatically adds brackets. I have searched the settings to turn off that feature, but to no avail. I tried searching extension settings for keywords: "brackets", "autocomplete", "parentheses", etc. I tried googling but found only deprecated(?) options like python.autocomplete.addBrackets and python.analysis.completeFunctionParens

Expected: Can turn off the setting

ran
# pressing tab for autocomplete
range

Actual: Can't turn off the setting, stuck with default behavior

ran
# pressing tab for autocomplete
range(stop)

Steps to reproduce:

Just start typing a function and choose an autocomplete option

Diagnostic data

User Settings

``` defaultLS: {"defaultLSType":"Jedi"} downloadLanguageServer: true envFile: "" venvPath: "" venvFolders: "" condaPath: "" pipenvPath: "" poetryPath: "" languageServer: "Jedi" linting • enabled: true • cwd: "" • Flake8Args: "" • flake8Enabled: false • flake8Path: "" • lintOnSave: true • banditArgs: "" • banditEnabled: false • banditPath: "" • mypyArgs: "" • mypyEnabled: false • mypyPath: "" • pycodestyleArgs: "" • pycodestyleEnabled: false • pycodestylePath: "" • prospectorArgs: "" • prospectorEnabled: false • prospectorPath: "" • pydocstyleArgs: "" • pydocstyleEnabled: false • pydocstylePath: "" • pylamaArgs: "" • pylamaEnabled: false • pylamaPath: "" • pylintArgs: "" • pylintPath: "" sortImports • args: "" • path: "" formatting • autopep8Args: "" • autopep8Path: "" • provider: "black" • blackArgs: "" • blackPath: "" • yapfArgs: "" • yapfPath: "" testing • cwd: "" • debugPort: 3000 • nosetestArgs: "" • nosetestsEnabled: undefined • nosetestPath: "" • promptToConfigure: true • pytestArgs: "" • pytestEnabled: false • pytestPath: "" • unittestArgs: "" • unittestEnabled: false • autoTestDiscoverOnSaveEnabled: true terminal • activateEnvironment: true • executeInFileDir: "" • launchArgs: "" experiments • enabled: true • optInto: [] • optOutFrom: [] tensorBoard • logDirectory: "" ```

Extension version: 2022.4.0 VS Code version: Code 1.66.0 (e18005f0f1b33c29e81d732535d8c0e47cafb0b5, 2022-03-30T05:50:14.623Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.82GB (5.17GB free)| |Process Argv|--crash-reporter-id 088f1885-c167-44fe-9526-30aa212774ff| |Screen Reader|no| |VM|0%|
heejaechang commented 2 years ago

@VaustXIII range is a class, not function, so our option "python.analysis.completeFunctionParens" won't affect it. can you uninstall or disable all extensions you installed on vscode and only enable python/pylance and try again to see whether it reproes?

VaustXIII commented 2 years ago

@VaustXIII range is a class, not function, so our option "python.analysis.completeFunctionParens" won't affect it. can you uninstall or disable all extensions you installed on vscode and only enable python/pylance and try again to see whether it reproes?

The behavior is the same with functions too

def some_func(p, q, r):
    pass

# I type
some_

# I press 'Tab' and get
some_func(p, q, r)
# the cursor is selecting 'p', I can type smth else instead of it, then press Tab again to go to 'q' and so on

# What I would like to get after pressing 'Tab'
some_func

By the way I could not find "python.analysis.completeFunctionParens" in settings. I tried adding it to settings.json manually, but it gets greyed out and "Unknown configuration setting" box pops up on hover.

I have tried disabling all extensions except for python, unfortunately it didn't help. Looks like this parentheses completion logic does come from the python extension, but I just can't find the setting controlling it

VaustXIII commented 2 years ago

@heejaechang is there a way to remove "waiting for user response" label?

heejaechang commented 2 years ago

@VaustXIII you are using pylance right? ah, it looks like you are using Jedi. if you intentionally using Jedi, this bug should go to Jedi repo (https://github.com/pappasam/jedi-language-server), if you are not intentionally using it, please, install Pylance from market place, then the option will show up and you should be able to disable auto parentheses behavior.

VaustXIII commented 2 years ago

@heejaechang Yep, the one that comes with the Python extension image

heejaechang commented 2 years ago

@VaustXIII if you are intentionally using Jedi, you should open the issue on Jedi repo.