Skip to content

Commit 8dbbcb8

Browse files
authored
Add setting to enable/disable datascience codelens (microsoft#5232)
* Add setting to enable/disable datascience codelens * Fix unit tests
1 parent ac17fab commit 8dbbcb8

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

news/1 Enhancements/5211.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add setting to just enable/disable the datascience codelens.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,12 @@
14531453
"description": "Draw a highlight behind the currently active cell.",
14541454
"scope": "resource"
14551455
},
1456+
"python.dataScience.enableCellCodeLens": {
1457+
"type": "boolean",
1458+
"default": true,
1459+
"description": "Enables code lens for 'cells' in a python file.",
1460+
"scope": "resource"
1461+
},
14561462
"python.disableInstallationCheck": {
14571463
"type": "boolean",
14581464
"default": false,

src/client/common/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ export interface IDataScienceSettings {
306306
variableExplorerExclude?: string;
307307
liveShareConnectionTimeout?: number;
308308
decorateCells?: boolean;
309+
enableCellCodeLens?: boolean;
309310
}
310311

311312
export const IConfigurationService = Symbol('IConfigurationService');

src/client/datascience/editor-integration/codelensprovider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class DataScienceCodeLensProvider implements IDataScienceCodeLensProvider
2424
vscode.CodeLens[] {
2525
// Don't provide any code lenses if we have not enabled data science
2626
const settings = this.configuration.getSettings();
27-
if (!settings.datascience.enabled) {
27+
if (!settings.datascience.enabled || !settings.datascience.enableCellCodeLens) {
2828
// Clear out any existing code watchers, providecodelenses is called on settings change
2929
// so we don't need to watch the settings change specifically here
3030
if (this.activeCodeWatchers.length > 0) {

src/test/datascience/editor-integration/codewatcher.unit.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ suite('DataScience Code Watcher Unit Tests', () => {
6868
errorBackgroundColor: '#FFFFFF',
6969
sendSelectionToInteractiveWindow: false,
7070
codeRegularExpression: '^(#\\s*%%|#\\s*\\<codecell\\>|#\\s*In\\[\\d*?\\]|#\\s*In\\[ \\])',
71-
markdownRegularExpression: '^(#\\s*%%\\s*\\[markdown\\]|#\\s*\\<markdowncell\\>)'
71+
markdownRegularExpression: '^(#\\s*%%\\s*\\[markdown\\]|#\\s*\\<markdowncell\\>)',
72+
enableCellCodeLens: true
7273
};
7374

7475
// Setup the service container to return code watchers

0 commit comments

Comments
 (0)