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

Scopes tokenizer: new implementation #5628

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mkslanc
Copy link
Contributor

@mkslanc mkslanc commented Aug 20, 2024

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Pull Request Checklist:

@@ -2,5 +2,5 @@
const textTokens = new Set(["text", "rparen", "lparen"]);

exports.isTextToken = function(tokenType) {
return textTokens.has(tokenType);
return textTokens.has(tokenType.toString());
Copy link
Member

Choose a reason for hiding this comment

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

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without it simple_tokenizer is not working as expected

@@ -13,7 +13,7 @@ oop.inherits(FoldMode, BaseFoldMode);


this.$getMode = function(state) {
if (typeof state != "string")
if (Array.isArray(state))
state = state[0];
for (var key in this.subModes) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we add .syntax property to Scope to make this simpler?

onMatch2 : function(value, scope){
var parent = scope.get("bracketedComment" + (value.length - 2))
parent.meta = (value.length - 2);
return parent.get(this.next).get("comment");
Copy link
Member

Choose a reason for hiding this comment

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

Should use scope.get(this.next, value.length - 2).get("comment");

src/mode/lua_highlight_rules.js Show resolved Hide resolved
src/mode/text.js Outdated Show resolved Hide resolved
@@ -99,12 +99,16 @@ TextHighlightRules = function() {
};

var pushState = function(currentState, stack) {
if (currentState != "start" || stack.length)
stack.unshift(this.nextState, currentState);
if (typeof currentState.get == "function") {
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep only the scope variant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We would need to make significant changes in normalizeRules logic in that case

src/tooltip.js Outdated Show resolved Hide resolved
src/tokenizer.js Outdated Show resolved Hide resolved
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.

2 participants