Skip to content

IntelliSense in JavaScript is broken when documenting a context for a function in argument (this replaced by globalThis) #48498

@ghost

Description

Does this issue occur when all extensions are disabled?

Yes.

Platform

  • Version: 1.66.0 (user setup)
  • Commit: e18005f0f1b33c29e81d732535d8c0e47cafb0b5
  • Date: 2022-03-30T05:50:14.623Z
  • Electron: 17.2.0
  • Chromium: 98.0.4758.109
  • Node.js: 16.13.0
  • V8: 9.8.177.11-electron.0
  • OS: Windows_NT x64 10.0.19044

Steps to Reproduce

Step 1

Everything is ok in this step.

class Foo
{
	bar()
	{
		// Type `this` here: the suggestion tooltip will show `this` first, then `globalThis`.
	}
}

Step 1

Step 2

Everything is ok in this step.

class Foo
{
	bar()
	{
		// Type `this` here: the suggestion tooltip will show `this` first, then `globalThis`.
	}

	baz(callback)
	{

	}
}

Step 2

Step 3

The issue occurs in this step. The documentation part that exactly causes the problem is this: CallbackContext, so when we define a context for a function in argument.

class Foo
{
	bar()
	{
		// Type `this` here: the suggestion tooltip will only show `globalThis` first and never `this`.
	}

	/**
	 * @param {function(this: CallbackContext)} callback
	 */
	baz(callback)
	{

	}
}

Step 3

Summary

A quick GIF to summarize the issue.

GIF

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions