Raathigesh / fabulous

🎨 CSS properties sidebar for VS Code
MIT License
1.01k stars 26 forks source link

Errors if the file contains anonymous template literals #29

Open jbachhardie opened 5 years ago

jbachhardie commented 5 years ago

Describe the bug When a file contains template literals that are not assigned to a variable, Fabulous fails to work with the following error:

TypeError: Cannot read property 'name' of undefined
    at TaggedTemplateExpression (raathigeshan.fabulous-0.10.0\out\extension\file-handlers\js.js:16:38)

To Reproduce In our codebase, it is failing on styled-components interpolated templates like the following but looking at the file handler it will probably fail for any tagged template that isn't assigned to a variable:

export const SearchCentering = styled.div`
  width: 100%;
  ${mediaMin.xxl`
  margin: 0 auto;
  max-width: 1200px;
  `};
`;

Expected behavior Tagged templates that aren't defining a styled component should be ignored by Fabulous and the extension should still work.

Raathigesh commented 5 years ago

Thanks for reporting. A partial fix is available in 0.12.0 but still Fabulous doesn't support editing nested template literal as shown in the example but at least it doesn't crash after the error.

Will keep this issue open until we handle nested literals properly.