profile
viewpoint

microsoft/pyright 5765

Static type checker for Python

huguesv/AgiPlayer 2

An implementation of Sierra's popular AGI adventure game engine in C#

huguesv/BatchProcess 0

A user interface to configure batch processing of files.

huguesv/cookiecutter-ptvs-ext-demo 0

Cookiecutter template that demonstrates some extended features of VS cookiecutter support

huguesv/cookiecutter-ptvs-test-project-generator 0

Cookiecutter for generating test code for Visual Studio

huguesv/cookiecutter-ptvs-test-pyodbc 0

Query examples for adventure works database using pyodbc

huguesv/jsonschema 0

An(other) implementation of JSON Schema for Python

huguesv/PTVS 0

Python Tools for Visual Studio

huguesv/pylance-release 0

Documentation and issues for Pylance

delete branch huguesv/PTVS

delete branch : dev/huguesv/pylance-unused5

delete time in 10 hours

push eventmicrosoft/PTVS

Hugues Valois

commit sha 4ecd62c8b879a6501fd50edd8e70eac72c877820

Fix usage of DJANGO_HTML_EDITOR.

view details

Hugues Valois

commit sha 0c38e8c59d583659a6a042c69dea6aeb42a900d2

Merge branch 'feature/pylance' of https://github.com/Microsoft/PTVS into dev/huguesv/pylance-unused5

view details

Hugues Valois

commit sha 4d580f34a0041f46528e7dbe14b336a48d29b642

Merge branch 'feature/pylance' of https://github.com/Microsoft/PTVS into dev/huguesv/pylance-unused5

view details

Hugues Valois

commit sha 4c4721fc06472f8b1b89cc79b6e3f3c26cc1b018

Remove django template editing support.

view details

Hugues Valois

commit sha 0b36ccb858afeb8cc6ce8b8b56e12baf11609de5

Remove more django template editor code.

view details

Hugues Valois

commit sha ce2b79e00d01caa5045d3075b4d9281334bbaf28

Remove more unused code in profiling project.

view details

Hugues Valois

commit sha d9f248849addbbb86d9fee6f33deb80a64a71a4c

Remove unused reference assemblies for web editor apis.

view details

Hugues Valois

commit sha eec451354cca7c878b856012019d1616c555ba99

Remove LiveShare, Wsl and unused localization files.

view details

Hugues Valois

commit sha 0937325bbb3e5a5ad5a6a8fa97931658df77cfe0

Merge pull request #6260 from huguesv/dev/huguesv/pylance-unused5 Remove Django Template Editor, LiveShare and Wsl

view details

push time in 10 hours

PR merged microsoft/PTVS

Remove Django Template Editor, LiveShare and Wsl

Remove custom Django template editor support (IntelliSense for django tags, filter, etc) that used an unsupported internal web editor API.

Django projects, launching, debugging, template debugging still works as expected.

LiveShare custom implementation is no longer needed now that we MEF activate a single language server, LiveShare can find the language client on the host automatically.

Wsl support was never released.

+10 -15659

1 comment

159 changed files

huguesv

pr closed time in 10 hours

issue commentmicrosoft/PTVS

I can't append environment.

Thanks for the feedback. We've had to reported at https://github.com/microsoft/PTVS/issues/5235, the setup team looked at their data and concluded it was not widespread enough of a problem to be worth fixing.

The issue may go away the next time you upgrade or run setup, since the issue is with the setup package cache. It would be worth upgrading to 16.7 to see if the issue persists.

We'll make a fix to catch the error on our side, so that at least you can proceed with creating virtual environments.

iamtomyum

comment created time in 10 hours

issue commentmicrosoft/pylance-release

Syntax Highlighting not for working for some scopes

In addition to the above changes, the next release will support the declaration semantic token modifier. This will allow a user/theme to customize colors differently for declarations of function, property, variable and parameter.

We've also added a decorator semantic token modifier, and we map function.decorator and class.decorator to the meta.function.decorator.python textmate scope. In One Dark Pro, this results in: image

If you also want the module name and variable names under a decorator to be the same color as well, then you can customize module.decorator and variable.decorator (or simply *.decorator) and achieve something like this: image

QuantumStatic

comment created time in 11 hours

pull request commentmicrosoft/PTVS

adding guards around trying to get the active config.

The fix is currently available in 16.8 Preview: https://visualstudio.microsoft.com/vs/preview/

bschnurr

comment created time in 14 hours

issue commentmicrosoft/PTVS

How can i run python samples in ptvs ?

The sources at https://github.com/Microsoft/PTVS-Samples were used to build VS project templates for VS 2015 (as a separate download from VS 2015), and are not meant to be loaded directly as a solution/projects. They need to be built and deployed as VS templates, then processed by the VS New Project wizard to be turned into actual projects.

If you're using VS 2019 (16.7 or earlier), the polls project templates are available in the new project dialog, just search for 'polls' to find them.

Note that we've removed them from 16.8 (currently in preview). Some of the samples are dependent on old deprecated libraries and were not worth the maintenance cost.

lmobarq

comment created time in 15 hours

PR opened microsoft/PTVS

Remove Django Template Editor, LiveShare and Wsl

Remove custom Django template editor support (IntelliSense for django tags, filter, etc) that used an unsupported internal web editor API.

Django projects, launching, debugging, template debugging still works as expected.

LiveShare custom implementation is no longer needed now that we MEF activate a single language server, LiveShare can find the language client on the host automatically.

Wsl support was never released.

+10 -15659

0 comment

159 changed files

pr created time in 3 days

push eventhuguesv/PTVS

Hugues Valois

commit sha ce2b79e00d01caa5045d3075b4d9281334bbaf28

Remove more unused code in profiling project.

view details

Hugues Valois

commit sha d9f248849addbbb86d9fee6f33deb80a64a71a4c

Remove unused reference assemblies for web editor apis.

view details

Hugues Valois

commit sha eec451354cca7c878b856012019d1616c555ba99

Remove LiveShare, Wsl and unused localization files.

view details

push time in 3 days

push eventhuguesv/PTVS

Hugues Valois

commit sha 0b36ccb858afeb8cc6ce8b8b56e12baf11609de5

Remove more django template editor code.

view details

push time in 3 days

create barnchhuguesv/PTVS

branch : dev/huguesv/pylance-unused5

created branch time in 3 days

issue closedmicrosoft/pylance-release

False positive reportUndefinedVariable

Environment data

  • Language Server version: 2020.9.6
  • OS and version: 10.15.7
  • Python version: 3.8.5
from torch.nn import functional as F

In the above import, functional is red-underlined with the error

(module) functional
"functional" is not definedPylance (reportUndefinedVariable)

false-error

closed time in 4 days

janosh

issue commentmicrosoft/pylance-release

False positive reportUndefinedVariable

Duplicate of https://github.com/microsoft/pylance-release/issues/376 It is fixed for the next release

janosh

comment created time in 4 days

issue commentmicrosoft/pylance-release

Variable not defined in unreachable code with semantic highlighting on

I've implemented a fix, and it will be in the next release of Pylance.

karthiknadig

comment created time in 4 days

PullRequestReviewEvent

Pull request review commentmicrosoft/PTVS

Handle interpreter change

 namespace Microsoft.PythonTools.LanguageServerClient {     internal class PythonLanguageClientContextGlobal : IPythonLanguageClientContext, IDisposable {         private readonly IInterpreterOptionsService _optionsService;         private readonly DisposableBag _disposables;-         private IPythonInterpreterFactory _factory;          public event EventHandler InterpreterChanged;- #pragma warning disable CS0067         public event EventHandler SearchPathsChanged;         public event EventHandler Closed; #pragma warning restore CS0067 -        public PythonLanguageClientContextGlobal(-            IInterpreterOptionsService optionsService,-            string contentTypeName-        ) {+        public PythonLanguageClientContextGlobal(IInterpreterOptionsService optionsService, string contentTypeName) {

Btw, the contentTypeName here and in other places is a leftover from MPLS where each language server instance had its own derived content type in order to associate a file with the correct server.

We no longer need this, so if you feel like it, you can remove it from here, and the IPythonLanguageClientContext interface.

MikhailArkhipov

comment created time in 5 days

PullRequestReviewEvent

Pull request review commentmicrosoft/PTVS

Handle interpreter change

 public class PythonLanguageClient : ILanguageClient, ILanguageClientCustomMessag                 return null;             } -            if (PythonWorkspaceContextProvider.Workspace != null) {-                _clientContext = new PythonLanguageClientContextWorkspace(PythonWorkspaceContextProvider.Workspace, PythonCoreConstants.ContentType);-            } else {-                _clientContext = new PythonLanguageClientContextGlobal(OptionsService, PythonCoreConstants.ContentType);-            }+            _clientContext = PythonWorkspaceContextProvider.Workspace != null +                ? (IPythonLanguageClientContext)new PythonLanguageClientContextWorkspace(PythonWorkspaceContextProvider.Workspace, PythonCoreConstants.ContentType) +                : new PythonLanguageClientContextGlobal(OptionsService, PythonCoreConstants.ContentType);++            _clientContext.InterpreterChanged += OnInterpreterChanged;+            _clientContext.SearchPathsChanged += OnSearchPathsChanged;+            _disposables.Add(() => {+                _clientContext.InterpreterChanged -= OnInterpreterChanged;+                _clientContext.SearchPathsChanged -= OnSearchPathsChanged;

I've noticed that we don't have anyone disposing _clientContext, I think it should be added here after the event unregistration.

MikhailArkhipov

comment created time in 5 days

PullRequestReviewEvent

issue closedmicrosoft/PTVS

Recursion limit when searching for file

Describe the bug When attaching the debugger we get an immediate crash of our program, digging in we get the following traceback:

Traceback (most recent call last):
  File "file.py", line 125, in new_connection_thread
    s = ServerSession(client, addr)
  File "file.py", line 158, in init
    threading.Thread.init(self)
  File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\threading.py", line 794, in init
  File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\threading.py", line 500, in init
  File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\threading.py", line 227, in init
  File "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\python\core\ptvsd\debugger.py", line 929, in trace_func
    return self._even
  File "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\python\core\ptvsd\debugger.py", line 1185, in handle_exception
    if not DETACHED and should_debug_code(frame.f_code):
  File "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\python\core\ptvsd\debugger.py", line 582, in should_debug_code
    if is_file_in_zip(filename):
  File "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\python\core\ptvsd\debugger.py", line 391, in is_file_in_zip
    return is_file_in_zip(parent)
  File "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\python\core\ptvsd\debugger.py", line 391, in is_file_in_zip
    return is_file_in_zip(parent)
  File "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\python\core\ptvsd\debugger.py", line 391, in is_file_in_zip
    return is_file_in_zip(parent)
  [Previous line repeated 978 more times]
  File "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\extensions\microsoft\python\core\ptvsd\debugger.py", line 379, in is_file_in_zip
    parent, name = path.split(path.abspath(filename))
  File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\ntpath.py", line 526, in abspath
  File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\ntpath.py", line 472, in normpath
  File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\ntpath.py", line 141, in splitdrive
RecursionError: maximum recursion depth exceeded while calling a Python object

I suspect that the recursive operation in is_file_in_zip may be hitting the root of the drive and continually returning a split with parent as "C:" and name as "".

This occurred when trying to debug a python interpreter that was embedded within a C/C++ executable, using boost::python. We have had luck using PTVS for this in the past, but haven't tried it for a couple years. Our runtime is a somewhat ripped-apart setup, inside %PYTHONHOME% we have python37.dll, python37.zip, and a handful of _*.pyd files.

Steps to Reproduce

  1. Start windows executable
  2. Attach to python
  3. Crash

Expected behavior Not crashing because of a blown up call stack.

Additional context and screenshots

Sample Code

Configuration information (If you are providing a diagnostics file (see below), skip this section) VS Version: 16.6.2 PTVS version: 16.6.20100.1 Python version: 3.7 32-bit Debugger Type (if applicable): New debugger

closed time in 5 days

teeks99

issue commentmicrosoft/PTVS

Recursion limit when searching for file

You're right, but fixing up the legacy debugger that we plan on removing is realistically not going to happen given our resources and priority (Pylance language server).

I'm pushing to prioritize https://github.com/microsoft/PTVS/issues/4738 so this code path ends up using debugpy, which is actively maintained.

teeks99

comment created time in 5 days

issue commentmicrosoft/pylance-release

Syntax Highlighting not for working for some scopes

Here's how you can customize colors for functions:

Using the semantic token:

  "editor.semanticTokenColorCustomizations": {
    "[One Dark Pro]": {
      "rules": {
        "function": "#8811ff"
      }
    }
  }

Or using textmate scope:

  "editor.tokenColorCustomizations": {
    "[One Dark Pro]": {
      "textMateRules": [
        {
          "scope": "entity.name.function",
          "settings": {
            "foreground": "#6087f3aa"
          }
        }
         ]
    }
  },
QuantumStatic

comment created time in 5 days

issue commentmicrosoft/pylance-release

`from X import Y as Z` highlights `Y` as undefined with semantic highlighting enabled

I've implemented a fix, and it will be in the next release of Pylance.

syagev

comment created time in 5 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentmicrosoft/PTVS

Support loose files in editor

Also fixes reopening of folder with previously open files.

I suppose now we start a server with the global default settings instead of the workspace settings. We'll have to fix that later.

Some background: The IPythonWorkspaceContextProvider that we use to check if a workspace is present hasn't initialized yet, it initializes itself asynchronously on the workspace opened event, which is racing with the opening of the previously opened files.

MikhailArkhipov

comment created time in 6 days

Pull request review commentmicrosoft/PTVS

Support loose files in editor

 protected override Task<object> InitializeToolWindowAsync(Type toolWindowType, i              // no launcher configured, use the default one.             Debug.Assert(defaultLaunchProvider != null);-            return (defaultLaunchProvider != null) ?-                serviceProvider.GetUIThread().Invoke<IProjectLauncher>(() => defaultLaunchProvider.CreateLauncher(project)) :-                null;+            return serviceProvider.GetUIThread().Invoke(() => defaultLaunchProvider.CreateLauncher(project));

I would keep the check for null to avoid crashing in release builds

MikhailArkhipov

comment created time in 6 days

PullRequestReviewEvent

issue commentmicrosoft/pylance-release

Syntax Highlighting not for working for some scopes

Thanks for the feedback.

Semantic colorization takes precedence over the syntax colorization provided by textmate grammar. The current release is limited to the VS Code built in list of semantic token types. The known list of token and their mapping is available at https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#semantic-token-scope-map

In the next release, we've added some custom semantic token types to cover Python specific scenarios, such as the self parameter, cls parameter and dunder methods. Those will map to the existing python textmate scopes, such that colors for those identifiers will be the same with/without semantic colorization enabled.

As for decorators, we've decided to keep them colored based on their semantic type (class or function). If there's enough demand, we can add custom types for those.

For functions, we use the function built in token type, which VS Code maps to entity.name.function, so that is the color that will get picked up. We currently don't differentiate between function call/declaration, but is something we could potentially do.

FYI you can see the token/scopes via Developer: Inspect Editor Tokens and Scopes command. That is the easiest way to validate that tokens are correct. With just the colors, it's more difficult to tell...

QuantumStatic

comment created time in 6 days

PullRequestReviewEvent

issue commentmicrosoft/PTVS

Recursion limit when searching for file

Thanks for the feedback.

I would suggest that you try using remote debugging with debugpy (the new debugger). https://github.com/microsoft/debugpy#waiting-for-the-client-to-attach https://docs.microsoft.com/en-us/visualstudio/python/debugging-python-code-on-remote-linux-machines?view=vs-2019#attach-remotely-from-python-tools

Note that for this you'll need to have debugpy installed in the Python environment.

The current implementation of debug->attach to process where you select a process id and the debugger gets injected in the running process does not support debugpy yet (https://github.com/microsoft/PTVS/issues/4738). So that type of attach loads the legacy ptvsd debugger regardless of your "use legacy debugger" setting.

teeks99

comment created time in 7 days

PullRequestReviewEvent

push eventmicrosoft/PTVS

Daisy Zhou

commit sha b3414bef284907197c2901ef176700f8f08a919a

Update TestExplorerTests.cs Fix for RunAllUnittestProject test

view details

Hugues Valois

commit sha 2736605eb8df50a72e79cb65ca7947f6c9e05261

Merge pull request #6256 from zhouwangyang/patch-1 Update TestExplorerTests.cs

view details

push time in 7 days

PR merged microsoft/PTVS

Update TestExplorerTests.cs

Fix for RunAllUnittestProject test

+1 -1

1 comment

1 changed file

zhouwangyang

pr closed time in 7 days

PullRequestReviewEvent

issue commentmicrosoft/pylance-release

Semantic Highlighting for Type Hints

I've just checked in a change that allows customization of colors for type hints in annotation or comment. It will be in the next release of Pylance.

Default colors (One Dark Pro): image

Customized colors (One Dark Pro):

  "editor.semanticTokenColorCustomizations": {
    "[One Dark Pro]": {
      "rules": {
        "*.typeHint": "#286605",
        "*.typeHintComment": "#6ed3d3"
      }
    }
  }

image

hassanselim0

comment created time in 11 days

issue commentmicrosoft/pylance-release

"etree" is unknown import symbol (lxml)

Pylance is able to make use of stubs packages, and there is one available for lxml: pip install lxml-stubs

It might work okay. I don't get any error on this simple code (in basic type checking mode):

image

cebor

comment created time in 11 days

issue commentmicrosoft/pylance-release

Semantic Highlighting for Type Hints

@hassanselim0 it does not, from what I saw it didn't seem that textmate was setting a special scope for it either.

image

But it's relatively easy to add a different modifier for this case (so that you'd be able to distinguish from the ones in comments).

hassanselim0

comment created time in 11 days

issue closedmicrosoft/PTVS

Setting Environment Variables in Visual Studio for a Python virtual environment

Describe your question How can you set an Environment Variables in Visual Studio for a Python virtual environment

closed time in 11 days

dgeraldhall

issue commentmicrosoft/PTVS

File "devenv.exe" x86 32 bits crashed unexpectedly.

There's nothing in the call stack that belongs to PTVS. This may be an issue for the VS editor team. Were you editing a Python file?

kl07

comment created time in 11 days

issue closedmicrosoft/PTVS

Team Explorer Work Items Not Connecting to Azure DevOps (TFS)

This issue has been moved from a ticket on Developer Community.


I was trying to create a python script to automatically check-in our standard "directory" structure and merge in some standard libraries. I am pretty sure in doing this I broke something and have not been able to fix it. Note, Team Explorer was working at one point. I have done the obvious things of restarting my computer, uninstalling and installing VS2019 several times. I do have access to the "project" and Azure DevOps via a webpage.

When I do get into Team Explorer, and go through Manage Connections and try to add the Azure DevOps server, the server comes up with the correct port and tfs (http://<server>:8080/tfs). However, when I add it and click on it (or double click) the list of "projects" does not show up.

When I start VS2019 on a Windows 10 machine I sometimes get the first attached error window (VS2019_WorkItemTracking_Erorr.png). I continue on into VS and try and open the Team Explorer and I get another error window (VS2019_WindowSearch_Error.png). And I get this error in the Output Window.

**TF205020: Could not connect to server ‘<server><project>’. This server was used in your last session, but it might be offline or unreachable. Confirm that the server is available on the network. To attempt to connect again, or to a different server, click ‘Connect To Azure DevOps Server’ in Team Explorer or the Team menu.

The server returned the following error: Method not found: 'Void Microsoft.TeamFoundation.Client.ProjectSettings.TpcSettingsStore.InitializeSettingsCache()'.**

I hit OK. Team Explorer does not open. I try again and get the following exception in the Team Explorer Window.

**An exception was encountered while constructing the content of this frame. This information is also logged in "C:\Users<username>\AppData\Roaming\Microsoft\VisualStudio\16.0_2025f24c\ActivityLog.xml".

Exception details: System.InvalidOperationException: The window search was not yet setup for this search host. at Microsoft.VisualStudio.Platform.WindowManagement.WindowSearchHost.ThrowIfSearchNotSetup() at Microsoft.VisualStudio.Platform.WindowManagement.WindowSearchHost.set_HelpTopic(String value) at Microsoft.VisualStudio.TeamFoundation.TeamExplorer.ToolWindowTeamExplorer.OnToolWindowCreated() at Microsoft.VisualStudio.Shell.Package.HandleToolWindowCreation(ToolWindowCreationResult result, Int32 id, Guid persistenceGuid, IVsWindowFrame frame) at Microsoft.VisualStudio.Shell.Package.<>c__DisplayClass81_0. <CreateToolWindow>g__CreateToolWindowWorker|1() at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Type toolWindowType, Int32 id, UInt32 flags, Object context, Guid persistenceGuid) at Microsoft.VisualStudio.Shell.Package.<>c__DisplayClass91_1. <<FindToolWindow>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask. <JoinAsync>d__68.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask1. <JoinAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Shell.Package.<>c__DisplayClass91_0. <<FindToolWindow>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Shell.ToolWindowCollection.ToolWindowListener.<>c__DisplayClass1_0. <<-ctor>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.AwaitExtensions.ExecuteContinuationSynchronouslyAwaiter1.GetResult() at Microsoft.VisualStudio.Threading.AsyncLazy1.<>c__DisplayClass13_0. <<GetValueAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread() at Microsoft.VisualStudio.Threading.JoinableTask1.CompleteOnCurrentThread() at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func1 asyncMethod, JoinableTaskCreationOptions creationOptions) at Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func1 asyncMethod) at Microsoft.VisualStudio.Threading.AsyncLazy`1.GetValue(CancellationToken cancellationToken) at Microsoft.VisualStudio.Shell.Package.FindToolWindow(Type toolWindowType, Int32 id, Boolean create, ProvideToolWindowAttribute tool) at Microsoft.VisualStudio.Shell.Package.CreateToolWindow(Guid& toolWindowType, Int32 id) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()**


Original Comments

Feedback Bot on 9/3/2020, 10:59 AM:

<p>We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.</p>

Yingying Zhang [MSFT] on 9/8/2020, 05:39 PM:

<p>Please refer the below link to see if it can help you?<br> <a target='_blank' href="https://docs.microsoft.com/en-us/azure/devops/organizations/projects/connect-to-projects?view=azure-devops&tabs=visual-studio-2019#visual-studio">https://docs.microsoft.com/en-us/azure/devops/organizations/projects/connect-to-projects?view=azure-devops&tabs=visual-studio-2019#visual-studio</a></p>

Michael Isherwood on 9/9/2020, 00:18 AM:

<p>When I connect to project, I get the server name but no projects under it to connect.</p><p>If I refresh the server, I get this error.</p><p></p>


Original Solutions

(no solutions)

closed time in 11 days

vsfeedback

issue commentmicrosoft/PTVS

Team Explorer Work Items Not Connecting to Azure DevOps (TFS)

Looks like a team explorer issue. I've reopened the feedback ticket and moved passed it on to the Team Explorer team.

vsfeedback

comment created time in 11 days

issue closedmicrosoft/PTVS

a custom string not defined error

Describe your question [A clear and concise description of your question or what you want help with]

What have you tried? [Have you already searched online? What solutions have you tried?]

Additional context [Add any other information or screenshots that would help us provide you with a better answer]

closed time in 11 days

rm361

issue commentmicrosoft/PTVS

a custom string not defined error

I'm not seeing what the question is here. Please fill in the requested information when creating an issue.

rm361

comment created time in 11 days

issue commentmicrosoft/pylance-release

Semantic Highlighting for Type Hints

You'll also be able to do something like this: image

Given settings like these:

  "editor.semanticTokenColorCustomizations": {
    "[One Dark Pro]": {
      "rules": {
        "*.typeHint": "#00ff00"
      }
    }
  },
  "editor.tokenColorCustomizations": {
    "[One Dark Pro]": {
      "textMateRules": [
        {
          "scope": "meta.typehint",
          "settings": {
            "foreground": "#a32f9aaa"
          }
        },
        {
          "scope": "comment.typehint",
          "settings": {
            "foreground": "#a32f9aaa"
          }
        }
      ]
    }
  },
hassanselim0

comment created time in 12 days

issue commentmicrosoft/pylance-release

Semantic Highlighting for Type Hints

This has been fixed for the next release.

image

hassanselim0

comment created time in 12 days

issue commentmicrosoft/pylance-release

Semantic highlighting colors every variable with same color

Thank you for the feedback everyone.

The next release will have additional semantic token types and modifiers to add more variety than provided by the VS Code built in semantic tokens.

This will have the effect of respecting the theme coloring of some of the Python specific textmate scopes that were lost when semantic colorization was introduced.

The improvements apply to CONSTANTS, self and cls parameters, dunder methods, and type hints inside of comments.

johnybx

comment created time in 12 days

delete branch microsoft/PTVS

delete branch : dev/huguesv/pylance-unused4

delete time in 17 days

push eventmicrosoft/PTVS

Hugues Valois

commit sha 4f1c8ebd09e01976e2d16ce02e71b4e695c4aac9

Remove ExternalProfilerDriver unused code.

view details

Hugues Valois

commit sha d30af8fd77a1903870709d846cd54093484a1df5

Merge pull request #6248 from microsoft/dev/huguesv/pylance-unused4 [Pylance] Remove ExternalProfilerDriver unused code.

view details

push time in 17 days

create barnchmicrosoft/PTVS

branch : dev/huguesv/pylance-unused4

created branch time in 18 days

issue commentmicrosoft/PTVS

wont run adafruit Clue Spirit Level

3.8 version cannot be detected properly by VS 2017, the only way to use that one would be to add a custom environment via the Python environments tool window and set the version manually to 3.6.

I would have expected 3.7 to be detected correctly, if it's the standard Python 3.7 from python.org. You could try to add it as a custom env as well and see if that helps.

VS 2017 officially only supports up to Python 3.6.

soky

comment created time in 18 days

delete branch microsoft/PTVS

delete branch : dev/huguesv/pylance-unused3

delete time in 18 days

push eventmicrosoft/PTVS

Hugues Valois

commit sha db98622b609edf96f80b871ac1996b9e35f1a857

Remove old unused ReplWindow code.

view details

Hugues Valois

commit sha daa59c6d08b9fb86760690bc9c8e43fcce558573

Remove unused file from old msi setup.

view details

Hugues Valois

commit sha d727836e0164c9c3531f77f578187a98d6e26163

Remove unused icons.

view details

Hugues Valois

commit sha d2a0d48c1f0f0291b2c8352dae5508ec613232b4

Remove PyKinect.

view details

Hugues Valois

commit sha 511b4595dc96daf07692666476707d3482cd497d

Remove Pyvot.

view details

Hugues Valois

commit sha 87f056f2fb0894b52a35ba65eeea465e3d213c39

Merge pull request #6247 from microsoft/dev/huguesv/pylance-unused3 [Pylance] Remove unused code

view details

push time in 18 days

PR merged microsoft/PTVS

[Pylance] Remove unused code

Old ReplWindow code Old setup code Old icon resources PyKinect Pyvot

+0 -17176

1 comment

310 changed files

huguesv

pr closed time in 18 days

delete branch microsoft/PTVS

delete branch : dev/huguesv/pylance-unused2

delete time in 18 days

push eventmicrosoft/PTVS

Hugues Valois

commit sha f0b9fd30ac8e606d93c7cd99ed876abc3061d880

Remove miniconda third party library and vsix project.

view details

Hugues Valois

commit sha 8f5434aa7400bbc115e4693af553348203c69092

Merge pull request #6246 from microsoft/dev/huguesv/pylance-unused2 [Pylance] Remove miniconda

view details

push time in 18 days

PR merged microsoft/PTVS

[Pylance] Remove miniconda

Remove third party miniconda folder Remove miniconda project/vsix Remove from installer Update git/static analysis metadata files Remove miniconda localization files Update build files

I launched a build on pipeline on this change and it succeeded.

+0 -1092772

1 comment

4750 changed files

huguesv

pr closed time in 18 days

issue closedmicrosoft/pylance-release

memory and cpu leak when version 2020.9.0 installed

ms-python version: 2020.8.106424

closed time in 18 days

byehack

issue commentmicrosoft/pylance-release

memory and cpu leak when version 2020.9.0 installed

This issue has been fixed in version 2020.9.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202094-10-september-2020

byehack

comment created time in 18 days

issue closedmicrosoft/pylance-release

Type alias'ed builtin types are not being expanded

Environment data

  • Language Server version: 2020.8.3
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.5

Expected behaviour

Type hints for the generic part of some builtin generic types. The comments indicate the type reported by Pylance. Pylance 2020.8.2 and older display List[int] for variables annotated with List[int].

l1 = []  # (variable) list[Any]
l2 = [i for i in range(10)]  # (variable) list[int]
l3: List[int] = []  # (variable) list[int]
l4: List[int] = [i for i in range(10)]  # (variable) list[int]

Actual behaviour

Since Pylance 2020.8.3, variables annotated with List[int] are displayed as (type alias) List instead of the probably intended List[int].

l1 = []  # (variable) list[Any]
l2 = [i for i in range(10)]  # (variable) list[int]
l3: List[int] = []  # (type alias) List
l4: List[int] = [i for i in range(10)]  # (type alias) List

Code Snippet / Additional information

The problem is only present with builtin types that are defined as ... = _Alias() in the typing module. For other generic types that are defined as classes like Iterable, or custom generic types created using Generic, the type hinting works fine. This might be a side effect of #265 because List, for instance, is defined as List = _Alias() in the typing module. A workaround for now is to importannotations from __future__, but doing so in every module might be too much.

closed time in 18 days

juanpablos

issue commentmicrosoft/pylance-release

Type alias'ed builtin types are not being expanded

This issue has been fixed in version 2020.9.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202094-10-september-2020

juanpablos

comment created time in 18 days

issue closedmicrosoft/pylance-release

reportUndefinedVariable diagnostic in named decorator parameters with semantic highlighting enabled

Environment data

<!-- To find your version, you can either:

  • Open the VS Code extensions panel. Locate Pylance from the list of installed extensions. The version appears next to the name.

  • Select "View: Toggle Output" from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS), then select "Python Language Server" in the dropdown on the right. Look for the line Pylance Language Server version X in the console. -->

  • Language Server version: 2020.9.0

  • OS and version: Linux Ubuntu 20.04 x86_64

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.5, Anaconda

Expected behaviour

autouse is recognised as valid pytest.fixture() argument

Actual behaviour

"autouse" is not defined message in problems output

Code Snippet / Additional information

<!-- Note: If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ . -->

    @pytest.fixture(autouse=True)
    def _set_up(self, mocker):
        fake_connparams = {
            'username': 'test-user',
            'password': 'test-password',
            'host': 'test-host',
            'port': 1234
        }

Zrzut ekranu z 2020-09-04 14-20-51

closed time in 18 days

zgoda

issue commentmicrosoft/pylance-release

reportUndefinedVariable diagnostic in named decorator parameters with semantic highlighting enabled

This issue has been fixed in version 2020.9.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202094-10-september-2020

zgoda

comment created time in 18 days

issue closedmicrosoft/pylance-release

Wrong warning "Code is Unreachable" when not using await in a async method

<!-- Read the guidelines for filing an issue first.

https://github.com/microsoft/pylance-release/blob/master/TROUBLESHOOTING.md#filing-an-issue -->

Environment data

<!-- To find your version, you can either:

  • Open the VS Code extensions panel. Locate Pylance from the list of installed extensions. The version appears next to the name.

  • Select "View: Toggle Output" from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS), then select "Python Language Server" in the dropdown on the right. Look for the line Pylance Language Server version X in the console. -->

  • Language Server version: v2020.9.0

  • OS and version: Windows 10 - 10.0.19041

  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.3

Expected behaviour

Should not show Code is unreachable since the method being called is not awaited

Actual behaviour

image

Code Snippet / Additional information

<!-- Note: If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ . -->

without any await

import asyncio

class TestUnreachableCode:

    @staticmethod
    async def never_done_task():
        while True:
            await asyncio.sleep(0.01)

    async def test_sould_not_show_unreachable_code(
        self,
        some_object
    ):

        some_object.name = self.never_done_task()

        print('')  # <-- this code should not be marked as unreachable

using await keyword:

import asyncio

class TestUnreachableCode:

    @staticmethod
    async def never_done_task():
        while True:
            await asyncio.sleep(0.01)

    async def test_sould_not_show_unreachable_code(
        self,
        some_object
    ):

        some_object.name = await self.never_done_task()  

        print('')  # <-- It's ok to mark this as unreachable code

closed time in 18 days

deniscapeto

issue commentmicrosoft/pylance-release

Wrong warning "Code is Unreachable" when not using await in a async method

This issue has been fixed in version 2020.9.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202094-10-september-2020

deniscapeto

comment created time in 18 days

issue closedmicrosoft/pylance-release

Code marked as unreachable in edge case with type hint and loop

Environment data

  • VSCode version: 1.48.2
  • Language Server version: 2020.9.0 (3 September 2020) (pyright 60eb2cca)
  • OS and version: Windows_NT x64 10.0.19042
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.4 (miniconda)

Expected behaviour

Code that is reachable is marked as such.

Actual behaviour

In this odd edge case.
Type hinted code that is called in a loop is marked as unreachable when it otherwise would not be marked as such.

class Foo:
    def foo():
        raise NotImplementedError

def bad():
    f: Foo = Foo() 
    for _ in range(1):
        f.foo()
        print("Code is unreachable") 

def ok():
    f = Foo() 
    for _ in range(1):
        f.foo()
        print("Reachable") 

def also_ok():
    f: Foo = Foo() 
    f.foo()
    print("Reachable") 

closed time in 18 days

krooq

issue commentmicrosoft/pylance-release

Code marked as unreachable in edge case with type hint and loop

This issue has been fixed in version 2020.9.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202094-10-september-2020

krooq

comment created time in 18 days

issue closedmicrosoft/pylance-release

Incorrect type inference when reassigning a parameter using pathlib.Path

<!-- Read the guidelines for filing an issue first.

https://github.com/microsoft/pylance-release/blob/master/TROUBLESHOOTING.md#filing-an-issue -->

Environment data

<!-- To find your version, you can either:

  • Open the VS Code extensions panel. Locate Pylance from the list of installed extensions. The version appears next to the name.

  • Select "View: Toggle Output" from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS), then select "Python Language Server" in the dropdown on the right. Look for the line Pylance Language Server version X in the console. -->

  • Language Server version: v2020.9.0

  • OS and version: macOS Catalina v10.15.6

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.5

Expected behaviour

Pylance should recognize that reassigning path = pathlib.Path(path) promotes path to be an instance of pathlib.Path, which is stronger than _PathLike[str].

This example is contrived but demonstrates the point.

import os
import pathlib
from typing import Union, TYPE_CHECKING


def read_text(path: Union[str, "os.PathLike[str]"]) -> str:
    path = pathlib.Path(path)

    if TYPE_CHECKING:
        # Pylance should agree with mypy.
        # mypy says: Revealed type is 'pathlib.Path*'
        reveal_type(path)

    # Pylance shouldn't complain about `read_text()` being an unknown member.
    return path.read_text()

Actual behaviour

Pylance correctly infers that path can no longer be an instance of str but fails to recognize that path is an instance of pathlib.Path.

import os
import pathlib
from typing import Union, TYPE_CHECKING


def read_text(path: Union[str, "os.PathLike[str]"]) -> str:
    path = pathlib.Path(path)

    if TYPE_CHECKING:
        # Pylance says: Type of "path" is "_PathLike[str]"
        # mypy says: Revealed type is 'pathlib.Path*'
        reveal_type(path)

    # Pylance complains: Cannot access member "read_text" for type "_PathLike[str]"
    return path.read_text()

Logs

<!-- Enable trace logging by adding "python.analysis.logLevel": "Trace" to your settings.json configuration file.

Adding this will cause a large amount of info to be printed to the Python output panel. This should not be left long term, as the performance impact of the logging is significant. -->

I'm not sure if logs are helpful here. I can include them if you want them but I'd need to tidy up some of the output from elsewhere in the project I'm working on.

Code Snippet / Additional information

I recognize that this is easy to work around. I can just pop an assert in there to force the correct type inference, as follows:

import os
import pathlib
from typing import Union, TYPE_CHECKING


def read_text(path: Union[str, "os.PathLike[str]"]) -> str:
    path = pathlib.Path(path)

    assert isinstance(path, pathlib.Path)

    if TYPE_CHECKING:
        # Pylance says: Type of "path" is "_PathLike[str]"
        # mypy says: Revealed type is 'pathlib.Path*'
        reveal_type(path)

    # Pylance complains: Cannot access member "read_text" for type "_PathLike[str]"
    return path.read_text()

It'd be nice if Pylance could figure this out on its own, though!

Thank you for all your work on Pylance!

closed time in 18 days

willfrey

issue commentmicrosoft/pylance-release

Incorrect type inference when reassigning a parameter using pathlib.Path

This issue has been fixed in version 2020.9.4, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202094-10-september-2020

willfrey

comment created time in 18 days

PullRequestReviewEvent

delete branch huguesv/pylance-release

delete branch : newdiag2

delete time in 18 days

push eventmicrosoft/pylance-release

Hugues Valois

commit sha 5cd744872fb45274bdca2e7bffca30da8e564a4e

Document 2 new diagnostics. (#350)

view details

push time in 18 days

issue closedmicrosoft/pylance-release

pylance can not recognize pytest fixture scope argument

<!-- Read the guidelines for filing an issue first.

https://github.com/microsoft/pylance-release/blob/master/TROUBLESHOOTING.md#filing-an-issue -->

Environment data

<!-- To find your version, you can either:

  • Open the VS Code extensions panel. Locate Pylance from the list of installed extensions. The version appears next to the name.

  • Select "View: Toggle Output" from the command palette (Ctrl+Shift+P on Windows/Linux, Command+Shift+P on macOS), then select "Python Language Server" in the dropdown on the right. Look for the line Pylance Language Server version X in the console. -->

  • Language Server version: v2020.9.0

  • OS and version: win10

  • Python version (& distribution if applicable, e.g. Anaconda): conda python3.8

Expected behaviour

pytest fixture support scope argument to define the life span of the fixture.

Actual behaviour

"scope" is not defined pylance reportundefinedvariable

Logs

<!-- Enable trace logging by adding "python.analysis.logLevel": "Trace" to your settings.json configuration file.

Adding this will cause a large amount of info to be printed to the Python output panel. This should not be left long term, as the performance impact of the logging is significant. -->

XXX

Code Snippet / Additional information

<!-- Note: If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ . --> @pytest.fixture(scope='module') def test(): return 1

XXX

closed time in 18 days

kevinwang89

issue commentmicrosoft/pylance-release

pylance can not recognize pytest fixture scope argument

Please see https://github.com/microsoft/pylance-release/issues/322

kevinwang89

comment created time in 18 days

PullRequestReviewEvent

Pull request review commentmicrosoft/pylance-release

Update CHANGELOG.md

 # Changelog +## 2020.9.1 (10 September 2020)++Notable changes:+-   Bug Fix: Addressed memory and cpu issues a number of users had with indexer but setting it off by default 

but -> by

bschnurr

comment created time in 18 days

PullRequestReviewEvent

PR opened microsoft/PTVS

[Pylance] Remove unused code

Old ReplWindow code Old setup code Old icon resources PyKinect Pyvot

+0 -17176

0 comment

310 changed files

pr created time in 18 days

create barnchmicrosoft/PTVS

branch : dev/huguesv/pylance-unused3

created branch time in 18 days

PR opened microsoft/PTVS

[Pylance] Remove miniconda

Remove third party miniconda folder Remove miniconda project/vsix Remove from installer Update git/static analysis metadata files Remove miniconda localization files Update build files

I launched a build on pipeline on this change and it succeeded.

+0 -1092772

0 comment

4750 changed files

pr created time in 19 days

issue commentmicrosoft/pylance-release

Add Import Paths to Suggested Imports in Autocomplete

Oh sorry, it's actually CTRL+SPACE to show the tooltip. I keep getting those shortcuts mixed up between VS and VS Code.

image

Random-Word

comment created time in 19 days

create barnchmicrosoft/PTVS

branch : dev/huguesv/pylance-unused2

created branch time in 19 days

delete branch microsoft/PTVS

delete branch : dev/huguesv/pylance-unused

delete time in 19 days

push eventmicrosoft/PTVS

Hugues Valois

commit sha 34c74ca7725f098cdb7f7533dc90f91b3a91eba7

Remove IronPython related code.

view details

Hugues Valois

commit sha 07455e35491d0f9e9c34d4b87d40f2b03ebb2dcc

Merge pull request #6244 from microsoft/dev/huguesv/pylance-unused [Pylance] Remove IronPython related code.

view details

push time in 19 days

push eventmicrosoft/pyright

Hugues Valois

commit sha 9983747fe864c2f670dbe67dc9c147cedae410ce

Update from Pylance. (#1024)

view details

push time in 19 days

delete branch huguesv/pyright

delete branch : pushpylance1

delete time in 19 days

PR merged microsoft/pyright

Update from Pylance.

fixed UnhandledPromiseRejectionWarning caused by improper async usage added hidden flag that control indexing. and set false as default made _handleMemoryHighUsage to drop parse tree and binding info as well always add import statement after invocation point

+145 -72

0 comment

16 changed files

huguesv

pr closed time in 19 days

issue closedmicrosoft/pylance-release

Crash report logs pile up in root directory

Environment data

  • Language Server version: 2020.9.0
  • OS and version: Windows 10 v1909
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.4

Behaviour

Since the update to 2020.9.0, Pylance has been working very well on my workspace. However, it appears that it frequently runs out of memory, which doesn't seem to impact performance except that it's saving a crash log to my root directory every few minutes. I can't find any setting to change where crash logs are stored.

My workspace has various large folders and files, all of which are ignored by the appropriate VS Code settings (search, file watcher, etc).

It's not the crashes I want to report here, since I figure that's related to https://github.com/microsoft/pylance-release/issues/321 and will get fixed. It's that I want to put the logs somewhere other than my root directory, like in my .vscode folder.

Logs

report.20200908.155430.10105.0.001.txt

Code Snippet / Additional information

As far as the crashes themselves, I don't know what large files are causing it. I have a medium-sized workspace (30k lines of Python) but my git, site-packages, and other folders are all in the parent folder to the workspace so they shouldn't be searched for symbols.

closed time in 19 days

lucaluca

issue commentmicrosoft/pylance-release

Crash report logs pile up in root directory

This looks like it is created by Node.js, and it's creating it in the cwd. We are unsure if it can be customized.

The issue that causes the crash https://github.com/microsoft/pylance-release/issues/321 will be fixed in the next version.

lucaluca

comment created time in 19 days

issue commentmicrosoft/pylance-release

Add Import Paths to Suggested Imports in Autocomplete

Thanks for the feedback.

One thing you can do is enable tooltip (with CTRL+SHIFT+SPACE) and that will show you more info on each one.

Random-Word

comment created time in 19 days

issue closedmicrosoft/pylance-release

100% CPU and 100% Memory Usage when using Pylance 2020.9.0

  • Language Server version: 2020.9.0
  • OS and version: Windows 10 Version 19041
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda Build Python 3.8.3

Expected behaviour

I recently updated to Pylance 2020.9.0 and whenever I have it enabled, my CPU and Memory usage for VSCode spikes to 100%. Disabling the Pylance extension fixes this issue.

Additional Information: VSCode Python Extension: 2020.8.108011 Visual Studio Intellicode: 1.2.10

closed time in 19 days

kswydock

issue commentmicrosoft/pylance-release

100% CPU and 100% Memory Usage when using Pylance 2020.9.0

duplicate of https://github.com/microsoft/pylance-release/issues/321

kswydock

comment created time in 19 days

issue closedmicrosoft/pylance-release

How to "Create Type Stub" for something that is not a library

I want to create stub files for my project, not for an existing library (described in https://github.com/microsoft/pyright/blob/master/docs/type-stubs.md). Part of the project is aimed to be published as a library, eventually, with these typings.

The project is designed for Django. The simplified layout looks like:

root
|_ .env
|_ manage.py
|_ .vscode\
|_ typings\
|_ mysite\
   |_ __init__.py
   |_ settings.py
   |_ myapp\
      |_ __init__.py
      |_ models.py

The goal is to create stubs for myapp. The manage.py is used to temporary host the import instruction, but any other py file would be fine. import mysite.myapp doesn't raise an error.

import myapp raises an expected error: Import "myapp" could not be resolved So, we need to make the module visible. How?

  • I tried the setting of PYTHONPATH in .env, but it doesn't help (seems to have no effect for the purpose)
  • I tried to set Python › Analysis: Extra Paths. It works too much, in the sense that the module could be found and there is no "Stub file not found for ..." error.

My solution is to add a python path file: D:\Python37\Lib\site-packages\tmp.pth, containing D:/root/mysite. After a "Restart Language Server", I finally have the wanted error: Stub file not found for "myapp" Pylance (reportMissingTypeStubs) with the Quick Fix: Create Type Stub For "myapp".

The question is: is there a smoother way to generate the typings?

closed time in 19 days

psam44

PR opened microsoft/pyright

Update from Pylance.

fixed UnhandledPromiseRejectionWarning caused by improper async usage added hidden flag that control indexing. and set false as default made _handleMemoryHighUsage to drop parse tree and binding info as well always add import statement after invocation point

+145 -72

0 comment

16 changed files

pr created time in 19 days

create barnchhuguesv/pyright

branch : pushpylance1

created branch time in 19 days

issue closedmicrosoft/PTVS

Python Unit Test disappearing

I've been playing around with Python in Visual Studio Community edition. I am fairly familiar with VS but not in the Python support. Python seems to work well, but sometimes when I am creating a unittest, I'll include the include line and the test disappears from the test explorer. For example:

I have temp.py python code that I'd like to test

and create

test_temp.py

It shows up in the test explorer (since I have told it I want to test using unittest). But sometimes when I add in the include at the top:

import temp

or

**from temp import ***

the test_temp test will disappear from the test explorer. If I remove the line containing the import, the test reappears in the test explorer -- but doesn't work since it doesn't know the function/class.

Any idea what might be happening?!??! I am running Version 16.7.1 of Visual Studio Community Edition.

Thanks

closed time in 19 days

cebess
more