Skip to content

Commit d2ccb37

Browse files
committed
add support for stock Typescript syntax
1 parent 2c43d1a commit d2ccb37

File tree

4 files changed

+79
-4
lines changed

4 files changed

+79
-4
lines changed

after/syntax/typescript.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
" https://github.com/HerringtonDarkholme/yats.vim (stock Vim syntax)
12
" https://github.com/leafgarland/typescript-vim
2-
" should already be including the xml syntax
3-
call css_color#init('hex', 'extended'
4-
\, 'typescriptComment,typescriptLineComment,typescriptStringS,typescriptStringD,'
5-
\. 'typescriptStringB,typescriptCommentSkip,typescriptDocComment'
3+
call css_color#init('css', 'extended'
4+
\, 'typescriptString,typescriptStringProperty,typescriptStringS,typescriptStringD,typescriptStringB,'
5+
\. 'typescriptComment,typescriptLineComment,typescriptCommentSkip,typescriptDocComment'
66
\)

after/syntax/typescriptreact.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
runtime after/syntax/typescript.vim

tests/example.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { DefaultTheme } from 'styled-components';
2+
3+
const MyTheme = {
4+
green2: '#2f7a5c',
5+
green3: '#35b281',
6+
green4: '#26805c',
7+
green5: '#28664D',
8+
};
9+
10+
/* green darker variations
11+
'#3fa27b'
12+
'#378e6c'
13+
'#2f7a5c'
14+
'#28664D'
15+
'#20513e'
16+
*/
17+
18+
let x = '#20513e';
19+
let y = foo('#20513e');
20+
21+
export default myTheme;

tests/example.tsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
export class ResultRow extends b.Component<IFood> {
2+
static id: string = "search-result-row";
3+
4+
render(): b.INode {
5+
return (
6+
<Tr style={this.rowColorStyle(this.data.pH)}>
7+
<Td>{this.data.name}</Td>
8+
<Td>{this.data.pH}</Td>
9+
</Tr>
10+
);
11+
}
12+
13+
private rowColorStyle(ph: number): b.IStyle {
14+
let backgroundColor = "#00000000";
15+
let color = "whitesmoke";
16+
if (ph >= 9) {
17+
backgroundColor = "#ac39ac";
18+
} else if (ph >= 8.5) {
19+
backgroundColor = "#d279d2";
20+
} else if (ph >= 8.25) {
21+
backgroundColor = "#e6b3e6";
22+
} else if (ph >= 8) {
23+
backgroundColor = "#80bfff";
24+
} else if (ph >= 7.75) {
25+
backgroundColor = "#77b300";
26+
} else if (ph >= 7.5) {
27+
backgroundColor = "#5cd65c";
28+
} else if (ph >= 7.25) {
29+
backgroundColor = "#00e600";
30+
} else if (ph >= 7) {
31+
backgroundColor = "#ffff33";
32+
} else if (ph >= 6.5) {
33+
backgroundColor = "#ffcc00";
34+
} else if (ph >= 6.25) {
35+
backgroundColor = "#ff8000";
36+
} else if (ph >= 6) {
37+
backgroundColor = "#ff6600";
38+
} else if (ph >= 5.5) {
39+
backgroundColor = "#ff1a1a";
40+
} else if (ph >= 5) {
41+
backgroundColor = "#cc0000";
42+
color = "#ffffff";
43+
} else if (ph >= 4.5) {
44+
backgroundColor = "#990000";
45+
color = "#ffffff";
46+
} else {
47+
backgroundColor = "#660000";
48+
color = "#ffffff";
49+
}
50+
51+
return { backgroundColor, color };
52+
}
53+
}

0 commit comments

Comments
 (0)