Skip to content

Commit 07815f3

Browse files
committed
[release] prepare v0.41.4 release
ea9ff87 extension/CHANGELOG.md: add the entry for v0.41.4 d1cde8c extension/src/welcome: readd the fix for go.showWelcome handling cfc795c Revert "extension/src/welcome: fix 'go.showWelcome' setting interpretation" Change-Id: Iebf964dacaaa47e02c7219aafc2d7c8e3d7bdfec
2 parents abfa2cb + ea9ff87 commit 07815f3

File tree

3 files changed

+61
-64
lines changed

3 files changed

+61
-64
lines changed

extension/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v0.41.4 - 24 Apr, 2024
2+
3+
This point release addresses a regression issue (spurious display of the Go welcome page) within cloud-based IDEs.
4+
5+
See the full
6+
[commit history](https://github.com/golang/vscode-go/compare/v0.41.3...v0.41.4)
7+
for detailed changes.
8+
19
## v0.41.3 - 22 Apr, 2024
210

311
This point release temporarily reverts the default remote debugging behavior to

extension/src/welcome.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,17 @@ export class WelcomePanel {
2929
}
3030
});
3131
}
32-
showGoWelcomePage();
32+
33+
// Show the Go welcome page on update unless one of the followings is true:
34+
// * the extension is running in Cloud IDE or
35+
// * the user explicitly opted out (go.showWelcome === false)
36+
//
37+
// It is difficult to write useful tests for this suppression logic
38+
// without major refactoring or complicating tests to enable
39+
// dependency injection or stubbing.
40+
if (!extensionInfo.isInCloudIDE && getGoConfig().get('showWelcome') !== false) {
41+
showGoWelcomePage();
42+
}
3343
}
3444

3545
public static currentPanel: WelcomePanel | undefined;
@@ -265,18 +275,15 @@ function showGoWelcomePage() {
265275

266276
const savedGoExtensionVersion = getFromGlobalState(goExtensionVersionKey, '');
267277

268-
if (shouldShowGoWelcomePage(showVersions, goExtensionVersion, savedGoExtensionVersion)) {
278+
if (hasNewsForNewVersion(showVersions, goExtensionVersion, savedGoExtensionVersion)) {
269279
vscode.commands.executeCommand('go.welcome');
270280
}
271281
if (goExtensionVersion !== savedGoExtensionVersion) {
272282
updateGlobalState(goExtensionVersionKey, goExtensionVersion);
273283
}
274284
}
275285

276-
export function shouldShowGoWelcomePage(showVersions: string[], newVersion: string, oldVersion: string): boolean {
277-
if (!extensionInfo.isInCloudIDE && getGoConfig().get('showWelcome') === false) {
278-
return false;
279-
}
286+
export function hasNewsForNewVersion(showVersions: string[], newVersion: string, oldVersion: string): boolean {
280287
if (newVersion === oldVersion) {
281288
return false;
282289
}

extension/test/integration/welcome.test.ts

Lines changed: 40 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,56 @@
55

66
import vscode = require('vscode');
77
import assert from 'assert';
8-
import { shouldShowGoWelcomePage } from '../../src/welcome';
8+
import { hasNewsForNewVersion } from '../../src/welcome';
99
import { extensionId } from '../../src/const';
1010
import { WelcomePanel } from '../../src/welcome';
11-
import sinon = require('sinon');
12-
import * as config from '../../src/config';
13-
import { MockCfg } from '../mocks/MockCfg';
1411

1512
suite('WelcomePanel Tests', () => {
16-
let sandbox: sinon.SinonSandbox;
17-
setup(() => {
18-
sandbox = sinon.createSandbox();
19-
});
20-
teardown(() => sandbox.restore());
21-
22-
// 0:showVersions, 1:newVersion, 2:oldVersion, 3: showWelcome, 4:expected
23-
//
24-
// If showWelcome is false, then expected has to be false.
25-
// Otherwise, expected is true if (and only if) newVersion occurs in showVersions
26-
// and is newer than oldVersion (as semantic versions).
27-
type testCase = [string[], string, string, boolean, boolean];
13+
// 0:showVersions, 1:newVersion, 2:oldVersion, 3:expected
14+
type testCase = [string[], string, string, boolean];
2815
const testCases: testCase[] = [
29-
[[], '0.22.0', '0.0.0', true, false],
30-
[[], '0.22.0', '0.21.0', true, false],
31-
[[], '0.22.0', '0.22.0-rc.1', true, false],
32-
[[], '0.22.0', '0.22.0', true, false],
33-
[[], '0.22.0', '0.23.0', true, false],
16+
[[], '0.22.0', '0.0.0', false],
17+
[[], '0.22.0', '0.21.0', false],
18+
[[], '0.22.0', '0.22.0-rc.1', false],
19+
[[], '0.22.0', '0.22.0', false],
20+
[[], '0.22.0', '0.23.0', false],
3421

35-
[['0.22.0'], '0.22.0', '0.0.0', true, true],
36-
[['0.22.0'], '0.22.0', '0.0.0', false, false],
37-
[['0.22.0'], '0.22.0', '0.21.0-rc.1', true, true],
38-
[['0.22.0'], '0.22.0', '0.21.0', true, true],
39-
[['0.22.0'], '0.22.0', '0.22.0-rc.1', true, true],
40-
[['0.22.0'], '0.22.0', '0.22.0', true, false],
41-
[['0.22.0'], '0.22.0', '0.22.1', true, false],
42-
[['0.22.0'], '0.22.0', '0.23.0', true, false],
43-
[['0.22.0'], '0.22.0', '1.0.0', true, false],
44-
[['0.22.0'], '0.22.0', '2021.1.100', true, false],
22+
[['0.22.0'], '0.22.0', '0.0.0', true],
23+
[['0.22.0'], '0.22.0', '0.21.0-rc.1', true],
24+
[['0.22.0'], '0.22.0', '0.21.0', true],
25+
[['0.22.0'], '0.22.0', '0.22.0-rc.1', true],
26+
[['0.22.0'], '0.22.0', '0.22.0', false],
27+
[['0.22.0'], '0.22.0', '0.22.1', false],
28+
[['0.22.0'], '0.22.0', '0.23.0', false],
29+
[['0.22.0'], '0.22.0', '1.0.0', false],
30+
[['0.22.0'], '0.22.0', '2021.1.100', false],
4531

46-
[['0.22.0'], '0.22.0-rc.2', '0.0.0', true, true],
47-
[['0.22.0'], '0.22.0-rc.2', '0.21.0-rc.1', true, true],
48-
[['0.22.0'], '0.22.0-rc.2', '0.21.0', true, true],
49-
[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.1', true, true],
50-
[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.2', true, false],
51-
[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.3', true, true],
52-
[['0.22.0'], '0.22.0-rc.2', '0.22.0', true, true],
53-
[['0.22.0'], '0.22.0-rc.2', '0.22.1', true, false],
54-
[['0.22.0'], '0.22.0-rc.2', '0.23.0', true, false],
55-
[['0.22.0'], '0.22.0-rc.2', '1.0.0', true, false],
56-
[['0.22.0'], '0.22.0-rc.2', '2021.1.100', true, false],
32+
[['0.22.0'], '0.22.0-rc.2', '0.0.0', true],
33+
[['0.22.0'], '0.22.0-rc.2', '0.21.0-rc.1', true],
34+
[['0.22.0'], '0.22.0-rc.2', '0.21.0', true],
35+
[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.1', true],
36+
[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.2', false],
37+
[['0.22.0'], '0.22.0-rc.2', '0.22.0-rc.3', true],
38+
[['0.22.0'], '0.22.0-rc.2', '0.22.0', true],
39+
[['0.22.0'], '0.22.0-rc.2', '0.22.1', false],
40+
[['0.22.0'], '0.22.0-rc.2', '0.23.0', false],
41+
[['0.22.0'], '0.22.0-rc.2', '1.0.0', false],
42+
[['0.22.0'], '0.22.0-rc.2', '2021.1.100', false],
5743

58-
[['0.22.0'], '0.22.1', '0.0.0', true, false],
59-
[['0.22.0'], '0.22.1', '0.21.0-rc.1', true, false],
60-
[['0.22.0'], '0.22.1', '0.21.0', true, false],
61-
[['0.22.0'], '0.22.1', '0.22.0-rc.1', true, false],
62-
[['0.22.0'], '0.22.1', '0.22.0', true, false],
63-
[['0.22.0'], '0.22.1', '0.23.0', true, false],
64-
[['0.22.0'], '0.22.1', '1.0.0', true, false],
65-
[['0.22.0'], '0.22.1', '2021.1.100', true, false]
44+
[['0.22.0'], '0.22.1', '0.0.0', false],
45+
[['0.22.0'], '0.22.1', '0.21.0-rc.1', false],
46+
[['0.22.0'], '0.22.1', '0.21.0', false],
47+
[['0.22.0'], '0.22.1', '0.22.0-rc.1', false],
48+
[['0.22.0'], '0.22.1', '0.22.0', false],
49+
[['0.22.0'], '0.22.1', '0.23.0', false],
50+
[['0.22.0'], '0.22.1', '1.0.0', false],
51+
[['0.22.0'], '0.22.1', '2021.1.100', false]
6652
];
6753
testCases.forEach((c: testCase) => {
68-
const [showVersions, newVersion, oldVersion, showWelcome, expected] = c;
69-
test(`shouldShowGoWelcomePage(${JSON.stringify(
70-
showVersions
71-
)}, ${newVersion}, ${oldVersion}, (showWelcome=${showWelcome}))`, () => {
72-
const goConfig = new MockCfg([]);
73-
sandbox.stub(config, 'getGoConfig').returns(goConfig);
74-
sinon.stub(goConfig, 'get').withArgs('showWelcome').returns(showWelcome);
75-
assert.strictEqual(shouldShowGoWelcomePage(showVersions, newVersion, oldVersion), expected);
54+
const [showVersions, newVersion, oldVersion, expected] = c;
55+
56+
test(`shouldShowGoWelcomePage(${JSON.stringify(showVersions)}, ${newVersion}, ${oldVersion})`, () => {
57+
assert.strictEqual(hasNewsForNewVersion(showVersions, newVersion, oldVersion), expected);
7658
});
7759
});
7860
});

0 commit comments

Comments
 (0)