Skip to content

support goToDefinition also for less #192

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

Merged
merged 2 commits into from
Feb 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/helpers/getCssExports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const getCssExports = ({
syncImport: true,
filename: fileName,
paths: [directory],
sourceMap: true,
...(rendererOptions.less ?? {}),
} as Less.Options,
(error?: Less.RenderError, output?: Less.RenderOutput) => {
Expand All @@ -85,6 +86,11 @@ export const getCssExports = ({
if (output === undefined) {
throw new Error('No Less output.');
}

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the types wrong here? Did you encounter a situation where this could be falsey?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less.RenderOutput.map is typed as string, but it can output undefined, so yes, the types are wrong.

sourceMap = JSON.parse(output.map ?? 'undefined') as
| RawSourceMap
| undefined;
transformedCss = output.css.toString();
},
);
Expand Down