uctakeoff / vscode-counter

VS Code extension: counts blank lines, comment lines, and physical lines of source code in many programming languages.
MIT License
152 stars 20 forks source link

[VSCodeCounter] There was no target file. #26

Closed javmah closed 2 years ago

javmah commented 4 years ago

My Vscode version is 1.43.2. and Programming language is PHP. When I click to "count line in the Directory " is show me this message "[VSCodeCounter] there was no target file." this is an excellent extension, could you please fix the issue.

im-richard commented 4 years ago

I receive the same issue. Tried a multitude of folders, different languages (lua, php, js) Appears to work fine if you count what is currently open in your Workspace; however, does not work if right-clicking on a folder in Explorer and selecting the Counter menu item.

Also works if you toggle live counting in an open file, would like to use this primarily with php, lua.

Tried after numerous restarts, as well as toggling ignoreUnsupportedFile on and off. Also have linters installed for php, lua, as well as syntax highlighting plugins for both.

Version: 1.44.0 (system setup)
Date: 2020-04-07T23:31:18.860Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.17763
Poooopie commented 4 years ago

I aswell got this issue with version 1.44.0. This extension has been quite useful and it is very unfortunate it stopped working in the latest version of VSCode. Hopefully this could be fixed.

im-richard commented 4 years ago

Just an update. I got it to work finally.

I had to remove my workspace completely, create a brand new one, and re-add the desired folder to that workspace , then it allowed me to get a report.

If I re-open my original saved workspace and try to count that again, the error pops up.

So it appears to only function properly if you make a brand new workspace and add the folders you need to it.

javmah commented 4 years ago

@im-richard, I tried on your way but not working and the programming language is PHP and Ruby. I remove and reinstall the plugin then add a new workspace still Not Working.

im-richard commented 4 years ago

Odd.

Yeah I tried it about 5 different ways, and the only way that seemed to work was to start with a brand new workspace with nothing added.

Then add the project folder you're going to be working with, then I right clicked on the root folder or sub-root (don't remember) and had it calculate the line count and it came right up unexpectedly.

Try setting ignoreUnsupportedFile false, and maybe uninstall / reinstall the PHP syntax highlighter.

I tried a bunch of different ways and that's the only one that worked. If I opened up my old workspace and tried to count again; it fails with that error.

Developer will maybe have to take a look at the code, or possibly has a fix or something we're missing.

Also when you create a new workspace; try restarting vscode before adding the folder / and after adding the folder. I don't remember if I did or not. I tried a "reload" and that didn't seem to have any effect.

I spent over an hour debugging before writing my post here, and then another 30 minutes afterward before I got it to function.

javmah commented 4 years ago

@im-richard, Thank you so much for your reply. It is working now on Vscode version 1.44.0. I update my Vscode from version 1.43.2.

im-richard commented 4 years ago

Nice. Yeah I noticed you were outdated, and figured you may have thought of that if you saw my print of what I was running.

At least we can use it for now. Glad you got it working. 👍

uctakeoff commented 4 years ago

Sorry for the delay in replying. If you haven't solved the problem yet try the following

Check to see if the failed code is not in .gitignore.

Check the languages currently available

Look at the debug log.

gwharton commented 4 years ago

VSCode 1.46.1 Extension 1.3.5 Remote WSL mode.

Check available languages for me gives

jsonc : aliases[], extensions[.code-workspace,language-configuration.json,icon-theme.json,color-theme.json,.code-snippets], filenames:[settings.json,launch.json,tasks.json,keybindings.json,extensions.json,argv.json,profiles.json]
ignore : aliases[], extensions[], filenames:[.vscodeignore]
git-commit : aliases[Git Commit Message,git-commit], extensions[], filenames:[COMMIT_EDITMSG,MERGE_MSG]
git-rebase : aliases[Git Rebase Message,git-rebase], extensions[], filenames:[git-rebase-todo]
diff : aliases[Diff,diff], extensions[.patch,.diff,.rej], filenames:[]
ignore : aliases[Ignore,ignore], extensions[], filenames:[.gitignore_global,.gitignore]
ignore : aliases[], extensions[], filenames:[.npmignore]
properties : aliases[], extensions[], filenames:[.npmrc]
search-result : aliases[Search Result], extensions[.code-search], filenames:[]
ignore : aliases[], extensions[], filenames:[.eslintignore]
jsonc : aliases[], extensions[], filenames:[.eslintrc.json]
xml : aliases[], extensions[.ent,.mod], filenames:[]
es : aliases[ElasticSearch,es,elasticsearch], extensions[es], filenames:[]
VS Code Counter : available all 13 languages.

in the report I get 0 lines of code and it tells me that all my xml, php, json, css, less and js files are unsupported. e.g

"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/Block/Adminhtml/System/Config/Form/Field/StatusColor.php", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/Helper/ConfigHelper.php", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/Model/Adminhtml/System/Config/StatusColor.php", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/Ui/Component/Listing/Columns/StatusCode.php", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/composer.json", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/etc/adminhtml/system.xml", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/etc/config.xml", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/etc/module.xml", "(Unsupported)", , 0, 0, -1
"/home/ubuntu/dev/app/code/Gw/AdminHighlighter/registration.php", "(Unsupported)", , 0, 0, -1

OK, theres my clue. Check your extensions in the section "Feature Contributions". You need to have an extension that provides the relevant Languages section and it needs installing on the remote end of you are using remote mode. e.g to support xml counting I needed the following installed to WSL.

image

Can't find any extensions that provides PHP or less though.

uctakeoff commented 4 years ago

I recently noticed that the VSCodeCounter doesn't work properly with "VScode Remote Development".

We are currently working through a trial and error process to find a solution. Please wait for a while.

gwharton commented 4 years ago

Yeah. It seems the list of languages when in remote mode is small by default. Installing some extensions into the remote helps but no where near the 50ish languages in the screenshot in the help for the extension.

uctakeoff commented 4 years ago

Ver. 2.0.0 released.

I modified VSCode Counter's ability to collecting VSCode language extensions so that it can be called as an independent function. The idea is to collect the information once in the local environment and store it so that it can be used remotely.

Please try the following;

gwharton commented 4 years ago

:) Working perfectly for me now in remote mode. 53 languages detected instead of 13. :)

grayguest commented 9 months ago

Thanks for your effort