Skip to content

Run Pylance in untrusted workspace #18091

@karthiknadig

Description

@karthiknadig

Refs: #17254

Complexity: 2

Authors: @karrtikr

Create Issue


Requirements

  1. Install python extension from here: https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix

Verification

  1. Ensure that you have python.languageServer set to Default or Pylance.
  2. Open a python file from an untrusted location.
  3. You should be able to get hover, same file completion, completion for builtins like print

Make sure you see this:
image
and a language status item:
image
with appropriate wording and links.

sample file:

import unittest

class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        self.assertEqual('foo'.upper(), 'FOO')

    def test_isupper(self):
        self.assertTrue('FOO'.isupper())
        self.assertFalse('Foo'.isupper())

    def test_split(self):
        s = 'hello world'
        self.assertEqual(s.split(), ['hello', 'world'])
        with self.assertRaises(TypeError):
            s.split(2)

if __name__ == '__main__':
    unittest.main()

You should also see this in the logs:
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions