Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# Changelog

## 2020.6.1 (17 June 2020)

### Fixes

1. Fixed issue when `python.jediEnabled` setting was not removed and `python.languageServer` setting was not updated.
([#12429](https://github.com/Microsoft/vscode-python/issues/12429))

### Thanks

Thanks to the following projects which we fully rely on to provide some of
our features:

- [debugpy](https://pypi.org/project/debugpy/)
- [isort](https://pypi.org/project/isort/)
- [jedi](https://pypi.org/project/jedi/)
and [parso](https://pypi.org/project/parso/)
- [Microsoft Python Language Server](https://github.com/microsoft/python-language-server)
- [ptvsd](https://pypi.org/project/ptvsd/)
- [exuberant ctags](http://ctags.sourceforge.net/) (user-installed)
- [rope](https://pypi.org/project/rope/) (user-installed)

Also thanks to the various projects we provide integrations with which help
make this extension useful:

- Debugging support:
[Django](https://pypi.org/project/Django/),
[Flask](https://pypi.org/project/Flask/),
[gevent](https://pypi.org/project/gevent/),
[Jinja](https://pypi.org/project/Jinja/),
[Pyramid](https://pypi.org/project/pyramid/),
[PySpark](https://pypi.org/project/pyspark/),
[Scrapy](https://pypi.org/project/Scrapy/),
[Watson](https://pypi.org/project/Watson/)
- Formatting:
[autopep8](https://pypi.org/project/autopep8/),
[black](https://pypi.org/project/black/),
[yapf](https://pypi.org/project/yapf/)
- Interpreter support:
[conda](https://conda.io/),
[direnv](https://direnv.net/),
[pipenv](https://pypi.org/project/pipenv/),
[pyenv](https://github.com/pyenv/pyenv),
[venv](https://docs.python.org/3/library/venv.html#module-venv),
[virtualenv](https://pypi.org/project/virtualenv/)
- Linting:
[bandit](https://pypi.org/project/bandit/),
[flake8](https://pypi.org/project/flake8/),
[mypy](https://pypi.org/project/mypy/),
[prospector](https://pypi.org/project/prospector/),
[pylint](https://pypi.org/project/pylint/),
[pydocstyle](https://pypi.org/project/pydocstyle/),
[pylama](https://pypi.org/project/pylama/)
- Testing:
[nose](https://pypi.org/project/nose/),
[pytest](https://pypi.org/project/pytest/),
[unittest](https://docs.python.org/3/library/unittest.html#module-unittest)

And finally thanks to the [Python](https://www.python.org/) development team and
community for creating a fantastic programming language and community to be a
part of!

## 2020.6.0 (16 June 2020)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "python",
"displayName": "Python",
"description": "Linting, Debugging (multi-threaded, remote), Intellisense, Jupyter Notebooks, code formatting, refactoring, unit tests, snippets, and more.",
"version": "2020.6.0",
"version": "2020.6.1",
"featureFlags": {
"usingNewInterpreterStorage": true
},
Expand Down
20 changes: 7 additions & 13 deletions src/client/testing/common/updateTestSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class UpdateTestSettingService implements IExtensionActivationService {
const filesToBeFixed = await this.getFilesToBeFixed(resource);
await Promise.all(filesToBeFixed.map((file) => this.fixSettingInFile(file)));
}
public getSettingsFiles(resource: Resource) {
public getSettingsFiles(resource: Resource): string[] {
const settingsFiles: string[] = [];
if (this.application.userSettingsFile) {
settingsFiles.push(this.application.userSettingsFile);
Expand All @@ -42,7 +42,7 @@ export class UpdateTestSettingService implements IExtensionActivationService {
}
return settingsFiles;
}
public async getFilesToBeFixed(resource: Resource) {
public async getFilesToBeFixed(resource: Resource): Promise<string[]> {
const files = this.getSettingsFiles(resource);
const result = await Promise.all(
files.map(async (file) => {
Expand Down Expand Up @@ -87,10 +87,11 @@ export class UpdateTestSettingService implements IExtensionActivationService {
return fileContents;
}

public async doesFileNeedToBeFixed(filePath: string) {
public async doesFileNeedToBeFixed(filePath: string): Promise<boolean> {
try {
const contents = await this.fs.readFile(filePath);
return (
contents.indexOf('python.jediEnabled') > 0 ||
contents.indexOf('python.unitTest.') > 0 ||
contents.indexOf('.pyTest') > 0 ||
contents.indexOf('.pep8') > 0
Expand All @@ -106,13 +107,13 @@ export class UpdateTestSettingService implements IExtensionActivationService {
// - `true` or missing then set to `languageServer: Jedi`.
// - `false` and `languageServer` is present, do nothing.
// - `false` and `languageServer` is NOT present, set `languageServer` to `Microsoft`.
// `jediEnabled` is then removed.
// `jediEnabled` is NOT removed since JSONC parser may also remove comments.
const jediEnabledPath = ['python.jediEnabled'];
const languageServerPath = ['python.languageServer'];

try {
let ast = parseTree(fileContent);
let jediEnabledNode = findNodeAtLocation(ast, jediEnabledPath);
const ast = parseTree(fileContent);
const jediEnabledNode = findNodeAtLocation(ast, jediEnabledPath);
const jediEnabled = jediEnabledNode ? getNodeValue(jediEnabledNode) : true;
const languageServerNode = findNodeAtLocation(ast, languageServerPath);
const formattingOptions: FormattingOptions = {
Expand All @@ -134,13 +135,6 @@ export class UpdateTestSettingService implements IExtensionActivationService {
}

fileContent = applyEdits(fileContent, edits);
// Remove jediEnabled
ast = parseTree(fileContent);
jediEnabledNode = findNodeAtLocation(ast, jediEnabledPath);
if (jediEnabledNode) {
edits = modify(fileContent, jediEnabledPath, undefined, { formattingOptions });
fileContent = applyEdits(fileContent, edits);
}
// tslint:disable-next-line:no-empty
} catch {}
return fileContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ suite('Application Diagnostics - Check Test Settings', () => {
assert.ok(!needsToBeFixed);
verify(fs.readFile(__filename)).once();
});
test('Verify `python.jediEnabled` is found in user settings', async () => {
when(fs.readFile(__filename)).thenResolve('"python.jediEnabled": false');
const needsToBeFixed = await diagnosticService.doesFileNeedToBeFixed(__filename);
assert.ok(needsToBeFixed);
verify(fs.readFile(__filename)).once();
});

[
{
Expand Down Expand Up @@ -218,32 +224,32 @@ suite('Application Diagnostics - Check Test Settings', () => {
{
testTitle: 'jediEnabled: true, no languageServer setting',
contents: '{ "python.jediEnabled": true }',
expectedContent: '{"python.languageServer": "Jedi"}'
expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}'
},
{
testTitle: 'jediEnabled: true, languageServer setting present',
contents: '{ "python.jediEnabled": true }',
expectedContent: '{"python.languageServer": "Jedi"}'
expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}'
},
{
testTitle: 'jediEnabled: false, no languageServer setting',
contents: '{ "python.jediEnabled": false }',
expectedContent: '{"python.languageServer": "Microsoft"}'
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}'
},
{
testTitle: 'jediEnabled: false, languageServer is Microsoft',
contents: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft" }',
expectedContent: '{"python.languageServer": "Microsoft"}'
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}'
},
{
testTitle: 'jediEnabled: false, languageServer is None',
contents: '{ "python.jediEnabled": false, "python.languageServer": "None" }',
expectedContent: '{"python.languageServer": "None"}'
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "None"}'
},
{
testTitle: 'jediEnabled: false, languageServer is Jedi',
contents: '{ "python.jediEnabled": false, "python.languageServer": "Jedi" }',
expectedContent: '{"python.languageServer": "Jedi"}'
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Jedi"}'
}
].forEach((item) => {
test(item.testTitle, async () => {
Expand Down