Skip to content

Feature Request: --declarationMap option #177

@mizdra

Description

@mizdra

Problem

Currently, when I click on a property imported from CSS Modules from VSCode, it jumps to .d.ts. Normally, users expect to jump to .css, not to .d.ts. Therefore, this behavior is confusing to users.

It would be useful to be able to switch the jump destination to .css.

Solution

Add the option --declarationMap to generate a source map for .d.ts which map back to the original .css. This allows VSCode to jump to the css file when clicking on a property.

This option is inspired by the --declarationMap option of tsc.

PoC

You can try the PoC from the following:

There is no test yet, but I implemented the necessary features. There are no breaking changes. If the maintainers are interested this feature, please tell me. I will add tests and open a Pull Request.

2022-03-28.0.40.19.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions