Skip to content

Commit 1a8debc

Browse files
authored
Merge branch 'main' into add-testing-perf-telemetry
2 parents d9d610b + 0e60b3c commit 1a8debc

8 files changed

Lines changed: 112 additions & 31 deletions

File tree

.github/commands.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,14 @@
153153
"addLabel": "info-needed",
154154
"removeLabel": "~confirmation-needed",
155155
"comment": "Please diagnose the root cause of the issue by running the command `F1 > Help: Troubleshoot Issue` and following the instructions. Once you have done that, please update the issue with the results.\n\nHappy Coding!"
156+
},
157+
{
158+
"type": "label",
159+
"name": "~spam",
160+
"removeLabel": "~spam",
161+
"addLabel": "spam",
162+
"action": "close",
163+
"reason": "not_planned",
164+
"comment": "Thank you for your submission. This issue has been closed as it doesn't meet our community guidelines or appears to be spam.\n\n**If you believe this was closed in error:**\n- Please review our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/)\n- Ensure your issue contains a clear description of the problem or feature request\n- Feel free to open a new issue with appropriate detail if this was a legitimate concern\n\n**For legitimate issues, please include:**\n- Clear description of the problem\n- Steps to reproduce (for bugs)\n- Expected vs actual behavior\n- VS Code version and environment details\n\nThank you for helping us maintain a welcoming and productive community."
156165
}
157166
]

.github/workflows/lock-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: 'Lock Issues'
19-
uses: dessant/lock-threads@7266a7ce5c1df01b1c6db85bf8cd86c737dadbe7 # v6.0.0
19+
uses: dessant/lock-threads@89ae32b08ed1a541efecbab17912962a5e38981c # v6.0.2
2020
with:
2121
github-token: ${{ github.token }}
2222
issue-inactive-days: '30'

package-lock.json

Lines changed: 35 additions & 26 deletions
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
@@ -1723,7 +1723,7 @@
17231723
"semver": "^7.5.2",
17241724
"stack-trace": "0.0.10",
17251725
"sudo-prompt": "^9.2.1",
1726-
"tmp": "^0.2.5",
1726+
"tmp": "^0.2.7",
17271727
"uint64be": "^3.0.0",
17281728
"unicode": "^14.0.0",
17291729
"vscode-debugprotocol": "^1.28.0",

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ microvenv==2025.0 \
88
--hash=sha256:568155ec18af01c89f270d35d123ab803b09672b480c3702d15fd69e9cc5bd1e \
99
--hash=sha256:8a2568a8390a4ffb5af2f05e7642454e03b887e582d192b6316326974eab5d0f
1010
# via -r requirements.in
11-
packaging==26.1 \
12-
--hash=sha256:5d9c0669c6285e491e0ced2eee587eaf67b670d94a19e94e3984a481aba6802f \
13-
--hash=sha256:f042152b681c4bfac5cae2742a55e103d27ab2ec0f3d88037136b6bfe7c9c5de
11+
packaging==26.2 \
12+
--hash=sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e \
13+
--hash=sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661
1414
# via -r requirements.in
1515
tomli==2.4.1 \
1616
--hash=sha256:01f520d4f53ef97964a240a035ec2a869fe1a37dde002b57ebc4417a27ccd853 \

src/client/interpreter/configuration/recommededEnvironmentService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@ const MEMENTO_KEY = 'userSelectedEnvPath';
1717
@injectable()
1818
export class RecommendedEnvironmentService implements IRecommendedEnvironmentService, IExtensionActivationService {
1919
private api?: PythonExtension['environments'];
20+
private hasRegisteredCommand = false;
2021
constructor(@inject(IExtensionContext) private readonly extensionContext: IExtensionContext) {}
2122
supportedWorkspaceTypes: { untrustedWorkspace: boolean; virtualWorkspace: boolean } = {
2223
untrustedWorkspace: true,
2324
virtualWorkspace: false,
2425
};
2526

2627
async activate(_resource: Resource, _startupStopWatch?: StopWatch): Promise<void> {
28+
if (this.hasRegisteredCommand) {
29+
return;
30+
}
31+
this.hasRegisteredCommand = true;
2732
this.extensionContext.subscriptions.push(
2833
commands.registerCommand('python.getRecommendedEnvironment', async (resource: Resource) => {
2934
return this.getRecommededEnvironment(resource);

src/client/telemetry/pylance.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,10 @@
385385
"autosearchpaths" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
386386
"callArgumentNameInlayHints" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
387387
"completefunctionparens" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
388+
"diagnosticsSource" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
388389
"disableTaggedHints" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
389390
"disableworkspacesymbol" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
391+
"enableDjangoSupport" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
390392
"enableextractcodeaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
391393
"enablePytestSupport" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
392394
"extracommitchars" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
@@ -395,6 +397,7 @@
395397
"hasconfigfile" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
396398
"hasextrapaths" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
397399
"importformat" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
400+
"includeAliasesFromUserFiles" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
398401
"intelliCodeEnabled" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
399402
"includeusersymbolsinautoimport" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
400403
"indexing" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
@@ -404,7 +407,12 @@
404407
"movesymbol" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
405408
"nodeExecutable" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
406409
"openfilesonly" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
410+
"persistAllIndices" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
411+
"pyrightVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
407412
"pytestparameterinlaytypehints" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
413+
"referencesCodeLens" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
414+
"regenerateStdLibIndices" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
415+
"supportDocstringTemplate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
408416
"typecheckingmode" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
409417
"unusablecompilerflags": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
410418
"useimportheuristic" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
'use strict';
5+
6+
import { expect } from 'chai';
7+
import { anything, reset, verify, when } from 'ts-mockito';
8+
import { Disposable, Uri } from 'vscode';
9+
import { mockedVSCodeNamespaces } from '../vscode-mock';
10+
import { RecommendedEnvironmentService } from '../../client/interpreter/configuration/recommededEnvironmentService';
11+
12+
suite('RecommendedEnvironmentService - activate', () => {
13+
let service: RecommendedEnvironmentService;
14+
let subscriptions: Disposable[];
15+
16+
setup(() => {
17+
subscriptions = [];
18+
const extensionContext = {
19+
subscriptions,
20+
globalState: {
21+
get: () => undefined,
22+
update: () => Promise.resolve(),
23+
},
24+
} as any;
25+
26+
when(mockedVSCodeNamespaces.commands!.registerCommand(anything(), anything())).thenReturn({
27+
dispose: () => {},
28+
} as Disposable);
29+
30+
service = new RecommendedEnvironmentService(extensionContext);
31+
});
32+
33+
teardown(() => {
34+
reset(mockedVSCodeNamespaces.commands!);
35+
});
36+
37+
test('Multiroot workspace: command is registered only once across multiple activate calls', async () => {
38+
// Simulate multiroot workspace where activate is called once per workspace root
39+
const workspaceRoot1 = Uri.file('/workspace/root1');
40+
const workspaceRoot2 = Uri.file('/workspace/root2');
41+
const workspaceRoot3 = Uri.file('/workspace/root3');
42+
43+
await service.activate(workspaceRoot1);
44+
await service.activate(workspaceRoot2);
45+
await service.activate(workspaceRoot3);
46+
47+
verify(mockedVSCodeNamespaces.commands!.registerCommand('python.getRecommendedEnvironment', anything())).once();
48+
expect(subscriptions).to.have.lengthOf(1);
49+
});
50+
});

0 commit comments

Comments
 (0)