Skip to content

Activation throws TypeError on VS Code < 1.90 (engines mismatch with vscode.lm access) #68

@Forbiddem

Description

@Forbiddem

Summary

The extension declares engines.vscode: ^1.50.0 but the first statement of activate() accesses vscode.lm.registerMcpServerDefinitionProvider without optional chaining. The vscode.lm namespace was only added in VS Code 1.90, so on any host before that the extension throws on activation and none of the four providers (MCP, hover, completion, diagnostics) register.

Location

packages/vscode-extension/src/extension.ts:51

export function activate(context: vscode.ExtensionContext) {
	if (vscode.lm.registerMcpServerDefinitionProvider) {            // ← non-optional
		context.subscriptions.push(
			vscode.lm?.registerMcpServerDefinitionProvider(             // (chained here, but the check above already crashed)
				...

Reproduction

Minimal repro of the access pattern outside of VS Code:

$ node -e 'const vscode={}; if (vscode.lm.registerMcpServerDefinitionProvider) {}'
TypeError: Cannot read properties of undefined (reading 'registerMcpServerDefinitionProvider')

On VS Code 1.50 – 1.89 the extension host triggers the same TypeError on activate(), marks the extension as failed-to-activate, and silently disables all scope linting features for that session.

Suggested fix

Either:

-    if (vscode.lm.registerMcpServerDefinitionProvider) {
+    if (vscode.lm?.registerMcpServerDefinitionProvider) {

or bump engines.vscode to the version where registerMcpServerDefinitionProvider shipped (^1.99.0), so the manifest reflects the real runtime requirement.

Happy to send a PR if it's helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions