Skip to content

vscode.languages.getDiagnostics() output depends on task run and file opening order #256118

@n-gist

Description

@n-gist

Version: 1.102.0
OS: Windows_NT x64 10.0.19045

Source: #245092 (comment)

Steps to Reproduce:

git clone https://github.com/n-gist/getDiagnostics-test.git

If need, install go-to-problem-1.0.0.vsix for testing vscode.languages.getDiagnostics() output, which logs to output channel named getDiagnostics() test, code:

// Ctrl+F8
const showCounters = () => {
	for (const d of vscode.languages.getDiagnostics()) {
		channel.appendLine(`${d[1].length}, ${d[0].toString()}`)
	}
}

// Shift+F8
const showContent = () => {
	for (const d of vscode.languages.getDiagnostics()) {
		channel.appendLine(`(${d[1].length}) ${d[0].toString()}:`)
		for (const e of d[1]) channel.appendLine(JSON.stringify(e))
		channel.appendLine('')
	}
}
  1. Start tsc: watch task
  2. Open file src/main.ts
  3. getDiagnostics() outputs 6 entries for main.ts. Expected: 3

Note: entries coming from task differs from extension ones. Their range.start and range.end equals. Not sure if this is an issue, or thats just how problem matchers work, giving only one, starting position

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugconfirmation-pending

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions