atom / language-todo

TODO highlighting package for Atom
Other
81 stars 66 forks source link

language-todo does not work with tree-sitter #82

Open binaryfunt opened 6 years ago

binaryfunt commented 6 years ago

Prerequisites

Description

Highlighting has stopped working in JavaScript and Python files

Steps to Reproduce

  1. Open a JavaScript/Python file or an unsaved new file and set the language to JavaScript/Python
  2. Type TODO in a comment

Expected behavior: TODO is highlighted, is in its own <span> with class syntax--storage

Actual behavior: TODO is grey/the same colour as the rest of the comment, is in the same <span> as the rest of the comment without class syntax--storage

Versions

Atom: 1.29.0 Electron: 2.0.5 Chrome: 61.0.3163.100 Node: 8.9.3

Additional information

Highlighting still works for C#

50Wliu commented 6 years ago

Are you using the new Tree-Sitter Parsers option?

binaryfunt commented 6 years ago

Ah. Yes, I'm using Tree Sitter Parsers. If I turn it off then highlighting of TODO etc works again. Tree Sitter is still enabled in safe mode, so I didn't pick up on that.

lgeiger commented 5 years ago

Are there plans to support, tree-sitter grammars?

I'd be happy to help with this, since we're trying to achieve the same in the hydrogen package. See https://github.com/atom/atom/issues/18196

macdonaldtomw commented 5 years ago

So, how can we disable tree-sitter until things get sorted out? What version of atom should we be rolling back to?

EDIT: never mind, figured it out (see below)

you need to untick the "Use Tree Sitters Parsers" option in Atom Core Settings:

image

amangeot commented 5 years ago

Thank you so much @macdonaldtomw, the new tree sitter option is really messing with syntax highlighting: TODO, JSDoc, JSX and more.

alanmacleod commented 5 years ago

appreciate you posting a solution @macdonaldtomw was driving me crazy

rpgdev commented 5 years ago

This was driving me insane. Thanks @macdonaldtomw!

KvalheimRacing commented 5 years ago

Thanks, this worked for me aswell!

tehmaspc commented 5 years ago

FYI: Still broken w/ Tree Sitter disabled in Terraform (.tf) files.

agustinhaller commented 5 years ago

Hi, any updates on the issue?

KlfJoat commented 5 years ago

I fully expect to be removed for spam, but this is a valid question that deserves to be here and to be answered...

Since this is an Atom-sponsored package, we expect it to work properly with Core option defaults. This bug has just hit 1 year old. Can we get an update? Any visibility you can give us on the status of remediation?

Is there any workaround besides the one that disables other syntax highlighting to enable this?

onebree commented 4 years ago

EDIT: Looks like what broke TODO highlighting was subtlegradient/language-javascript-jsx, which has been archived on github. I've since switched to language-babel, and TODO highlighting works.


I have tree-sitters disabled but still encountering this problem.

Under these conditions, inline comments (//) don't highlight todo-related keywords. But multi-line comments (/* ... */) do.

image
adamsoutar commented 4 years ago

Is there any news on whether anyone is working on this or if it's even possibe to fix? This highlighting was a great atom feature, and tree-sitter parsers seem to be quite a lot faster, so a pain to loose.

jonboiser commented 4 years ago

I reported this on the language-javascript repo as well, since I think they need to modify that library to fix this for JS files.

Based on these docs, language-javascript will need to add an injection point inside of all comment nodes, and then tell the parser to let the language-todo grammar take over, which would require setting an injectionRegex in this repository.

I'm not sure if this requires having a tree-sitter parser just for TODOs, or if it will still be compatible with the current textgrammar/regex grammar.

gosimitz commented 4 years ago

Any word on an update for this or suggestions for how I can patch it on my machine? language-todo has the potential to be incredibly helpful, but I'd like it to work with Tree Sitter. I'm unfortunately not involved enough to be able to fix it myself.

maximecb commented 3 years ago

Still broken, missing this feature!

jpm92 commented 3 years ago

No news in two years...I guess we can't expect a fix soon, can we?

KlfJoat commented 3 years ago

Probably not. GitHub is too busy purging repositories in response to illegal takedown requests (youtube-dl) to worry about this basic functionality.

inquisitivecrystal commented 3 years ago

I'm taking a look at fixing this. I wouldn't get your hopes up though. I'm a new contributor and I think this might actually be more complicated than it looks.

maximecb commented 3 years ago

Either way, thank you for taking a look at this @bookofportals, your effort is appreciated! :)

johncmerfeld commented 3 years ago

Whoever figures this out will be a real hero! I have to use the tree-sitter parser for TypeScript syntax to work, but it means I lose my TODOs, NOTEs, and FIXMEs.

jhunterkohler commented 3 years ago

I'm not sure how atom highlights works on a deep level, nor tree-sitter parsers, but I am also having this issue. Simply no highlighting.

Entreprenerdz commented 2 years ago

Here's a link to a workaround

language-todo 0.29.4

vonHartz commented 2 years ago

Here's a link to a workaround

language-todo 0.29.4

Thank you for the link.

Interestingly, it works in the .less file itself, but not in python-files for me. Any ideas?

AlexWayfer commented 2 years ago

Interestingly, it works in the .less file itself, but not in python-files for me. Any ideas?

You can press Ctrl-Shift-I to open DevTools, then click arrow-like button at the top left corner, then select a part of code with TODO and see its selector. I guess, it has different classes, for example no syntax--class or syntax--type class. Not sure.

AlexWayfer commented 2 years ago

For me, in Ruby, there is no additional elements inside comments at all:

<span class="syntax--comment">## TODO: Check something</span>

So… probably it's language-specific-plugin issue, probably this work-around not for tree-sitter at all (I doubt).

vonHartz commented 2 years ago

Same in Python.

<span class="syntax--comment syntax--line"># TODO: bla</span>

It only works if I disable tree-sitter.