-
Notifications
You must be signed in to change notification settings - Fork 263
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
Refactoring needed #12
Comments
Totally agree with that, this project is awesome. |
Hi @cyanzhong thanks for the support, I am not sure when I will able to work on this, but it's certainly needed. |
I'm working on some improvements to this code, you can check my fork repo. Are you welcome to breaking changes? I have replaced a nullable property for an enum in |
Hi @brunophilipe! That's awesome, thank you! About the language detection for the CodeAttributedString, I wasn't able to do this before because the way the library works (and is the same concern I have with #17), it will highlight only the line that the user is currently editing, and the detection system sometimes is not able to detect the language with just one line of code. Maybe to make it more reliable we could use the previously detected language or give the highlighter more context (when available) to avoid issues like this (even if this will impact performance). And about the refactoring, I had in mind a more complex restructuring of the library, I would like to separate the highlighting in phases, in order to allow the creation plugins for things like indentation and attributes customization, also I would like to move all the regex that makes the code so difficult to follow. So, even if you send me a PR I will keep this issue open. |
@raspu I believe I have figured out a neat way to fix the highlight during editing. Unfortunately I don't believe it is possible to avoid re-highlighting the entire string sometimes, as if, for example, you add a However, in my own testing, this seems to work well enough. I'll push my changes after I've done some tests. Basically it logs the language Edit: Also, in my testing, rewriting |
@brunophilipe that sounds awesome, I am looking forward to your PR. I thought about doing something like that before, but I never had the time to test it :). Is really so much faster to use Objc? If that's so I can easily port the library to Objc... |
I've tried some code refactoring with some improvements in #69. Let me know what you think. |
The code right now is a little messy and could use a big refactoring to make it easier to follow and more scalable.
The text was updated successfully, but these errors were encountered: