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

Highlighting fails when generic type declaration spans many lines #475

Closed
mjbvz opened this issue Jun 20, 2017 · 5 comments
Closed

Highlighting fails when generic type declaration spans many lines #475

mjbvz opened this issue Jun 20, 2017 · 5 comments
Labels
limitation Issue is result of tmLanguage limitation where in the lookup does not go beyond current line wontfix Issue is either side effect or limitation that will not be fixed for now

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Jun 20, 2017

TS and JS Grammar Extension version: 0.0.22 / latest

From microsoft/vscode#29135

Code

Using the typescript react gammar:

const connectedComponent = connect<
	ApplicationState,
	Dispatch<TodoAction>,
	HomeComponent
>(mapStateToProps, mapDispatchToProps)(Home);

Elements after Dispatch< are marked as a tsx component and not highlighted properly:

screen shot 2017-06-20 at 1 46 04 pm

@sheetalkamat
Copy link
Member

This is by design as the grammar lookup doesn't allow multiple lines at a time. Hence at location connect < cannot be determined as type parameter.

@sheetalkamat sheetalkamat added the wontfix Issue is either side effect or limitation that will not be fixed for now label Jun 20, 2017
@vjeux
Copy link

vjeux commented Jun 21, 2017

JSX doesn't allow any [a-z] character before the < for the outer one, so Dispatch<TodoAction> cannot be a JSX element. Is there a way to encode this inside of the TmLanguage format?

@sheetalkamat
Copy link
Member

But the < could be less than operator.

@vjeux
Copy link

vjeux commented Jun 21, 2017

That's true but I don't really understand why it's an issue here. In this case, <TodoAction> is being recognized as a JSX element. In the JSX element detection, could you ensure that the previous character is not [a-zA-Z_$]?

@sheetalkamat
Copy link
Member

@vjeux yes that can be done, but please open another issue with valid code that is broken. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
limitation Issue is result of tmLanguage limitation where in the lookup does not go beyond current line wontfix Issue is either side effect or limitation that will not be fixed for now
Projects
None yet
Development

No branches or pull requests

3 participants