-
Notifications
You must be signed in to change notification settings - Fork 8
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
Syntax highlighting breaks after save #37
Comments
Ugh, that looks terrible. I’ll take a look at this as soon as I have time and am able, but I’m not sure if that will be any sooner than later this week. It’s a good bet that this is due to updates to the document just prior to saving (https://github.com/Mr0grog/editorconfig-textmate/blob/master/source/additions/NSView%2BEditorConfig.m#L145-L147). That’s caused by the |
Need to see if I can create my own |
Oh, actually, I might be able to just leverage See how TM does this internally: https://github.com/textmate/textmate/blob/52fda481dc9ee52fcf71a1134b900b61bc8f839d/Frameworks/Find/src/Find.mm#L242-L277 |
Existing code that needs to utilize the above stuff is at editorconfig-textmate/source/additions/NSView+EditorConfig.m Lines 76 to 143 in b305927
|
@Mr0grog did you manage to progress on this? Anything I can do to help? |
Hey @KevinSjoberg, I’ve been super busy lately and have not had time to get to it :( If you are interested in trying out the approach outlined in the comments above, that would be wonderful! I’d certainly be happy to take a PR. |
From an old e-mail list exchange with Alan Odgaard:
So possibly the ideal approach is to see if there's a way to register and trigger a macro from ObjC code. |
Tripped over this issue again today after a long while. I still need to get around to #45 first, and I don’t think I’ll be able to address this in the next couple weeks, but I did go down a small rabbit-hole looking into possible fixes here. I think there are 4 main options:
I think (1) is the most straightforward if it works, otherwise (3) is probably the next best. ((2) is pretty slick and feels better, perf-wise, than running all the macro machinery, but relies on more complicated internal enums that are probably also more prone to change, and therefore hard make compatible across TM versions.) As far as the various macro solutions go, here are the two macros we’d want in text plist format (macros — at this level — are just plists in NSArray/NSDictionary form): Insert final newline: {
commands = (
{
argument = {
action = replaceAll;
findString = "([^\\r\\n\\s])\\z";
regularExpression = YES;
replaceString = "$1\\n";
};
command = "findWithOptions:";
},
);
name = "Insert Final Newline";
uuid = "<UUID GOES HERE>";
} Trim trailing spaces: {
commands = (
{
argument = {
action = replaceAll;
findString = "[\\t ]+$";
regularExpression = YES;
replaceString = "";
wrapAround = YES;
};
command = "findWithOptions:";
},
);
name = "Trim Trailing Spaces";
uuid = "<UUID GOES HERE>";
} |
Since using this plugin with TextMate version 2.0-rc.4 the syntax highlighting frequently breaks after saving a file. By breaking I mean the whole file or a part of the file is only displayed in black/white text. An example is the screenshot of a ruby file below after pressing CMD+S. Syntax highlighting is missing in lines 31-49. Before saving it (and therefore before applying the editorconfig rules), the syntax highlighting was just fine. When I insert some key and save again, it is displayed correctly again.
This is my
.editorconfig
file:Is there any information I could provide to help finding the cause of this?
The text was updated successfully, but these errors were encountered: