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

Whitespace at beginning of line throws of syntax highlighting #11

Closed
mhkeller opened this issue Jan 8, 2020 · 6 comments
Closed

Whitespace at beginning of line throws of syntax highlighting #11

mhkeller opened this issue Jan 8, 2020 · 6 comments

Comments

@mhkeller
Copy link

mhkeller commented Jan 8, 2020

If I'm using this in a markdown file, I might have this in an indented list where the line begins with whitespace. Some things get highlighted but there's an offset. See the comparison between lines 2 and 3 below:

Screen Shot 2020-01-08 at 5 34 02 PM

@davraamides
Copy link
Owner

I’m not sure if leading white space is valid in the todotxt format. But let me look at how difficult this would be to support. If it’s a simple fix and doesn’t break anything, I will make the change.

@mhkeller
Copy link
Author

mhkeller commented Jan 13, 2020

I did some preliminary looking into this and it seems that removing line.firstNonWhitespaceCharacterIndex from here improves some of it.

With those lines changed to the below, the priority label is still not working but the other highlights are now at the correct index. Looking at the code, the priority logic is a little more complicated. This change doesn't seem to break other styling but I haven't tried the more advanced task features.

let begPos = new vscode.Position(line.range.start.line, result.index);
let endPos = new vscode.Position(line.range.start.line, result.index + result[0].length);

Screen Shot 2020-01-13 at 1 19 15 PM

@davraamides
Copy link
Owner

davraamides commented Jan 13, 2020 via email

@mhkeller
Copy link
Author

Sounds good! Thanks for looking into it. Whatever you think minimizes any negative side effects.

@davraamides
Copy link
Owner

Fixed with 1.4.12 release.

@mhkeller
Copy link
Author

Thanks for your time and work on this! It's much appreciated!

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