Closed
Description
Describe the bug
If any SCSS file happens to include comments that somehow have SCSS variables in them, your plugin will throw an exception and silently cripple the TypeScript server which seizes to work. It seems to attempt to parse the variables nonetheless.
To Reproduce
Steps to reproduce the behavior:
-
Create a CRA2.1 app with node-sass installed
-
Add a
Foo.module.scss
file. -
Add the following code to it:
.foo { width: 100px; } // .locationPanel { // height: calc(100vh - #{$pt-navbar-height}); // width: $locationPanel-width; // } // .locationDetails { // height: calc(100vh - #{$pt-navbar-height}); // width: calc(100% - #{$locationPanel-width}); // }
-
Import it using
import styles from "./Foo.module.scss";
-
Notice how the TypeScript server output will show errors and no more quick infos are usable
Expected behavior
No crash of the TypeScript server.
Screenshots
This is an excerpt of the TypeScript server log which shows the initial exception.
<css input>:14:1: Unknown word
CssSyntaxError: <css input>:14:1: Unknown word
at Input.error (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/input.js:130:16)
at Parser.unknownWord (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/parser.js:559:22)
at Parser.other (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/parser.js:168:12)
at Parser.parse (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/parser.js:77:16)
at parse (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/parse.js:17:12)
at new LazyResult (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/lazy-result.js:60:16)
at Processor.<anonymous> (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/processor.js:138:12)
at Processor.process (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/node_modules/postcss/lib/processor.js:117:23)
at Object.exports.getClasses (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/lib/helpers/cssSnapshots.js:9:47)
at Object.exports.getDtsSnapshot (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/lib/helpers/cssSnapshots.js:23:27)
at Object.ts.createLanguageServiceSourceFile (/Users/christian/Projects/graphql-pokemon/node_modules/typescript-plugin-css-modules/lib/index.js:23:49)
Desktop (please complete the following information):
- OS: macOS 10.4.2