Skip to content

Commit dd22ae9

Browse files
karthiknadigMikhail Arkhipov
andauthored
Prepare for hotfix release (#12447)
* Actually fix user settings for `jediEnabled`. (#12433) * Fix path * Actually fix settings * Add news * Add test * Format * Suppress 'jediEnabled' removal * Prapare for point release Co-authored-by: Mikhail Arkhipov <[email protected]>
1 parent cda4b5d commit dd22ae9

File tree

5 files changed

+82
-21
lines changed

5 files changed

+82
-21
lines changed

CHANGELOG.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
11
# Changelog
22

3+
## 2020.6.1 (17 June 2020)
4+
5+
### Fixes
6+
7+
1. Fixed issue when `python.jediEnabled` setting was not removed and `python.languageServer` setting was not updated.
8+
([#12429](https://github.com/Microsoft/vscode-python/issues/12429))
9+
10+
### Thanks
11+
12+
Thanks to the following projects which we fully rely on to provide some of
13+
our features:
14+
15+
- [debugpy](https://pypi.org/project/debugpy/)
16+
- [isort](https://pypi.org/project/isort/)
17+
- [jedi](https://pypi.org/project/jedi/)
18+
and [parso](https://pypi.org/project/parso/)
19+
- [Microsoft Python Language Server](https://github.com/microsoft/python-language-server)
20+
- [ptvsd](https://pypi.org/project/ptvsd/)
21+
- [exuberant ctags](http://ctags.sourceforge.net/) (user-installed)
22+
- [rope](https://pypi.org/project/rope/) (user-installed)
23+
24+
Also thanks to the various projects we provide integrations with which help
25+
make this extension useful:
26+
27+
- Debugging support:
28+
[Django](https://pypi.org/project/Django/),
29+
[Flask](https://pypi.org/project/Flask/),
30+
[gevent](https://pypi.org/project/gevent/),
31+
[Jinja](https://pypi.org/project/Jinja/),
32+
[Pyramid](https://pypi.org/project/pyramid/),
33+
[PySpark](https://pypi.org/project/pyspark/),
34+
[Scrapy](https://pypi.org/project/Scrapy/),
35+
[Watson](https://pypi.org/project/Watson/)
36+
- Formatting:
37+
[autopep8](https://pypi.org/project/autopep8/),
38+
[black](https://pypi.org/project/black/),
39+
[yapf](https://pypi.org/project/yapf/)
40+
- Interpreter support:
41+
[conda](https://conda.io/),
42+
[direnv](https://direnv.net/),
43+
[pipenv](https://pypi.org/project/pipenv/),
44+
[pyenv](https://github.com/pyenv/pyenv),
45+
[venv](https://docs.python.org/3/library/venv.html#module-venv),
46+
[virtualenv](https://pypi.org/project/virtualenv/)
47+
- Linting:
48+
[bandit](https://pypi.org/project/bandit/),
49+
[flake8](https://pypi.org/project/flake8/),
50+
[mypy](https://pypi.org/project/mypy/),
51+
[prospector](https://pypi.org/project/prospector/),
52+
[pylint](https://pypi.org/project/pylint/),
53+
[pydocstyle](https://pypi.org/project/pydocstyle/),
54+
[pylama](https://pypi.org/project/pylama/)
55+
- Testing:
56+
[nose](https://pypi.org/project/nose/),
57+
[pytest](https://pypi.org/project/pytest/),
58+
[unittest](https://docs.python.org/3/library/unittest.html#module-unittest)
59+
60+
And finally thanks to the [Python](https://www.python.org/) development team and
61+
community for creating a fantastic programming language and community to be a
62+
part of!
63+
364
## 2020.6.0 (16 June 2020)
465

566
### Enhancements

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "python",
33
"displayName": "Python",
44
"description": "Linting, Debugging (multi-threaded, remote), Intellisense, Jupyter Notebooks, code formatting, refactoring, unit tests, snippets, and more.",
5-
"version": "2020.6.0",
5+
"version": "2020.6.1",
66
"featureFlags": {
77
"usingNewInterpreterStorage": true
88
},

src/client/testing/common/updateTestSettings.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class UpdateTestSettingService implements IExtensionActivationService {
3131
const filesToBeFixed = await this.getFilesToBeFixed(resource);
3232
await Promise.all(filesToBeFixed.map((file) => this.fixSettingInFile(file)));
3333
}
34-
public getSettingsFiles(resource: Resource) {
34+
public getSettingsFiles(resource: Resource): string[] {
3535
const settingsFiles: string[] = [];
3636
if (this.application.userSettingsFile) {
3737
settingsFiles.push(this.application.userSettingsFile);
@@ -42,7 +42,7 @@ export class UpdateTestSettingService implements IExtensionActivationService {
4242
}
4343
return settingsFiles;
4444
}
45-
public async getFilesToBeFixed(resource: Resource) {
45+
public async getFilesToBeFixed(resource: Resource): Promise<string[]> {
4646
const files = this.getSettingsFiles(resource);
4747
const result = await Promise.all(
4848
files.map(async (file) => {
@@ -87,10 +87,11 @@ export class UpdateTestSettingService implements IExtensionActivationService {
8787
return fileContents;
8888
}
8989

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

113114
try {
114-
let ast = parseTree(fileContent);
115-
let jediEnabledNode = findNodeAtLocation(ast, jediEnabledPath);
115+
const ast = parseTree(fileContent);
116+
const jediEnabledNode = findNodeAtLocation(ast, jediEnabledPath);
116117
const jediEnabled = jediEnabledNode ? getNodeValue(jediEnabledNode) : true;
117118
const languageServerNode = findNodeAtLocation(ast, languageServerPath);
118119
const formattingOptions: FormattingOptions = {
@@ -134,13 +135,6 @@ export class UpdateTestSettingService implements IExtensionActivationService {
134135
}
135136

136137
fileContent = applyEdits(fileContent, edits);
137-
// Remove jediEnabled
138-
ast = parseTree(fileContent);
139-
jediEnabledNode = findNodeAtLocation(ast, jediEnabledPath);
140-
if (jediEnabledNode) {
141-
edits = modify(fileContent, jediEnabledPath, undefined, { formattingOptions });
142-
fileContent = applyEdits(fileContent, edits);
143-
}
144138
// tslint:disable-next-line:no-empty
145139
} catch {}
146140
return fileContent;

src/test/application/diagnostics/checks/updateTestSettings.unit.test.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ suite('Application Diagnostics - Check Test Settings', () => {
168168
assert.ok(!needsToBeFixed);
169169
verify(fs.readFile(__filename)).once();
170170
});
171+
test('Verify `python.jediEnabled` is found in user settings', async () => {
172+
when(fs.readFile(__filename)).thenResolve('"python.jediEnabled": false');
173+
const needsToBeFixed = await diagnosticService.doesFileNeedToBeFixed(__filename);
174+
assert.ok(needsToBeFixed);
175+
verify(fs.readFile(__filename)).once();
176+
});
171177

172178
[
173179
{
@@ -218,32 +224,32 @@ suite('Application Diagnostics - Check Test Settings', () => {
218224
{
219225
testTitle: 'jediEnabled: true, no languageServer setting',
220226
contents: '{ "python.jediEnabled": true }',
221-
expectedContent: '{"python.languageServer": "Jedi"}'
227+
expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}'
222228
},
223229
{
224230
testTitle: 'jediEnabled: true, languageServer setting present',
225231
contents: '{ "python.jediEnabled": true }',
226-
expectedContent: '{"python.languageServer": "Jedi"}'
232+
expectedContent: '{ "python.jediEnabled": true, "python.languageServer": "Jedi"}'
227233
},
228234
{
229235
testTitle: 'jediEnabled: false, no languageServer setting',
230236
contents: '{ "python.jediEnabled": false }',
231-
expectedContent: '{"python.languageServer": "Microsoft"}'
237+
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}'
232238
},
233239
{
234240
testTitle: 'jediEnabled: false, languageServer is Microsoft',
235241
contents: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft" }',
236-
expectedContent: '{"python.languageServer": "Microsoft"}'
242+
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Microsoft"}'
237243
},
238244
{
239245
testTitle: 'jediEnabled: false, languageServer is None',
240246
contents: '{ "python.jediEnabled": false, "python.languageServer": "None" }',
241-
expectedContent: '{"python.languageServer": "None"}'
247+
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "None"}'
242248
},
243249
{
244250
testTitle: 'jediEnabled: false, languageServer is Jedi',
245251
contents: '{ "python.jediEnabled": false, "python.languageServer": "Jedi" }',
246-
expectedContent: '{"python.languageServer": "Jedi"}'
252+
expectedContent: '{ "python.jediEnabled": false, "python.languageServer": "Jedi"}'
247253
}
248254
].forEach((item) => {
249255
test(item.testTitle, async () => {

0 commit comments

Comments
 (0)