Skip to content

Start adopting unified js/ts config for code lenses#294264

Merged
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/long-meerkat
Feb 11, 2026
Merged

Start adopting unified js/ts config for code lenses#294264
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/long-meerkat

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Feb 11, 2026

For #292934

Testing this with a self contained area first: code lenses. Will keep support for the old setting values too to avoid breaking existing settings

For microsoft#292934

Testing this with a self contained area first: code lenses. Will keep support for the old setting values too to avoid breaking existing settings
Copilot AI review requested due to automatic review settings February 11, 2026 00:15
@mjbvz mjbvz enabled auto-merge February 11, 2026 00:15
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR starts adopting a unified js/ts.* configuration namespace for the TypeScript/JavaScript CodeLens settings in the typescript-language-features extension, while preserving support for the legacy javascript.* / typescript.* settings via fallback logic.

Changes:

  • Added new helper utilities to read unified js/ts settings with fallback to the legacy language-specific sections.
  • Updated references/implementations CodeLens providers to use unified settings and react to unified configuration changes.
  • Introduced new js/ts.* CodeLens settings in package.json and deprecated the legacy settings with updated NLS strings.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
extensions/typescript-language-features/src/utils/configuration.ts Adds shared unified-config read/inspect helpers for js/ts.* with fallback logic.
extensions/typescript-language-features/src/languageFeatures/util/dependentRegistration.ts Adds a new conditional registration helper based on unified/legacy config modification detection.
extensions/typescript-language-features/src/languageFeatures/codeLens/referencesCodeLens.ts Switches references CodeLens to unified settings + adds early-return based on unified enablement.
extensions/typescript-language-features/src/languageFeatures/codeLens/implementationsCodeLens.ts Switches implementations CodeLens to unified settings + adds early-return based on unified enablement.
extensions/typescript-language-features/package.nls.json Replaces per-language CodeLens setting strings with unified descriptions + deprecation messages.
extensions/typescript-language-features/package.json Adds js/ts.* CodeLens settings and marks legacy settings as deprecated.
Comments suppressed due to low confidence (1)

extensions/typescript-language-features/src/languageFeatures/util/dependentRegistration.ts:110

  • The doc comment says this checks modifications in “either the global or workspace scope”, but hasModifiedUnifiedConfig/hasModifiedValue also considers workspace-folder and language-specific overrides. Please update the comment to match the actual behavior (or narrow the implementation to what’s documented).
/**
 * Requires that a configuration value has been modified from its default value in either the global or workspace scope
 *
 * Does not check the value, only that it has been modified from the default.
 */

Comment on lines +111 to +118
export function requireHasModifiedUnifiedConfig(
configValue: string,
fallbackSection: string,
) {
return new Condition(
() => hasModifiedUnifiedConfig(configValue, { fallbackSection }),
vscode.workspace.onDidChangeConfiguration
);
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requireHasModifiedUnifiedConfig registers the CodeLens provider when the setting is merely modified, even if it’s explicitly set to false (same as default). This means users can end up with the provider registered and queried even though it will always return no lenses. Consider making the condition check whether the setting is enabled in any relevant scope (unified or legacy), instead of just modified.

This issue also appears on line 106 of the same file.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a separate check for this in the provider

Comment on lines 96 to 101
switch (item.kind) {
case PConst.Kind.function: {
const showOnAllFunctions = vscode.workspace.getConfiguration(this.language.id).get<boolean>('referencesCodeLens.showOnAllFunctions');
const showOnAllFunctions = readUnifiedConfig<boolean>(Config.showOnAllFunctions, false, { scope: document, fallbackSection: this.language.id });
if (showOnAllFunctions && item.nameSpan) {
return getSymbolRange(document, item);
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readUnifiedConfig calls getConfiguration().inspect() which is relatively expensive, and here it’s invoked inside extractSymbol while walking many navtree nodes. This can be a noticeable regression for large files. Consider caching these config values per document (or per provideCodeLenses call) so the inspect/get work happens once, not per symbol.

Copilot uses AI. Check for mistakes.
Comment on lines 130 to 145
// If configured, show on interface methods
if (
item.kind === PConst.Kind.method &&
parent?.kind === PConst.Kind.interface &&
cfg.get<boolean>('implementationsCodeLens.showOnInterfaceMethods', false)
readUnifiedConfig<boolean>('implementationsCodeLens.showOnInterfaceMethods', false, { scope: document, fallbackSection: this.language.id })
) {
return getSymbolRange(document, item);
}


// If configured, show on all class methods
if (
item.kind === PConst.Kind.method &&
parent?.kind === PConst.Kind.class &&
cfg.get<boolean>('implementationsCodeLens.showOnAllClassMethods', false)
readUnifiedConfig<boolean>('implementationsCodeLens.showOnAllClassMethods', false, { scope: document, fallbackSection: this.language.id })
) {
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readUnifiedConfig (which uses inspect) is called for each candidate symbol while traversing the navtree. For large files this is avoidable overhead compared to reading config once. Consider caching the relevant settings per document (e.g. enabled, showOnInterfaceMethods, showOnAllClassMethods) so these checks don’t re-run inspect repeatedly.

Copilot uses AI. Check for mistakes.
Comment on lines +233 to +242
"js/ts.implementationsCodeLens.enabled": {
"type": "boolean",
"default": false,
"description": "%configuration.implementationsCodeLens.enabled%",
"scope": "language-overridable",
"tags": [
"JavaScript",
"TypeScript"
]
},
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The js/ts.implementationsCodeLens.* settings are tagged for both JavaScript and TypeScript, but the descriptions say they apply to “TypeScript files”. If implementations CodeLens is still TS-only, the tags/description should be adjusted to avoid advertising this as a JS setting (or expand the implementation/docs to clearly support JS too).

Copilot uses AI. Check for mistakes.
Comment on lines +45 to 56
override async provideCodeLenses(document: vscode.TextDocument, token: vscode.CancellationToken): Promise<ReferencesCodeLens[]> {
const enabled = readUnifiedConfig<boolean>(Config.enabled, false, { scope: document, fallbackSection: this.language.id });
if (!enabled) {
return [];
}

return super.provideCodeLenses(document, token);
}

public async resolveCodeLens(codeLens: ReferencesCodeLens, token: vscode.CancellationToken): Promise<vscode.CodeLens> {
const args = typeConverters.Position.toFileLocationRequestArgs(codeLens.file, codeLens.range.start);
const response = await this.client.execute('references', args, token, {
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New unified js/ts.* CodeLens settings are introduced along with fallback logic, but the existing smoke tests still only cover the legacy typescript.* keys. Please add coverage for the unified keys (including language-specific overrides) to ensure the precedence and fallback behavior stays correct.

Copilot uses AI. Check for mistakes.
@mjbvz mjbvz merged commit e2fdcd4 into microsoft:main Feb 11, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants