PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

Features not working consistently: task list, navigation dropdown menus

Open AbhimanyuVS opened this issue 11 months ago • 9 comments

Describe the bug

This issue is related to issues #7151, #7254, and #8114.

When programming in Python with Visual Studio 2022 Community - both standard release and preview release - certain features do not work correctly or consistently. In particular, the task list and the navigation dropdown menus.

The task list was the main issue. For the past 15 years, I have found the Visual Studio task list to be an invaluable tool. However, as I reported in issue #7254 (which was then merged into issue #7151), the task list has not been working properly in VS2022.

In issue #8114, @StellaHuang95 suggested I download and use the preview release of VS2022, so I did that, and the task list started working again... sometimes. Opening VS2022Preview will sometimes load the task list, and other times will simply not.

The same is true for the navigation dropdown menus. Sometimes these load correctly, and other times they simply do not. In fact, this varies between open projects/files.

Steps to Reproduce

  1. Open VS2022Preview.
  2. Check the task list and the navigation dropdowns.

Expected behavior

The task list and navigation dropdown menus should always load correctly and consistently.

Additional context and screenshots

Screen recording demonstrating this issue (link should remain active until 1 Jan 2026): https://1drv.ms/v/s!Aux-sta5GHQDi8pXHUNiORv5yMFr5Q?e=ozo4bH

Configuration information (If you are providing a diagnostics file (see below), skip this section)

VS Version: 17.13.0 Preview 2.1 PTVS version: 17.0.24323.2 Python version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] Debugger Type (if applicable): N/A

Diagnostics file

PythonToolsDiagnostics_20250101031732.log

AbhimanyuVS avatar Jan 01 '25 11:01 AbhimanyuVS

Hi, this has been pending for a bit. Is there anything I can do to help out with this?

AbhimanyuVS avatar Jan 27 '25 11:01 AbhimanyuVS

@debonte, is there anything I can do to help with this issue?

AbhimanyuVS avatar Feb 09 '25 09:02 AbhimanyuVS

Next time you see this problem occur, can you grab the contents of the Pylance log in the Output pane? See example below, where the log output is quite short because I only just opened the current solution.

Image

debonte avatar Feb 12 '25 00:02 debonte

@debonte,

Sure, this happens almost every time I open the IDE. It's a coin-flip as to whether the tasks and nav-dropdowns will load correctly.

I just opened the IDE. Here is what I see:

The task list: Image

The Pylance log in the output pane: Image

Does this help? Is there any other information you require from my end?

AbhimanyuVS avatar Feb 12 '25 05:02 AbhimanyuVS

@debonte, is the task list populated by pylance or is it a separate system?

gramster avatar Feb 12 '25 22:02 gramster

The data is provided by Pylance. I'm not sure which side the issue is on yet. I was able to reproduce this symptom (no tasks) after creating a new project. Trying to debug that now.

debonte avatar Feb 12 '25 23:02 debonte

@bschnurr, I've been able to repro the task list issue and I think it may be related to your https://github.com/microsoft/PTVS/pull/8033. Here's what I'm seeing:

  • The issue repros consistently after creating a new project:
    • Create new "Python Application" project
    • Add TODO: Foo to the .py file
    • The task does not appear in the task list. However regular diagnostics (ex. parse errors) do show up.
  • I also frequently see it when opening existing projects. When debugging the experimental instance, I think it happens for me 100% of the time. But when doing ad hoc testing with a regular instance of VS it sometimes repro'd and sometimes didn't. I didn't figure out why.
  • When it does repro, the issue is that PythonLanguageClient.GetSettings is called (call stack below) without a scopeUri and although _clientContexts contains a context for the new project, that context has a non-null RootPath so it isn't found. This causes GetSettings to no-op and therefore Pylance doesn't get the array of "task list tokens".

Image

>	Microsoft.PythonTools.dll!Microsoft.PythonTools.LanguageServerClient.PythonLanguageClient.GetSettings(System.Uri scopeUri) Line 371	C#
 	Microsoft.PythonTools.dll!Microsoft.PythonTools.LanguageServerClient.PythonLanguageClient.TriggerWorkspaceUpdateConfig() Line 246	C#
 	Microsoft.PythonTools.dll!Microsoft.PythonTools.LanguageServerClient.PythonLanguageClient.OnServerInitializedAsync() Line 241	C#
 	Microsoft.VisualStudio.LanguageServer.Client.Implementation.dll!Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageClientInstance.ActivateLanguageClientAsync(string workspaceLocation, System.Threading.CancellationToken token)	Unknown

I haven't looked much at the navigation bar issue. One thing I noticed was that after making changes to a file, the contents of the navigation combo boxes doesn't update until the file is closed and reopened. I'm not sure if this is somehow related.

debonte avatar Feb 13 '25 02:02 debonte

hmm. so default workspace settings should be returned maybe?

bschnurr avatar Feb 13 '25 02:02 bschnurr

@debonte,

I haven't looked much at the navigation bar issue. One thing I noticed was that after making changes to a file, the contents of the navigation combo boxes doesn't update until the file is closed and reopened. I'm not sure if this is somehow related.

It's similarly a coin-flip. Sometimes everything loads perfectly fine on startup. Other times, the files need to be closed and re-opened in order for the nav-dropdowns to populate.

AbhimanyuVS avatar Feb 13 '25 04:02 AbhimanyuVS