Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Support function calls (#237)
Browse files Browse the repository at this point in the history
* Pass --disable-extensions flag while running tests

* Add .nvmrc

* Support function calls

* Run prettier
  • Loading branch information
umanghome authored Oct 11, 2020
1 parent 79f2787 commit 7fa4048
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 6 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The styled-components extension adds highlighting and IntelliSense for styled-co

## Raising an issue

Please check the issues list to see if it has already been raised. If it has you can vote on it with a thumbsUp emoji.
Please check the issues list to see if it has already been raised. If it has you can vote on it with a thumbsUp emoji.
Issues with the most votes tend to be prioritised.

## Contributing
Expand Down
13 changes: 11 additions & 2 deletions src/tests/runTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@ async function main() {
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index');

const launchArgs = [
// This disables all extensions except the one being tested
'--disable-extensions'
];

// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs,
});
} catch (err) {
console.error('Failed to run tests');
process.exit(1);
}
}

main();
main();
3 changes: 3 additions & 0 deletions src/tests/suite/colorize-fixtures/function-call.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const Component = styled(getComponent(props))`
max-width: 100%;
`;
244 changes: 244 additions & 0 deletions src/tests/suite/colorize-results/function-call_js.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
[
{
"c": "const",
"t": "source.js meta.var.expr.js storage.type.js",
"r": {
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6"
}
},
{
"c": " ",
"t": "source.js meta.var.expr.js",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "Component",
"t": "source.js meta.var.expr.js meta.var-single-variable.expr.js meta.definition.variable.js variable.other.constant.js",
"r": {
"dark_plus": "variable.other.constant: #4FC1FF",
"light_plus": "variable.other.constant: #0070C1",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": " ",
"t": "source.js meta.var.expr.js meta.var-single-variable.expr.js",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "=",
"t": "source.js meta.var.expr.js keyword.operator.assignment.js",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
"dark_vs": "keyword.operator: #D4D4D4",
"light_vs": "keyword.operator: #000000",
"hc_black": "keyword.operator: #D4D4D4"
}
},
{
"c": " ",
"t": "source.js meta.var.expr.js",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "styled",
"t": "source.js meta.var.expr.js meta.function-call.ts entity.name.function.ts",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "entity.name.function: #DCDCAA"
}
},
{
"c": "(",
"t": "source.js meta.var.expr.js meta.brace.round.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "getComponent",
"t": "source.js meta.var.expr.js meta.function-call.ts entity.name.function.ts",
"r": {
"dark_plus": "entity.name.function: #DCDCAA",
"light_plus": "entity.name.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "entity.name.function: #DCDCAA"
}
},
{
"c": "(",
"t": "source.js meta.var.expr.js meta.brace.round.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "props",
"t": "source.js meta.var.expr.js variable.other.readwrite.ts",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE"
}
},
{
"c": "))",
"t": "source.js meta.var.expr.js meta.brace.round.ts",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "`",
"t": "source.js meta.var.expr.js punctuation.definition.string.template.begin.js string.template.js",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": " ",
"t": "source.js meta.var.expr.js source.css.scss",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "max-width",
"t": "source.js meta.var.expr.js source.css.scss meta.property-name.scss support.type.property-name.css",
"r": {
"dark_plus": "support.type.property-name: #9CDCFE",
"light_plus": "support.type.property-name: #FF0000",
"dark_vs": "support.type.property-name: #9CDCFE",
"light_vs": "support.type.property-name: #FF0000",
"hc_black": "support.type.property-name: #D4D4D4"
}
},
{
"c": ":",
"t": "source.js meta.var.expr.js source.css.scss punctuation.separator.key-value.scss",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": " ",
"t": "source.js meta.var.expr.js source.css.scss",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "100",
"t": "source.js meta.var.expr.js source.css.scss meta.property-value.scss constant.numeric.css",
"r": {
"dark_plus": "constant.numeric: #B5CEA8",
"light_plus": "constant.numeric: #098658",
"dark_vs": "constant.numeric: #B5CEA8",
"light_vs": "constant.numeric: #098658",
"hc_black": "constant.numeric: #B5CEA8"
}
},
{
"c": "%",
"t": "source.js meta.var.expr.js source.css.scss meta.property-value.scss constant.numeric.css keyword.other.unit.percentage.css",
"r": {
"dark_plus": "keyword.other.unit: #B5CEA8",
"light_plus": "keyword.other.unit: #098658",
"dark_vs": "keyword.other.unit: #B5CEA8",
"light_vs": "keyword.other.unit: #098658",
"hc_black": "keyword.other.unit: #B5CEA8"
}
},
{
"c": ";",
"t": "source.js meta.var.expr.js source.css.scss punctuation.terminator.rule.scss",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "`",
"t": "source.js meta.var.expr.js punctuation.definition.string.template.end.js string.template.js",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": ";",
"t": "source.js punctuation.terminator.statement.js",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
}
]
13 changes: 10 additions & 3 deletions syntaxes/styled-components.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"patterns": [
{
"contentName": "source.css.scss",
"begin": "(?:([\\s\\S][sS][tT][yY][lL][eE][dD](?:<.+>(?=\\())?(?:\\.[_$[:alpha:]][_$[:alnum:]]*|\\(['\"][_$[:alpha:]][_$[:alnum:]]*['\"]\\)|\\([_$[:alpha:]][_$\\.[:alnum:]]*(?:\\s+as\\s+.*?)?\\))(?:\\s*<.+>)?)|(css|keyframes|injectGlobal|createGlobalStyle)(<.+>)?)\\s*(`)",
"begin": "(?:([\\s\\S][sS][tT][yY][lL][eE][dD](?:<.+>(?=\\())?(?:\\.[_$[:alpha:]][_$[:alnum:]]*|\\(['\"][_$[:alpha:]][_$[:alnum:]]*['\"]\\)|\\((.+)\\))(?:\\s*<.+>)?)|(css|keyframes|injectGlobal|createGlobalStyle)(<.+>)?)\\s*(`)",
"beginCaptures": {
"1": {
"patterns": [
Expand All @@ -14,16 +14,23 @@
]
},
"2": {
"name": "entity.name.function.tagged-template.js"
"patterns": [
{
"include": "source.ts#expression"
}
]
},
"3": {
"name": "entity.name.function.tagged-template.js"
},
"4": {
"patterns": [
{
"include": "source.ts#type-parameters"
}
]
},
"4": {
"5": {
"name": "punctuation.definition.string.template.begin.js string.template.js"
}
},
Expand Down

0 comments on commit 7fa4048

Please sign in to comment.