Skip to content

Fix hover text for ambient modules to display "module" instead of "namespace"#2668

Open
Copilot wants to merge 5 commits intomainfrom
copilot/fix-quick-info-hover-issue
Open

Fix hover text for ambient modules to display "module" instead of "namespace"#2668
Copilot wants to merge 5 commits intomainfrom
copilot/fix-quick-info-hover-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Fix quick info/hover display for ambient modules

  • Understand the issue - ambient modules like module "*.css" incorrectly show namespace "*.css" instead of module "*.css" in hover/quick info
  • Locate the bug - found in /home/runner/work/typescript-go/typescript-go/internal/ls/hover.go at lines 366-371
  • Create test case to validate the fix - added ambient module test
  • Implement the fix to check for ambient modules using ast.IsAmbientModule()
  • Run tests to ensure fix works - all quick info tests passing
  • Verify no regressions with broader test suite - all tests pass
  • Code review and security scan complete
  • Remove duplicate namespace test (already covered by quickInfoDisplayPartsModules_test.go)
Original prompt

This section details on the original issue you should resolve

<issue_title>Quick info/hover on ambient module shows namespace keyword</issue_title>
<issue_description>Image

// @filename: foo.d.ts
module "*.css/*$*/";

Request quick info at /*$*/". It will result in

namespace "*.css"
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 4, 2026 00:47
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix quick info display for ambient module namespace keyword Fix hover text for ambient modules to display "module" instead of "namespace" Feb 4, 2026
Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
defer done()
f.VerifyQuickInfoAt(t, "1", "namespace MyNamespace", "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if we already have a test for namespace quick info/hover. We probably do. If we do, delete this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the duplicate test. The existing quickInfoDisplayPartsModules_test.go already covers namespace quick info verification. (commit 09c1f76)

Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
@DanielRosenwasser DanielRosenwasser marked this pull request as ready for review February 5, 2026 00:06
Copilot AI review requested due to automatic review settings February 5, 2026 00:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a bug where hovering over ambient module declarations (e.g., declare module "*.css") incorrectly displayed "namespace" instead of "module" in the quick info/hover text.

Changes:

  • Fixed the hover text logic to correctly identify ambient modules using ast.IsAmbientModule()
  • Added a test case to verify ambient modules display as "module" rather than "namespace"

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/ls/hover.go Updated quick info generation to check for ambient modules (modules with string literal names) and display them as "module" instead of "namespace"
internal/fourslash/tests/quickInfoAmbientModule_test.go Added test to verify ambient modules like declare module "*.css" show "module" in hover text

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.

Quick info/hover on ambient module shows namespace keyword

2 participants