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

Outliner no alerting if functions or classes are doubled #6992

Closed
ManPython opened this issue Feb 15, 2025 · 10 comments
Closed

Outliner no alerting if functions or classes are doubled #6992

ManPython opened this issue Feb 15, 2025 · 10 comments
Assignees
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@ManPython
Copy link

ManPython commented Feb 15, 2025

Type: Bug

Behaviour

There is misunderstanding witch functions is called when debugging.

Steps to reproduce:

create class

class Bike:
    name = ""
    gear = 0

# create objects of class
bike1 = Bike()
bike1 = Bike() # doubled

Extension version: 2025.0.0
VS Code version: Code 1.97.2 (e54c774e0add60467559eb0d1e229c6452cf8447, 2025-02-12T23:20:35.343Z)
OS version: Windows_NT x64 10.0.22631
Modes:

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


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
alchemy65 alc 1.0.8
arepl alm 3.0.0
arm-debugger Arm 1.4.4
Bookmarks ale 13.5.0
bookmarksng RK 0.0.24
cals-table-viewer del 0.1.0
cmake twx 0.0.17
cmake-tools ms- 1.19.52
cmsis-csolution Arm 1.48.0
code-ca65 tlg 1.2.6
code-runner for 0.12.2
compilemql4 Kei 0.0.1
copilot Git 1.271.0
copilot-chat Git 0.24.1
cortex-debug mar 1.12.1
cpptools-extension-pack ms- 1.3.0
cpptools-themes ms- 2.0.0
debug-tracker-vscode mcu 0.0.15
debugger-for-chrome msj 4.13.0
debugpy ms- 2025.0.1
device-manager Arm 1.13.2
dscodegpt Dan 3.8.55
environment-manager Arm 1.10.0
f5anything dis 1.2.0
file-downloader min 1.0.13
geo-data-viewer Ran 2.6.0
gi rub 0.2.11
git-graph mhu 1.30.0
git-merger sha 0.4.1
git-project-manager fel 1.8.2
git-temporal-vscode bee 1.0.0
githd hui 2.5.5
gitignore cod 0.9.0
gitlens eam 16.3.0
gitstash art 5.2.0
go-doc msy 1.0.1
go-to-word jak 0.2.6
hexeditor ms- 1.11.1
intellicode-api-usage-examples Vis 0.2.9
isort ms- 2023.10.1
jinja who 0.0.8
js-debug ms- 1.97.1
js-debug-companion ms- 1.1.3
json Mee 0.1.2
json Zai 2.0.2
jupyter ms- 2024.11.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.1.0
keil-studio-pack Arm 1.18.4
language-gas-x86 bas 0.0.2
latex-workshop Jam 10.7.5
MagicPython mag 1.1.0
masm blt 0.0.4
material-icon-theme PKi 5.19.0
memory-view mcu 0.0.25
mq4 ner 1.0.4
numbered-bookmarks ale 8.5.0
peripheral-inspector ecl 1.6.0
peripheral-viewer mcu 1.4.6
php-debug xde 1.35.0
powershell ms- 2025.0.0
profitrobots-mq5-snippets sib 1.5.0
project-manager ale 12.8.0
pyqt-integration zho 0.2.0
pyside2-vsc Oll 0.1.0
python ms- 2025.0.0
python-coding-conventions igr 0.0.4
quick-python-print Wei 0.3.1
rainbow-csv mec 3.17.0
remote-explorer ms- 0.4.3
remote-repositories ms- 0.42.0
remote-ssh ms- 0.117.1
remotehub Git 0.65.2024112101
renesas-debug Ren 25.4.3
rtos-views mcu 0.0.7
serial-monitor ecl 1.0.2
sftp Nat 1.16.3
start-git-bash McC 1.2.1
status-bar-tasks Gua 0.3.0
terminal for 0.0.10
terminal-keeper ngu 1.1.53
test-adapter-converter ms- 0.2.1
todo-tree Gru 0.0.226
trailing-spaces sha 0.4.1
v-snippets lor 0.1.20
virtual-hardware Arm 0.6.3
vs-deploy mkl 14.0.0
vscode-chat-gpt ika 1.2.0
vscode-clangd llv 0.1.33
vscode-django bat 1.15.0
vscode-edge-devtools ms- 2.1.8
vscode-firefox-debug fir 2.14.1
vscode-gedcom flo 0.0.4
vscode-git-cruise Guo 0.2.4
vscode-git-tags how 1.4.4
vscode-gitflow Ser 1.3.27
vscode-go-autotest win 1.6.0
vscode-icons vsc 12.11.0
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
vscode-markdownlint Dav 0.58.2
vscode-pylance ms- 2025.2.1
vscode-python-test-adapter lit 0.8.2
vscode-remote-workspace mkl 0.42.0
vscode-sshfs Kel 1.26.1
vscode-terminal-here Tyr 0.2.4
vscode-test-explorer hbe 2.22.1
vscode-todo-parser min 1.9.1
vscode-yaml red 1.16.0
vscodeintellicode Vis 1.3.2
xml Dot 2.5.1
@eleanorjboyd
Copy link
Member

Hi! Could you clarify a bit more the expected and actual behavior?

@eleanorjboyd eleanorjboyd self-assigned this Feb 18, 2025
@ManPython
Copy link
Author

I never know that in code if long have more this same names (python don't care this).

microsoft/vscode#49925 (comment)

I always confused that collapsed tree of outliner is again opened and user must collapse, find right class and the functions inside if big file.

Regarding microsoft/vscode#240961 it's depend refactoring names, find duplication (should be duplicated on red color and maybe counter (1), (2), etc..), etc. or see real structure in relation to other similar classes or chat GPT.

@eleanorjboyd
Copy link
Member

So are you expecting something in the UI to warn you that there are two things called bike1?

@ManPython
Copy link
Author

Yes, or just list this same in elements list in outliner (Then more easy to find similar code parts, it can be case where was paste part far from current [eg. not only double paste], as wrong place, etc.). Soo red color for font, counter how many duplicated bike1(3) - eg

$${\color{red}bike1(3)}$$ $${\color{black}bike2}$$ $${\color{black}bike3}$$ $${\color{black}bike4}$$ $${\color{red}bike1(3)}$$ $${\color{red}bike1(3)}$$ $${\color{black}bike5}$$ $${\color{red}bike1(3)}$$

@eleanorjboyd eleanorjboyd removed their assignment Feb 27, 2025
@eleanorjboyd eleanorjboyd transferred this issue from microsoft/vscode-python Feb 27, 2025
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Feb 27, 2025
@debonte
Copy link
Contributor

debonte commented Feb 28, 2025

Yes, or just list this same in elements list in outliner

Can you clarify what you mean by "outliner"? A screenshot might be helpful.

@ManPython
Copy link
Author

@debonte
Copy link
Contributor

debonte commented Feb 28, 2025

So are you expecting something in the UI to warn you that there are two things called bike1?

Yes, or just list this same in elements list in outline...

There's only one bike1 variable in your example above. The first bike1 = Bike() statement declares the bike1 variable and the second bike1 = Bike() statement is an assignment to the existing bike1 variable.

The Outline pane only shows declarations, not assignments. So the fact that bike1 only appears there once with your example code above is by design. Showing all assignments would introduce a lot of noise into the Outline pane.

Image

Reassigning existing variables is a very common thing. And even assigning the same value to the same variable in multiple places is not unusual -- for example, assigning None to a "result" variable in multiple places within a function when handling error cases.

The feature you're requesting seems like it would be more appropriate for a linter rather than a language server and type checker. I'm going to move it to our enhancements discussions area though and if we get enough up-votes on it we will reconsider.

@microsoft microsoft locked and limited conversation to collaborators Feb 28, 2025
@debonte debonte converted this issue into a discussion Feb 28, 2025
@debonte debonte reopened this Feb 28, 2025
@debonte debonte converted this issue into a discussion Feb 28, 2025
@debonte debonte reopened this Feb 28, 2025
@debonte
Copy link
Contributor

debonte commented Feb 28, 2025

Seems like there's a problem with GitHub's "Convert to discussion" feature at the moment. I'll move this later.

@debonte debonte added enhancement New feature or request and removed needs repro Issue has not been reproduced yet labels Feb 28, 2025
@debonte
Copy link
Contributor

debonte commented Feb 28, 2025

@debonte
You are wrong, debuger on outline allow user to have in code this same parts code, and this is problem.
#6992 (comment)

Can you provide a real-world example that shows the issue that you're talking about?

@debonte debonte converted this issue into a discussion Mar 2, 2025
@debonte debonte reopened this Mar 2, 2025
@debonte
Copy link
Contributor

debonte commented Mar 2, 2025

Closing in favor of #7003.

@debonte debonte closed this as completed Mar 2, 2025
@debonte debonte added the duplicate This issue or pull request already exists label Mar 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants