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

Template string highlighting and export default interface highlight #64

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

djwelch
Copy link

@djwelch djwelch commented Jul 16, 2018

Fixes for issues #63 and #60.

Let me know if I have not done this correct.

Thanks for yats.

@HerringtonDarkholme
Copy link
Owner

Thanks! And sorry for the late reply. I'm very busy recently.

Would you like add a vader test? Example is in the test directory.

Feel free if you cannot set up the test environment. I can add it later by myself.

@@ -15,7 +15,7 @@ syntax match typescriptAsyncFunc contained /*/
\ skipwhite skipempty

syntax match typescriptFuncName contained /\K\k*/
\ nextgroup=@typescriptCallSignature
\ nextgroup=@typescriptCallSignature,typescriptTemplate

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think FuncName is the correct choice here. But I need some more time to investigate how syntax highlight is done in your case.

Would you like to revert this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, sorry yes I did add it to the wrong place.
This will not highlight the string when you have an object such as

{
test: T`lkjsdf`,
}

I'll take another look and revert this one.

@@ -56,7 +56,7 @@ syntax keyword typescriptRepeat do while for nextgroup=typescript
syntax keyword typescriptRepeat for nextgroup=typescriptLoopParen,typescriptAsyncFor skipwhite skipempty
syntax keyword typescriptBranch break continue containedin=typescriptBlock
syntax keyword typescriptCase case nextgroup=@typescriptPrimitive skipwhite containedin=typescriptBlock
syntax keyword typescriptDefault default containedin=typescriptBlock nextgroup=@typescriptValue,typescriptClassKeyword skipwhite oneline
syntax keyword typescriptDefault default containedin=typescriptBlock nextgroup=@typescriptValue,typescriptClassKeyword,typescriptInterfaceKeyword skipwhite oneline

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good fix! Thanks!

@@ -23,6 +23,8 @@ syntax region typescriptTemplate
\ nextgroup=@typescriptSymbols
\ skipwhite skipempty

syntax match typescriptTaggedTemplate /\<\K\k*\ze`/ nextgroup=typescriptTemplate

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't do this. It will overlap with typescriptIdentifier and make backtracking more often.

It also doesn't handle case like funcCall()``

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think I'm at the limit of my vim syntax knowledge then so I'm not sure where to put it :-).

So far I'm using it and the funcCall()`` case gets handled tho. Must be handled by the usual typescriptTemplate match.

@tomaskallup
Copy link
Contributor

@HerringtonDarkholme As far as I know, you cherry picker some commits from this, can this be closed or is this PR waiting for something?

@djwelch
Copy link
Author

djwelch commented Sep 24, 2018

Hey, I tried to fix the tagged template highlighting, but my approach would cause more backtracking. To fix I'm not sure how to do it. Feel free to suggest a new approach or some area to look at? Not sure how to avoid backtrack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants