Skip to content

updated grammar for tsx #672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2015
Merged

updated grammar for tsx #672

merged 1 commit into from
Oct 20, 2015

Conversation

stepancar
Copy link
Contributor

Hello @basarat! Yesterday i fixed #666, but it breaks
this grammar supports typescript (shameless copy from sublime-typescript it's better then babel grammar because for typescript :)
Please, check

@basarat, yesterday i fixed TypeStrong#666, but it breaks
this grammar supports typescript (shameless copy [from  sublime-typescript](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScriptReact.YAML-tmLanguage) it's better then babel grammar because for typescript :)
@basarat
Copy link
Member

basarat commented Oct 20, 2015

@stepancar awesome ... I've been meaning to be lazy and just let MS handle the grammar... how are you doing the conversion ... can you document the steps so I can keep it updated? 🌹

@stepancar
Copy link
Contributor Author

document the steps? I just downloaded sublime-typescript grammar , then converted to json usung this tool then converted to cson using thist tool then just puted to atom-typescript, then smiled))

basarat added a commit that referenced this pull request Oct 20, 2015
@basarat basarat merged commit a425a80 into TypeStrong:master Oct 20, 2015
@basarat
Copy link
Member

basarat commented Oct 20, 2015

@basarat
Copy link
Member

basarat commented Oct 20, 2015

Colors (and tokens) are bit different between tsx and ts :
image

:-/ Guess we might need to change a few token scope names

@blakeembrey
Copy link
Member

If you generated one from Sublime, why not just do the other too? Or has there been a lot of custom improvements over Sublime? I'm wondering, also, if someone could bring this into a common core for grammars in TypeScript to avoid this kind of duplicate work.

@basarat
Copy link
Member

basarat commented Oct 20, 2015

I'm wondering, also, if someone could bring this into a common core for grammars in TypeScript to avoid this kind of duplicate work.

Agreed ... we have very little custom work ... and I moved that up the top :

####
# Rules that no one should change
# These are used by code to provide fancy completions
####
{
'comment': 'Match debugger statement'
'match': '\\s*(debugger)[\\s;]+'
'captures':
'1':
'name':'keyword.debugger.ts'
}
{
'comment': 'Match full triple slash reference comments'
'match': '(\\/\\/\\/\\s*<reference\\s*path\\s*=)(.*)(\\/>)'
'captures':
'1':
'name':'keyword.other.ts'
'2':
'name':'reference.path.string'
'3':
'name':'keyword.other.ts'
}
{
'comment': 'Match <amd-dependency'
'match': '(\\/\\/\\/\\s*<amd-dependency\\s*path\\s*=)(.*)(\\/>)'
'captures':
'1':
'name':'keyword.other.ts'
'2':
'name':'amd.path.string'
'3':
'name':'keyword.other.ts'
}
{
'comment': 'Match <amd-module'
'match': '(\\/\\/\\/\\s*<amd-module\\s*name\\s*=)(.*)(\\/>)'
'captures':
'1':
'name':'keyword.other.ts'
'2':
'name':'amd.path.string'
'3':
'name':'keyword.other.ts'
}
{
'comment': 'Match import = require'
'match': '(import)\\s*([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)?\\s*=\\s*(require)\\s*\\((.*)\\)'
'captures':
'1':
'name':'keyword.other.ts'
'2':
'name':'variable.type.ts'
'3':
'name':'keyword.other.ts'
'4':
'name':'require.path.string'
}
{
'comment': 'Match ES6 "import from" syntax'
'match': '(import).*(from)\\s*(.*[\'"])'
'captures':
'1':
'name':'keyword.other.ts'
'2':
'name':'keyword.other.ts'
'3':
'name':'es6import.path.string'
}

But I don't want to move .ts grammar over till everyone is happy with the token names in .tsx grammar (which we just pushed/released)

@stepancar stepancar deleted the patch-2 branch October 20, 2015 23:03
@stepancar
Copy link
Contributor Author

@basarat,
as i understand you should commit your ts grammar changes
to tsx grammar too (for tsx highlighting)

stepancar added a commit to stepancar/atom-typescript that referenced this pull request Oct 21, 2015
fix for [yesterday changes](TypeStrong#672) 
and for [this issue](TypeStrong#673)
@stepancar stepancar mentioned this pull request Oct 21, 2015
@stepancar
Copy link
Contributor Author

I've been meaning to be lazy and just let MS handle the grammar

&

I'm wondering, also, if someone could bring this into a common core for grammars in TypeScript to avoid this kind of duplicate work.

Did MS have plans to handle grammar?

@blakeembrey
Copy link
Member

Did MS have plans to handle grammar?

Not that I know of, but we can always ask. If converting is as simple as a basic transform, then we can probably look at automating the custom patches and contributing syntax highlighting patches upstream instead - otherwise atom-typescript will continue diverging anyway.

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jsx highlighting breaks if text in span contains key words of typescript
3 participants