Skip to content

Returning diagnostics from lsp-sample is not adding errors in the active document #1168

@ViswaTejaKommireddy

Description

@ViswaTejaKommireddy

Extension sample

lsp-sample

VS Code version

1.75.0

What went wrong?

I was returning the WorkspaceDiagnosticReport from connection.languages.diagnostics.onWorkspace with the diagnostics list, but the errors (red squiggly lines) are not visible in the active document.

connection.languages.diagnostics.onWorkspace(async (params, token, _, resultProgress): Promise<WorkspaceDiagnosticReport> => {
const diagnosticReport: WorkspaceFullDocumentDiagnosticReport = {
			kind: DocumentDiagnosticReportKind.Full,
			uri: path,
			version: versionCounter++,
			items: workspaceDiagnostics,
			resultId: `${resultIdCounter++}`
		};

		resultProgress!.report({ items: [diagnosticReport] });
		return { items: [diagnosticReport] };
});

Is there any other way to emit errors from this funtion?

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions