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

(JavaScript) unicode highlighting missing with many nested functions #1130

Closed
pdknsk opened this issue Sep 1, 2017 · 8 comments
Closed

(JavaScript) unicode highlighting missing with many nested functions #1130

pdknsk opened this issue Sep 1, 2017 · 8 comments

Comments

@pdknsk
Copy link

pdknsk commented Sep 1, 2017

x.y(function() {
x.y(function() {
x.y(function() {
x.y(function() {
x.y(function() {
x.y(function() {
var z = '\u1000';
});
});
});
});
});  
});

1

One less and it works.

2

@pdknsk pdknsk changed the title (JavaScript) unicode highlighting missing with many nested callback functions (JavaScript) unicode highlighting missing with many nested functions Sep 1, 2017
@pdknsk
Copy link
Author

pdknsk commented Sep 1, 2017

Alternatively, each callback function can be replaced with not less than 3 regular functions, in any order.

x.y(function() {
x.y(function() {
x.y(function() {
x.y(function() {
x.y(function() {
function() {
function() {
function() {
var z = '\u1000';
};
};
};
});
});
});
});
});

1

@keith-hall
Copy link
Collaborator

Which ST build are you seeing this on? It seems fine for me in 3142 with the default JavaScript syntax.

@pdknsk
Copy link
Author

pdknsk commented Sep 1, 2017

Your comment made me try Monokai – works. Only occurs with Blackboard, and perhaps others.

@keith-hall
Copy link
Collaborator

I enabled legacy color schemes and tried, but it still looks okay to me:
image

It seems to me like a similar issue to #403, but that was solved in build 3115. Can you confirm what ST build you are using please?

@pdknsk
Copy link
Author

pdknsk commented Sep 1, 2017

I'm on 3126 and tried both the default and the most-recent from-here package.

@pdknsk
Copy link
Author

pdknsk commented Sep 1, 2017

I only noticed after commenting that your image exhibits the bug!

@keith-hall
Copy link
Collaborator

Oh I see it now too :) sorry, not used to that color scheme so wasn't sure what to look for.

It looks like the scoring given for the scope selector string and the scope selector constant used in Blackboard.tmTheme are the same:

>>> sublime.score_selector('source.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.block.js meta.block.js meta.block.js string.quoted.single.js constant.character.escape.js', 'constant')
1152921504606846976
>>> sublime.score_selector('source.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.function-call.method.js meta.group.js meta.block.js meta.block.js meta.block.js meta.block.js string.quoted.single.js constant.character.escape.js', 'string')
1152921504606846976

Normally constant would indeed have a higher match score, but I guess that is the largest scope stack / match score that ST can deal with:

>>> sublime.score_selector('source.js string.quoted.single.js constant.character.escape.js', 'string')
64
>>> sublime.score_selector('source.js string.quoted.single.js constant.character.escape.js', 'constant')
512

As string is defined on line 93, and constant on line 41, string takes precedence when the scores are equal - you can "fix" this by moving the constant rules lower down in the tmTheme file so they will take precedence over string.

As this is a legacy color scheme, I'm not sure if such a change will be made to the version that comes with ST.

@pdknsk
Copy link
Author

pdknsk commented Sep 1, 2017

Thanks! Works for me. It seems inevitable to eventually move off of Blackboard. I noticed some nice features in Monokai missing in Blackboard, like cursive formatting.

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

No branches or pull requests

2 participants