Skip to content

Track file extension in LSP request failure telemetry#3228

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/track-file-type-for-failures
Draft

Track file extension in LSP request failure telemetry#3228
Copilot wants to merge 2 commits intomainfrom
copilot/track-file-type-for-failures

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

When an LSP request panics and the server recovers, the telemetry event includes no information about which file type was involved, making it harder to identify JS-specific or extension-specific patterns in failures.

Changes

  • lsproto (generated + generator): Added optional fileExtension field to RequestFailureTelemetryProperties. Field is *string with omitzero so it's absent from the payload when not applicable.
  • server.go: Updated recover to accept a fileExtension string parameter. All three generic handler registrars (registerLanguageServiceDocumentRequestHandler, registerLanguageServiceWithAutoImportsRequestHandler, registerMultiProjectReferenceRequestHandler) now extract the extension via tspath.TryGetExtensionFromPath(params.TextDocumentURI().FileName()) before the deferred call. handleCompletionItemResolve and handleCodeLensResolve do the same from their respective file references; handleWorkspaceSymbol passes "".
  • telemetryReporting.ts: Added fileExtension?: string to LSErrorResponse to match.

Example telemetry properties emitted on a panic in a .js file:

{
  "errorCode": "-32603",
  "requestMethod": "textDocument.hover",
  "stack": "...",
  "fileExtension": ".js"
}

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI changed the title [WIP] Add file type tracking for failing requests Track file extension in LSP request failure telemetry Mar 25, 2026
Copilot AI requested a review from DanielRosenwasser March 25, 2026 18:58
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.

Track file type or extension for failing requests

2 participants