vscode: CSS in JS snippets do not work from Extension, only User Snippets

  • VSCode Version: 1.33.1
  • OS Version: 10.14.4

Steps to Reproduce:

  1. Install an extension I created - styled-components-snippets
  2. Reload VSCode
  3. Create a .js file
  4. Try imsc snippet to make sure extension is installed.
  5. Try sc snippet to create a Styled-Component.

At this point you should have this

import styled from 'styled-components';

const StyledDiv = styled.div`
	
`;

sc-snippets-broke 2019-05-06 14_46_20

  1. Try scp inside the template literal like this
const StyledDiv = styled.div`
  scp
`;

Does anything happen? It does not for me, and others.

sc-snippets-broke-3 2019-05-06 14_55_48

  1. Place cursor inside template literal like Step 6, open Command Palette -> Developer: Inspect TM Scopes.

  2. Confirm it says language: css.

sc-snippets-broke-1 2019-05-06 14_47_52

  1. Preferences -> User Snippets -> css.json

Add the following

"Use props inside styled-component": {
	"prefix": "scp",
	"body": "${props => props.${1}};",
	"description": "Use props inside styled-component"
}

sc-snippets-broke-2 2019-05-06 14_52_07

  1. Save, Reload VSCode, and try step 6 again. It should work! The User Snippet works, but the extension does not.

  2. Confirm the extension is correctly mapped to the CSS language on Github.

  3. If you can confirm Step 11, and Step 12, why else would the extension fail here? Thank you.

Does this issue occur when all extensions are disabled?: Unable to answer as I need the extension to test it.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Holy crap

Edit: Upgrading and testing now. v0.2.6