microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.71k stars 765 forks source link

Python Syntax Highlighting Issue #6191

Closed andrejtetkic closed 1 month ago

andrejtetkic commented 2 months ago

Type: Bug

Behaviour

When you comment by using "#" right after a closed square bracket "]", the bracket also becomes green as if it were commented out

Steps to reproduce:

  1. Close a Square Bracket "]"
  2. Without any other characters in between start a comment with "#"

Diagnostic data

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

``` Improper comment highlighting ```

Extension version: 2024.10.0 VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.22631 Modes:

User Settings

``` languageServer: "Pylance" ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |Amazon Q|amazonwebservices.amazon-q-vscode|1.16.0| |AWS Toolkit|amazonwebservices.aws-toolkit-vscode|3.15.0| |Azure Repos|ms-vscode.azure-repos|0.38.0| |Blender Development|JacquesLucke.blender-development|0.0.21| |C/C++|ms-vscode.cpptools|1.21.3| |C/C++ Extension Pack|ms-vscode.cpptools-extension-pack|1.3.0| |C/C++ Themes|ms-vscode.cpptools-themes|2.0.0| |CMake|twxs.cmake|0.0.17| |CMake Tools|ms-vscode.cmake-tools|1.18.43| |Data Workspace|ms-mssql.data-workspace-vscode|0.5.0| |Git History|donjayamanne.githistory|0.6.20| |GitHub Codespaces|GitHub.codespaces|1.17.2| |GitHub Copilot Chat|GitHub.copilot-chat|0.17.1| |Go|golang.go|0.42.0| |HTML Preview|george-alisson.html-preview-vscode|0.2.5| |isort|ms-python.isort|2023.10.1| |JavaScript Debugger|ms-vscode.js-debug|1.91.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.2| |Jupyter|ms-toolsai.jupyter|2024.6.0| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Keymap|ms-toolsai.jupyter-keymap|1.1.2| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.18| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |Kivy|BattleBas.kivy-vscode|0.5.5| |Live Server|ritwickdey.LiveServer|5.7.9| |Makefile Tools|ms-vscode.makefile-tools|0.9.10| |MySQL|formulahendry.vscode-mysql|0.5.0| |PowerShell|ms-vscode.powershell|2024.2.2| |Pylance|ms-python.vscode-pylance|2024.7.1| |Pymakr|Pycom.pymakr|2.22.5| |PYQT Integration|zhoufeng.pyqt-integration|0.2.0| |Python|ms-python.python|2024.10.0| |Python Debugger|ms-python.debugpy|2024.8.0| |Qt for Python|seanwu.vscode-qt-for-python|7.6.0| |Remote Repositories|ms-vscode.remote-repositories|0.40.0| |SQL Bindings|ms-mssql.sql-bindings-vscode|0.4.0| |SQL Database Projects|ms-mssql.sql-database-projects-vscode|1.4.1| |SQL Server (mssql)|ms-mssql.mssql|1.22.1| |SQLite|alexcvzz.vscode-sqlite|0.14.1| |SQLite Viewer|qwtel.sqlite-viewer|0.5.10| |SQLTools|mtxr.sqltools|0.28.3| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |TabOut|albert.TabOut|0.2.2| |VS Code Counter|uctakeoff.vscode-counter|3.4.0|
System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 5900X 12-Core Processor (24 x 3700)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.92GB (21.30GB free)| |Process Argv|--crash-reporter-id c2801722-b602-4fff-8204-8a1243dc288b| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 01bff139:31013167 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 newcmakeconfigv2:31071590 impr_priority:31102340 refactort:31101459 ccplti:31103428 pythonrstrctxt:31103193 ```
debonte commented 2 months ago

I'm unable to repro this.

image

Can you please provide a complete code sample that repros this behavior? Also, if you have other extensions installed, please try temporarily disabling them to see if Pylance is actually causing this.

github-actions[bot] commented 1 month ago

This issue has been closed automatically because it needs more information and has not had recent activity. If the issue still persists, please reopen with the information requested. Thanks.