Skip to content

Commit

Permalink
revert to typescriptreact filetype
Browse files Browse the repository at this point in the history
  • Loading branch information
ecklf committed Oct 16, 2019
1 parent 88edbff commit e1f052d
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
1 change: 0 additions & 1 deletion ftdetect/tsx.vim

This file was deleted.

1 change: 1 addition & 0 deletions ftdetect/typescriptreact.vim
@@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.tsx setlocal filetype=typescriptreact
File renamed without changes.
2 changes: 1 addition & 1 deletion indent/tsx.vim → indent/typescriptreact.vim
Expand Up @@ -107,4 +107,4 @@ fu! GetTsxIndent()
endif

return ind
endfu
endfu
2 changes: 1 addition & 1 deletion syntax/common.vim
Expand Up @@ -7,7 +7,7 @@ command -nargs=+ HiLink hi def link <args>

"Dollar sign is permitted anywhere in an identifier
setlocal iskeyword-=$
if main_syntax == 'typescript' || main_syntax == 'typescript.tsx'
if main_syntax == 'typescript' || main_syntax == 'typescriptreact'
setlocal iskeyword+=$
" syntax cluster htmlJavaScript contains=TOP
endif
Expand Down
8 changes: 4 additions & 4 deletions syntax/tsx.vim → syntax/typescriptreact.vim
Expand Up @@ -2,7 +2,7 @@ if !exists("main_syntax")
if exists("b:current_syntax") && b:current_syntax != 'typescript'
finish
endif
let main_syntax = 'typescript.tsx'
let main_syntax = 'typescriptreact'
endif

syntax region tsxTag
Expand Down Expand Up @@ -134,7 +134,7 @@ highlight def link tsxEscJs tsxEscapeJs
highlight def link tsxCloseTag htmlTag
highlight def link tsxCloseString Identifier

let b:current_syntax = "typescript.tsx"
if main_syntax == 'typescript.tsx'
let b:current_syntax = "typescriptreact"
if main_syntax == 'typescriptreact'
unlet main_syntax
endif
endif
14 changes: 7 additions & 7 deletions test/tsx.indent.vader
@@ -1,4 +1,4 @@
Given typescript.tsx (html end tags):
Given typescriptreact (html end tags):
<div>
name="cat"
value={value}
Expand All @@ -11,7 +11,7 @@ Given typescript.tsx (html end tags):
Do (indent the block):
gg=G

Expect typescript.tsx indented block:
Expect typescriptreact indented block:
<div>
name="cat"
value={value}
Expand All @@ -21,7 +21,7 @@ Expect typescript.tsx indented block:
onremove={() => console.log('bye')}
</div>

Given typescript.tsx (badly indented component):
Given typescriptreact (badly indented component):
class MyComponent {
public render() {
return (
Expand Down Expand Up @@ -56,7 +56,7 @@ Given typescript.tsx (badly indented component):
Do (indent the block):
gg=G

Expect typescript.tsx indented blocks:
Expect typescriptreact indented blocks:
class MyComponent {
public render() {
return (
Expand Down Expand Up @@ -88,7 +88,7 @@ Expect typescript.tsx indented blocks:
}
}

Given typescript.tsx (badly indented component + non tsx):
Given typescriptreact (badly indented component + non tsx):
interface MyComponentProps {
first: string;
second: boolean;
Expand Down Expand Up @@ -132,7 +132,7 @@ Given typescript.tsx (badly indented component + non tsx):
Do (indent the block):
gg=G

Expect typescript.tsx indented blocks:
Expect typescriptreact indented blocks:
interface MyComponentProps {
first: string;
second: boolean;
Expand Down Expand Up @@ -171,4 +171,4 @@ Expect typescript.tsx indented blocks:
</Table>
);
}
}
}
28 changes: 14 additions & 14 deletions test/tsx.vader
@@ -1,4 +1,4 @@
Given typescript.tsx (basic usage):
Given typescriptreact (basic usage):
var a = <div></div>
var b = 123

Expand All @@ -7,7 +7,7 @@ Execute:
AssertEqual 'tsxIntrinsicTagName', SyntaxAt(1, 10)
AssertEqual 'typescriptVariable', SyntaxAt(2, 1)

Given typescript.tsx (basic void):
Given typescriptreact (basic void):
var a = <img/>
var b = 123

Expand All @@ -16,7 +16,7 @@ Execute:
AssertEqual 'tsxIntrinsicTagName', SyntaxAt(1, 10)
AssertEqual 'typescriptVariable', SyntaxAt(2, 1)

Given typescript.tsx (interpolation):
Given typescriptreact (interpolation):
var a = <Option key={item}></Option>;
var b = 123

Expand All @@ -25,7 +25,7 @@ Execute:
AssertEqual 'tsxTagName', SyntaxAt(1, 30)
AssertEqual 'typescriptVariable', SyntaxAt(2, 1)

Given typescript.tsx (custom component):
Given typescriptreact (custom component):
var a = <ion-gesture></ion-gesture>;
var b = 123

Expand All @@ -34,7 +34,7 @@ Execute:
AssertEqual 'tsxIntrinsicTagName', SyntaxAt(1, 30)
AssertEqual 'typescriptVariable', SyntaxAt(2, 1)

Given typescript.tsx (digit in tagname):
Given typescriptreact (digit in tagname):
var a = <h1></h1>;
var b = 123

Expand All @@ -43,15 +43,15 @@ Execute:
AssertEqual 'tsxIntrinsicTagName', SyntaxAt(1, 16)
AssertEqual 'typescriptVariable', SyntaxAt(2, 1)

Given typescript.tsx (paren + render props):
Given typescriptreact (paren + render props):
var d = (
<Route component={() => <Home/>}/>
)

Execute:
AssertEqual 'tsxTagName', SyntaxAt(2, 4)

Given typescript.tsx (attributes):
Given typescriptreact (attributes):
var d = <Route component={() => <Home/>}
another-attribute="1"
/>
Expand All @@ -63,7 +63,7 @@ Execute:
AssertEqual 'tsxAttrib', SyntaxAt(2, 3)
AssertEqual 'tsxAttrib', SyntaxAt(2, 11)

Given typescript.tsx (paren + attributes):
Given typescriptreact (paren + attributes):
var d = (
<Route component={() => <Home/>}
another-attribute="1"
Expand All @@ -76,7 +76,7 @@ Execute:
AssertEqual 'tsxAttrib', SyntaxAt(3, 5)
AssertEqual 'tsxAttrib', SyntaxAt(3, 13)

Given typescript.tsx (object in jsx attribute):
Given typescriptreact (object in jsx attribute):
var d = <Route component={{ test: 1 }}
another-attribute="1"
/>
Expand All @@ -85,7 +85,7 @@ Execute:
AssertEqual 'typescriptObjectLiteral', SyntaxAt(1, 28)
AssertEqual 'typescriptObjectLabel', SyntaxAt(1, 29)

Given typescript.tsx (line comment in tsxTag):
Given typescriptreact (line comment in tsxTag):
const foo = () => (
<div
// this is a comment
Expand All @@ -97,7 +97,7 @@ Given typescript.tsx (line comment in tsxTag):
Execute:
AssertEqual 'tsxLineComment', SyntaxAt(3, 12)

Given typescript.tsx (line comment in tsxRegion):
Given typescriptreact (line comment in tsxRegion):
const foo = () => (
<div>
{ // this is a comment
Expand All @@ -110,7 +110,7 @@ Execute:
AssertEqual 'tsxLineComment', SyntaxAt(3, 10)
AssertEqual 'tsxLineComment', SyntaxAt(6, 42)

Given typescript.tsx (block comment in tsxTag):
Given typescriptreact (block comment in tsxTag):
const foo = () => (
<div
/*
Expand All @@ -126,7 +126,7 @@ Given typescript.tsx (block comment in tsxTag):
Execute:
AssertEqual 'tsxBlockComment', SyntaxAt(5, 11)

Given typescript.tsx (block comment in tsxRegion):
Given typescriptreact (block comment in tsxRegion):
const foo = () => (
<div>
{/* this is a comment */}
Expand All @@ -140,4 +140,4 @@ Given typescript.tsx (block comment in tsxRegion):
Execute:
AssertEqual 'tsxBlockComment', SyntaxAt(3, 9)
AssertNotEqual 'tsxBlockComment', SyntaxAt(4, 0)
AssertEqual 'tsxBlockComment', SyntaxAt(6, 9)
AssertEqual 'tsxBlockComment', SyntaxAt(6, 9)

0 comments on commit e1f052d

Please sign in to comment.