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

Rename symbol (F2) to rename one variable name fully mess your whole script #2367

Closed
neuf-de-pixel opened this issue Feb 10, 2022 · 4 comments
Assignees
Labels
waiting for user response Requires more information from user

Comments

@neuf-de-pixel
Copy link

neuf-de-pixel commented Feb 10, 2022

Behaviour

Expected vs. Actual

Expected : using F2 does allow to JUST rename variable names
Actual : using F2 to rename variable names and ADD blank lines to your script (or mess it up completely if you do it twice)

Steps to reproduce:

  1. declare a variable in a script
  2. click on the variable name
  3. use 'F2' key to rename
  4. rename the variable
  5. press enter
  6. your script is now messy

Python extension v2022.0.1814523869
Python version installed 3.10.0
VS Code 1.64.1

Example :
Before renaming anything:
python 1
After renaming the "white" variable to "wwhite":
python2
Then after renaming again a variable name (here "blue" to "bllue"):
python 3

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
User Settings


defaultLS: {"defaultLSType":"Pylance"}

downloadLanguageServer: true

envFile: "<placeholder>"

venvPath: "<placeholder>"

venvFolders: "<placeholder>"

condaPath: "<placeholder>"

pipenvPath: "<placeholder>"

poetryPath: "<placeholder>"

languageServer: "Pylance"

linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: false
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"

sortImports
• args: "<placeholder>"
• path: "<placeholder>"

formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "autopep8"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"

testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true

terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"

experiments
• enabled: true
• optInto: []
• optOutFrom: []

insidersChannel: "off"

tensorBoard
• logDirectory: "<placeholder>"

@neuf-de-pixel neuf-de-pixel reopened this Feb 10, 2022
@neuf-de-pixel neuf-de-pixel changed the title Rename symbol (F2) does not work Rename symbol (F2) insert one blank line for each line of your script Feb 10, 2022
@neuf-de-pixel neuf-de-pixel changed the title Rename symbol (F2) insert one blank line for each line of your script Rename symbol (F2) to rename one variable name fully mess your whole script Feb 10, 2022
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Feb 10, 2022
@judej judej added the needs investigation Could be an issue - needs investigation label Feb 10, 2022
@github-actions github-actions bot removed the triage label Feb 10, 2022
@luabud luabud self-assigned this Mar 1, 2022
@luabud luabud added triage and removed needs investigation Could be an issue - needs investigation classify labels Mar 1, 2022
@judej judej added the needs investigation Could be an issue - needs investigation label Mar 14, 2022
@judej judej assigned heejaechang and unassigned luabud Mar 14, 2022
@github-actions github-actions bot removed the triage label Mar 14, 2022
@heejaechang
Copy link
Contributor

@neuf-de-pixel I can't repro the issue. can you provide a log for us to take a look? here are instructions on how to get logs - https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue

also, it would be nice if you can share the file that showing the issue (especially if it is line ending or char code issue)

@heejaechang heejaechang added waiting for user response Requires more information from user and removed needs investigation Could be an issue - needs investigation labels Mar 14, 2022
@heejaechang
Copy link
Contributor

@neuf-de-pixel I kind of repro this today, for me, it was due to multiple extensions (Pylance and other python tool) trying to do rename that messed up the file.

once I disable/uninstall those conflicting extensions and leave only Pylance in vscode, it worked as expected. have you checked if you uninstall/disable all other extensions and leave pylance only, this still repro?

@heejaechang
Copy link
Contributor

I will close this issue. please re-open if it repro with latest pylance.

@AsmisAlan
Copy link

Hi, If someone is looking for a solution please check this other issue: microsoft/vscode-python#17123

  1. Install Pylance extension.
  2. change your vscode setting to use pylance "python.languageServer": "Pylance"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for user response Requires more information from user
Projects
None yet
Development

No branches or pull requests

5 participants