Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

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

Open
1 task done
binaryfunt opened this issue Aug 3, 2018 · 27 comments
Open
1 task done

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

binaryfunt opened this issue Aug 3, 2018 · 27 comments

Comments

@binaryfunt
Copy link

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#

@winstliu
Copy link
Contributor

winstliu commented Aug 4, 2018

Are you using the new Tree-Sitter Parsers option?

@binaryfunt
Copy link
Author

binaryfunt commented Aug 5, 2018

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
Copy link

lgeiger commented Oct 5, 2018

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 atom/atom#18196

@macdonaldtomw
Copy link

macdonaldtomw commented Oct 30, 2018

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

This comment has been minimized.

@alanmacleod

This comment has been minimized.

@rpgdev

This comment has been minimized.

@KvalheimRacing

This comment has been minimized.

@tehmaspc
Copy link

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

@agustinhaller

This comment has been minimized.

@KlfJoat
Copy link

KlfJoat commented Aug 5, 2019

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
Copy link

onebree commented Dec 4, 2019

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.

  • Atom 1.41.0, macOS
  • UI theme: One Dark
  • Syntax theme: Base16 Tomorrow Dark
  • Enabled / related packages:
    • atom/language-todo
    • atom/language-js
    • subtlegradient/language-javascript-jsx
  • Affected grammer: JavaScript with JSX (source.js.jsx)

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

image

@adamsoutar
Copy link

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
Copy link

jonboiser commented Dec 19, 2019

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
Copy link

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
Copy link

maximecb commented Sep 4, 2020

Still broken, missing this feature!

@jpm92
Copy link

jpm92 commented Oct 24, 2020

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

@KlfJoat
Copy link

KlfJoat commented Oct 24, 2020

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

@inquisitivecrystal
Copy link

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
Copy link

maximecb commented Nov 9, 2020

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

@johncmerfeld
Copy link

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
Copy link

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
Copy link

Here's a link to a workaround

language-todo 0.29.4

@vonHartz
Copy link

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
Copy link

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
Copy link

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
Copy link

Same in Python.

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

It only works if I disable tree-sitter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests