Skip to content
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

VSCode do not support .sublime-syntax which is more powerful than .tmLanguage #5408

Closed
sandogeek opened this issue Apr 17, 2016 · 13 comments
Closed
Labels
feature-request Request for new features or functionality grammar Syntax highlighting grammar

Comments

@sandogeek
Copy link

  • VSCode Version:1.0.0
  • OS Version:Windows 7
    would it be possible to support it in the future?I think .sublime-syntax is more easy to write and readable.
@egamma egamma added the feature-request Request for new features or functionality label Apr 17, 2016
@kurtextrem
Copy link

Similar issue, which may be of some value here once it's fixed: atom/first-mate#50

@borela
Copy link

borela commented May 8, 2017

I wrote a syntax that combines reactjs with flow which would be impossible without the extra control push/set of the context that the sublime-syntax allows; the yaml files are cleaner and you can break the syntax into multiple files.

@rattrayalex-stripe
Copy link

There are syntax highlighting bugs in ES7/Flow/JSX that a Microsoft employee claims are unsolvable with the current syntax highlighting setup.

@mjbvz mjbvz added the grammar Syntax highlighting grammar label Nov 9, 2017
@kumarharsh
Copy link
Contributor

kumarharsh commented Dec 22, 2017

+1

This would be greatly appeciated. There are bugs like these: joshpeng/Sublime-Babel-VSCode#24, and a few flowtype cases which I don't see being fixed by the tmlanguage approach for now. Is there some work being done on the highlighter internally @mjbvz?

Just discovered a new parser which seems to be better: https://github.com/tree-sitter/tree-sitter

@bobvanderlinden
Copy link

Tree-sitter sounds very promising. Here is a talk from the recent fosdem: https://youtu.be/0CGzC_iss-8

It is currently used in Atom as an experimental feature.

@kumarharsh
Copy link
Contributor

Thanks for the video link - that was very informative!

@hickford
Copy link
Contributor

For an explanation of .sublime-syntax files, see https://www.sublimetext.com/docs/3/syntax.html

Sublime Text can use both .sublime-syntax and .tmLanguage files for syntax highlighting. Sublime Syntax files are YAML files with a small header, followed by a list of contexts. Each context has a list of patterns that describe how to highlight text in that context, and how to change the current

@RaphaelDDL
Copy link

RaphaelDDL commented Oct 24, 2018

👍

One of the things that make me "yuck" now that I'm trying to move from Sublime to VSCode is exactly how highlighters are weak, e.g.: Sublime's package "Sass" which comes with scss and sass sublime-syntax is a lot superior to vscode's "scss".

When trying to discover how convert a sublime-syntax into tmLanguage, which ends not being possible as syntax is a superset of tm.

So I can't add enough how supporting something already established is the way to go instead of going to implement a new tree-sitter (#50140 && #585) which doesn't look like it's happening as per the time already open. But then again, this one also is old, seems MS doesn't care :(

@Yankie
Copy link

Yankie commented Jun 17, 2019

+1

1 similar comment
@gtaifu
Copy link

gtaifu commented Nov 17, 2019

+1

@michaelblyons
Copy link

@jeff-hykin, @DrSensor; bringing this over here from the off-topic at #50140:

The conversion is straightforward, but the Sublime engine still has the vast majority of the same problems.

Non-deterministic parsing kind of changes that. Thom had interactions with the Tree Sitter creator about capabilities that became a little cranky on one side. Syntect does not appear to be finished with the branch_point support, but there's a BNF-to-sublime-syntax converter now.

Jeff, I'd be interested in reading your article when you're done.

@jeff-hykin
Copy link

jeff-hykin commented Mar 30, 2020

Thank you for calling me out on this! I was unaware of meta_backtracking_key, meta_backtracking_else, andfail as last time I dove deep into sublime parsing was before 2018. The I should've done better research. The branch point support also looks very interesting.

I'm glad you're interested in the article! I'll try to remember to @ you somewhere once I post it.

I'm especially excited by these sublime automaton features because the they will be trivial to add to the library that @matter123 and I have been working on. Not only that, but since we implemented it in a real language (Ruby) abstraction tools can be created to make the API much more practical and user friendly.

The branch point will be much more difficult to add, however the library already uses a very BNF-looking style of writing so its possible that once branch points are implemented, it could be easy (maybe even automatic) to have old syntaxes utilize branch points. Here's an example pattern for matching #include <iostream> using the library:

grammar[:include] = Pattern.new(
    # std_space allows for spaces or inline comments 
    start_of_line.then(std_space).then(
        Pattern.new(
            match: /#/,
            tag_as: "punctuation.definition.directive"
        ).maybe(spaces).then(
            match: /include/.or(/include_next/),
        ).then(word_boundary)
    ).maybe(spaces).then(
        # include_partial is a pattern for matching <>, "", and some other common possibilities
        include_partial
    ), 
)

My first criticism was that, yes that's impressive that it is a deterministic pushdown automaton, but technically BrainF**k is Turing complete haha, although I wouldn't want to write a parser using it either. But again, this is much alleviated by a library that can start doing abstractions on top of the raw features.

@alexr00
Copy link
Member

alexr00 commented Aug 9, 2022

Closing in favor of #216

@alexr00 alexr00 closed this as completed Aug 9, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality grammar Syntax highlighting grammar
Projects
None yet
Development

No branches or pull requests