Gruntfuggly / todo-tree

Use ripgrep to find TODO tags and display the results in a tree view
Other
1.44k stars 140 forks source link

Only show TODOs in currently open files #397

Closed themaxw closed 3 years ago

themaxw commented 3 years ago

I'm using Code - OSS version 1.51.1 on Manjaro Linux 5.9.8-2

Todo-tree only scans/shows currently open files, so in order to get all the TODOs in my workspace, I have to open every file once. It used to work properly (TM)

Does anyone else have this problem, and how do i go about finding a solution?

thanks in advance

Gruntfuggly commented 3 years ago

If you enable the debug channel (set todo-tree.general.debug to true, then View->Output, then select "Todo Tree" from the dropdown), what does it show?

themaxw commented 3 years ago
Searching /home/shai/Data/code/uni/windows3.0/ha1...
Command: /usr/lib/code/node_modules.asar.unpacked/vscode-ripgrep/bin/rg --no-messages --vimgrep -H --column --line-number --color never --max-columns=1000 --no-config  -e "((//|#|<!--|;|/\*|^)\s*(XXX|TODO|HACK|FIXME|BUG)|^\s*- \[ \])" -g "!**/vendor/**" -g "!**/node_modules/**" -g "!**/dist/**" -g "!**/bower_components/**" -g "!**/build/**" -g "!**/.vscode/**" -g "!**/.github/**" -g "!**/_output/**" -g "!**/*.min.*" -g "!**/*.map" "/home/shai/Data/code/uni/windows3.0/ha1"
 Match (Editor):{"file":"/home/shai/Data/code/uni/windows3.0/ha1/system/start.c","line":51,"column":5,"match":"    // TODO das an ne schönere Stelle"}
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en-GB)

Found 1 items
Applying globs to 1 items...
Remaining items: 1
/home/shai/Data/code/uni/windows3.0/ha1/system/start.c:51:5:    // TODO das an ne schönere Stelle

after that it lists a lot more TODO's in the current workspace, it just doesn't show them in the sidebar I sadly couldn't format the stuff above as code, so it's kind of a mess, the bold stuff is encased by **

Gruntfuggly commented 3 years ago

Can you try copying the command and running it manually from a terminal?

themaxw commented 3 years ago

i will do that later, thanks for the quick answer :)

Dec 2, 2020 18:25:50 Nigel Scott notifications@github.com:

Can you try copying the command and running it manually from a terminal?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub[https://github.com/Gruntfuggly/todo-tree/issues/397#issuecomment-737377671], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AG35NC4E5NKJMHHQCPF45SDSSZ2B3ANCNFSM4UKZAILQ]. [https://github.com/notifications/beacon/AG35NC77IQYPU5SJARZTDF3SSZ2B3A5CNFSM4UKZAIL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFPZX3BY.gif]

Gruntfuggly commented 3 years ago

OK, no problem. I would try temporarily disabling the excludes, just to make sure it's not that.

themaxw commented 3 years ago

after running the command once i get this output: zsh: event not found: - when running it again it produces the correct output this is reproducible with every new terminal i open EDIT: correction, it only doesn't work when copying it from vscode, when pressing up to access the history of zsh and running it from there it works... EDIT EDIT: i run this command: /usr/lib/code/node_modules.asar.unpacked/vscode-ripgrep/bin/rg --no-messages --vimgrep -H --column --line-number --color never --max-columns=1000 --no-config -e "((//|#|<!--|;|/\*|^)\s*(XXX|TODO|HACK|FIXME|BUG)|^\s*- \[ \])" "/home/shai/Data/code/uni/windows3.0/ha1" and the problem seems to be with the !-- in the regex. When accessing it from the zsh history it just removes the !-- and then it works.

Gruntfuggly commented 3 years ago

What version of the extension are you using? Since 0.0.183, it should use a different method to pass the regex to ripgrep, which I think will avoid the problems you're seeing.

themaxw commented 3 years ago

I'm on version 0.0.177.

Gruntfuggly commented 3 years ago

OK - can you try updating to 0.0.183 (or the latest) and see if you still see the problem?

Gruntfuggly commented 3 years ago

It now uses a pattern file to pass the regex, which removes the need to do a load escaping, and should avoid other errors with the command line.

themaxw commented 3 years ago

How do i update? according to my vscode 0.177 is the current version.

can i manually install the update without using the extension store?

Gruntfuggly commented 3 years ago

Ah OK - I guess you've installed from Open VSX. I need to update the version that is published on there.

You could try installing from this:

todo-tree-0.0.189.vsix.zip

themaxw commented 3 years ago

the upgrade was successful, but sadly it still doesn't work. logs:

22:48:33.280 Searching /dir/to/project...
22:48:33.281 Writing pattern file:/home/shai/.config/Code - OSS/User/workspaceStorage/093c3dcdc56c5613a7f32ea6e3c01344/Gruntfuggly.todo-tree/pattern.txt
22:48:33.283 Pattern:((//|#|<!--|;|/\*|^)\s*(XXX|TODO|HACK|FIXME|BUG)|^\s*- \[ \])
22:48:33.284 Command: /usr/lib/code/node_modules.asar.unpacked/vscode-ripgrep/bin/rg --no-messages --vimgrep -H --column --line-number --color never --max-columns=1000 --no-config  -f "/home/shai/.config/Code - OSS/User/workspaceStorage/093c3dcdc56c5613a7f32ea6e3c01344/Gruntfuggly.todo-tree/pattern.txt" "/dir/to/project"
22:48:33.319  Match (Editor):{"file":"/dir/to/project/ha1/driver/uart.c","line":38,"column":1,"match":"// XXX allocate memory for the buffer handle, is there a more elegant way?"}
22:48:33.320  Match (Editor):{"file":"/dir/to/project/ha1/driver/uart.c","line":103,"column":5,"match":"    // TODO assert that there actually is something in here"}
22:48:33.336 Search failed:
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en-GB)

22:48:33.338 Found 2 items
22:48:33.341 Search results:
/dir/to/project/ha1/lib/kprint.c:138:5:    // TODO add format specifier for binary representation, %b
/dir/to/project/ha1/lib/conversions.c:5:1:// TODO implement those 3 with an assert function
/dir/to/project/ha1/lib/circularBuffer.c:18:1:// XXX not threadsafe yet
/dir/to/project/ha1/lib/circularBuffer.c:20:5:    // TODO assert
/dir/to/project/ha1/system/ivt.S:36:5:    //TODO reset SPSR
/dir/to/project/ha1/system/ivt.S:132:5:    //TODO ist das richtig bei einem full descending stack? sollte das db und ia sein?
/dir/to/project/ha1/system/interruptHandlers.c:15:1:// TODO unterschiedliche register für unterschiedliche kerne und fiq und
/dir/to/project/ha1/system/interruptHandlers.c:78:9:        // TODO more interrupt sources
/dir/to/project/ha1/driver/uart.c:38:1:// XXX allocate memory for the buffer handle, is there a more elegant way?
/dir/to/project/ha1/driver/uart.c:103:5:    // TODO assert that there actually is something in here

only the matches in the opened file (uart.c) are shown in the sidebar

themaxw commented 3 years ago

there appears to be nothing in the .config/Code - OSS/User/workspaceStorage/093c3dcdc56c5613a7f32ea6e3c01344/Gruntfuggly.todo-tree folder, maybe the spaces are a problem?

Gruntfuggly commented 3 years ago

It deletes the file after it's run the search.

It looks like the error is something to do with the setlocale message.

What shell are you using?

themaxw commented 3 years ago

I'm using zsh 5.8

Gruntfuggly commented 3 years ago

It looks like it's trying to use /bin/sh, but that's in node itself.

Can you try localectl list-locales and see if en-GB is present?

Gruntfuggly commented 3 years ago

To be honest, I don't know where that is coming from. The extension doesn't do anything itself with the locale, so I'm guessing it's something to do with node running the child process.

themaxw commented 3 years ago

the locale en_GB.UTF-8 is present. There was another issue that suggested that might be a problem with electron

Gruntfuggly commented 3 years ago

Have you tried removing <!-- from the regex? I.e. set it to ((//|#|;|/\*|^)\s*(XXX|TODO|HACK|FIXME|BUG)|^\s*- \[ \]) It won't find TODOs in HTML, but it might get you a bit further.

Another option is that I could add an option to specify the shell that is used when running the search command. You could then specify zsh instead which might work, but I'm not sure.

Gruntfuggly commented 3 years ago

I also found this https://askubuntu.com/questions/114759/warning-setlocale-lc-all-cannot-change-locale which might be something you could try?

themaxw commented 3 years ago

I tried using the extension in code - insiders, where everything worked as expected. In my normal code install i managed to somehow add a -g "/path/to/project/*" to the command (by rightclicking on a folder and selecting only show this folder) without it being in the settings, so I can't really do anything in there anymore 😅

themaxw commented 3 years ago

I downgraded electron like suggested in the other issue, and now it works, I just broke my main workspace, where the command is now /usr/lib/code/node_modules.asar.unpacked/vscode-ripgrep/bin/rg --no-messages --vimgrep -H --column --line-number --color never --max-columns=1000 --no-config -f "/home/shai/.config/Code - OSS/User/workspaceStorage/093c3dcdc56c5613a7f32ea6e3c01344/Gruntfuggly.todo-tree/pattern.txt" -g "/path/to/project/*" "/path/to/project"

themaxw commented 3 years ago

but yeah it seems to be an electron issue introduced by electron 9.3.4

themaxw commented 3 years ago

I managed to fix the issue above on my own by clearing the todo-tree cache. Thanks for your help and this great extension :)

Gruntfuggly commented 3 years ago

Glad you got it sorted!