Fix hover text for ambient modules to display "module" instead of "namespace"#2668
Conversation
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>
|
|
||
| f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) | ||
| defer done() | ||
| f.VerifyQuickInfoAt(t, "1", "namespace MyNamespace", "") |
There was a problem hiding this comment.
Check if we already have a test for namespace quick info/hover. We probably do. If we do, delete this test.
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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 |
jakebailey
left a comment
There was a problem hiding this comment.
@DanielRosenwasser is this PR still good?
|
I think so |
…mespace" (#2668) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Fix quick info/hover display for ambient modules
module "*.css"incorrectly shownamespace "*.css"instead ofmodule "*.css"in hover/quick info/home/runner/work/typescript-go/typescript-go/internal/ls/hover.goat lines 366-371ast.IsAmbientModule()quickInfoDisplayPartsModules_test.go)Original prompt
namespacekeyword #2667💡 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.