Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompletion doesnt work with dollar character #94

Open
awolkers opened this issue Apr 17, 2024 · 1 comment
Open

Autocompletion doesnt work with dollar character #94

awolkers opened this issue Apr 17, 2024 · 1 comment

Comments

@awolkers
Copy link

awolkers commented Apr 17, 2024

When using a dollar character when importing the styles autocmpletion doesnt work, It only works when importing styles as a string name.

Doesnt work:
import $ from './SomeComponent.module.scss';

<SomeComponent className={$.someClassName}/>

@iChenLei
Copy link
Collaborator

function getWords(line: string, position: Position): string {
const text = line.slice(0, position.character);
// support optional chain https://github.com/tc39/proposal-optional-chaining
// covert ?. to .
const convertText = text.replace(/(\?\.)/g, '.');
const index = convertText.search(/[a-zA-Z0-9._]*$/);
if (index === -1) {
return "";
}
return convertText.slice(index);
}

This Regex (line 26) will not match the dollar sign .

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

No branches or pull requests

2 participants