-
Notifications
You must be signed in to change notification settings - Fork 74
feat: add support for "go to definition" for Sass #137
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
I left a few minor suggestions
if (!cssExports.sourceMap) return dts; | ||
|
||
// Create a new source map consumer. | ||
const smc = new SourceMapConsumer(cssExports.sourceMap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, we could call it sourceMapConsumer
instead of smc
?
]) | ||
.filter(([className]) => isValidVariable(className as string)); | ||
|
||
filteredClasses.forEach(([className, hashedClassName]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we use reduce here?
const dtsLines = filteredClasses.reduce(...
} else { | ||
switch (fileType) { | ||
case FileType.less: | ||
less.render( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of breaking this function down into smaller helpers?
I have something like this in mind, e.g.
const getCustomRenderer = (...) => [transformedCss, ]
const lessRenderer = (...) => [transformedCss, ]
const sassRenderer = (...) => [transformedCss, sourceMap]
const getRenderer = (fileType) => renderer
const [transformedCss, sourceMap] = getRenderer(fileType)(...)
It's not very important though, so we can change it later
Hey @mrmckeb, would you like some assistance getting this PR moving? PS. Noticed that an |
Hey there, trying to make this work on our current setup. At first I was tinkering with a custom renderer, but I soon realised that So as a POC before thinking about adding the sourceMap option to the custom renderer, I went ahead and modified sourceMap with unmodified
|
any update? I really need this feature (scss module). |
I clone the code to the local computer, build it, and then use the 'yarn link' command to use in the project. However, this feature does not work |
This adds experimental support for "go to definition" for Sass.
Resolves #34.