Skip to content

Reuse Grammars from Sublime-TypeScript #675

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

Closed
blakeembrey opened this issue Oct 21, 2015 · 11 comments · Fixed by #813
Closed

Reuse Grammars from Sublime-TypeScript #675

blakeembrey opened this issue Oct 21, 2015 · 11 comments · Fixed by #813

Comments

@blakeembrey
Copy link
Member

From #672, we should investigate if a simple npm script can be utilized to copy and repackage the grammars from Sublime.

edits by @basarat:

We have very little custom work ...

  • The top that needs to be preserved across versions:
    ####
    # 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'
    }
  • The angular template support
    Angular2 Decorator Template Highlighting #798
@stepancar
Copy link
Contributor

@blakeembrey, I think we should ask typescript team. Maybe they have any plans to export/support typescript grammar as any external module.
Can you ask, please? I don't know how to ask correctly.
Way when we just copy grammars from sublime is not good, i think

@blakeembrey
Copy link
Member Author

@stepancar I think it's worth investigating from the Atom side first too. If we can just convert it with a script, there's no need for a separate module or special support. As for them publishing an external module, I don't have any ideas on the format of how that would look - I haven't had enough exposure to various IDE language definitions to know if it's simple to publish a common denominator (or maybe generate each of them?).

@stepancar
Copy link
Contributor

@blakeembrey i created issue
join to discussion :)

@blakeembrey
Copy link
Member Author

🎉 It's done. We should be investigating this soon, would be easy enough to use a script to convert into the format Atom uses. It looks like they're going to add a testing framework too, so that sounds like a huge win against maintaining the grammar here.

@sgal
Copy link
Contributor

sgal commented Nov 6, 2015

@blakeembrey As far as I see, those grammar files are just imported from Sublime Text package, so it's not a "real" TS grammar from MS. See microsoft/TypeScript-TmLanguage#1

We indeed should track the progress there, but I guess it's too early to integrate it here.

@quadrophobiac
Copy link

@blakeembrey I arrived here after indicating interest in one of the separate tickets (#707) prior to it's collation here by the recent mass assignment of 'up-for-grabs' labels. I read from your comment #675 (comment) that you are following the 'copy via script' rather than 'investigating from Atom first principles' option on this - did I understand that correctly? Does that mean that these are or are not still 'up-for-grabs' style issues?

@blakeembrey
Copy link
Member Author

@quadrophobiac Absolutely up for grabs, if you want to give it a shot I'll review the PR. I'm not currently working on this. Not sure what you meant copying rather than investigating Atom first principles?

@quadrophobiac
Copy link

Hey, I was referring to the chain of correspondence in previously when you said

I think it's worth investigating from the Atom side first too.

and then

It's done. We should be investigating this soon, would be easy enough to use a script to convert into the format Atom uses.

As I understand it the task is to create an Atom native grammar rather than a repurposed sublime grammar?

You also mentioned

It looks like they're going to add a testing framework too, so that sounds like a huge win against maintaining the grammar here.

I'm inferring that this is a test specification for .ts coming from MS - is that right?

I'll get a dev instance of the repo up and running in the meantime

@blakeembrey
Copy link
Member Author

@quadrophobiac All the grammar will come from the TypeScript sublime text side, we should only be converting it. The Atom side comment is exactly the same now as before, it's not a universal grammar so there's still conversion we need to do. In the original context, it was in response to opening an issue and moving everything prematurely (before we know what we're doing with it) but that's already happened now.

@quadrophobiac
Copy link

Ah ok got it!

@basarat
Copy link
Member

basarat commented Jan 12, 2016

@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants