Skip to content

Autocomplete not working with global path #227

Closed
@abaksha-sc

Description

@abaksha-sc

Describe the bug
Next.js often use global path alias @ for sources (defines in tsconfig.json through "baseUrl": "." and "paths": { "@/*": ["./src/*"] }).
And in this case autocomplete for CSS-module doesn't work.

To Reproduce
Steps to reproduce the behavior:

  1. Go to sandbox sources
  2. Make sure first line is defined with absolute path: import styles from "@/styles/home.module.scss";
  3. Over cursor to variable styles on line 8.
  4. See the variable definition as

image

Expected behavior
Please modify sources:

  1. comment first line with absolute path import styles from "@/styles/home.module.scss";
  2. uncomment second line with relative path import styles from "../styles/home.module.scss";
  3. Hover variable styles on line 8.

In this case you will see the valid definition with CSS-classes as object keys like:

image

TypeScript version: 5.0.4
Plugin version: 5.0.1

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