Code Monkey home page Code Monkey logo

format-files's People

Contributors

hplightcorner avatar jbockle avatar julian-poidevin avatar mrrefactoring avatar ptanmay143 avatar thesilican avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

format-files's Issues

why is the "Exclude Pattern" not working?

I wasted much time on

[12:18:02 error] (try-open-document) 	Unable to open file utils.cpython-36.opt-1.pyc: cannot open file:///utils.cpython-36.opt-1.pyc. Detail: File seems to be binary and cannot be opened as text

although I set "pyc,yaml,sh,png" in the Exclude Pattern. (tried with/without the quotes)

Extension doesn't work anymore

When I try to format a folder or a workspace, I instantly get this message.

image

Version: 1.56.0-insider
Commit: 25785b97e533b15ae3b12e48aaf4187416437e62
Date: 2021-04-15T05:14:21.699Z
Electron: 11.4.2
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19042

How to ignore a folder name on any folder level?

With python I have a __pycache__ folder on most folder levels and I would like to ignore all of them.

I tried:

"formatFiles.excludedFolders": [
        ".vscode",
        ".git",
        ".mypy_cache",
        "__pycache__"
    ],

but this does not work.
I tried adding wildcards, but no luck either.
Also tried the same with the excludePattern option.

Support for format of git checkout files

Hi
Your extenstion is super cool, I needed support to format only git checked out files in my workspace so I added that support to your extenstion.
Let me know if this interests you and how I can open a pull request for it ?
Thanks!

extensionsToInclude setting glob pattern generation seems to fail.

Using the following settings :

"formatFiles.extensionsToInclude": "c,h",
"formatFiles.excludePattern": "**/.vscode,**/Middlewares/Third_Party/**,**/Unit_testing/Unity/**,**/Drivers/**,**/*stm32f4xx*.*,**/*freertos*.*,**/FreeRTOSConfig.h",

And launching the formatFiles.start.workspace command, the extnesion does not find any files to format :

[14:52:51 info.] (ext) Starting Format Files - Workspace
[14:52:51 info.] (validate-in-workspace) found workspace folders: Gpu
[14:52:51 info.] (validate-in-workspace) workspace is valid!
[14:52:51 info.] (select-workspace-folder) a single workspace folder was found, selecting Gpu
[14:52:51 info.] (get-files) creating include glob
[14:52:51 info.] (get-files) 	**/*.c,h
[14:52:51 info.] (get-files) creating exclude glob
[14:52:51 info.] (get-files) 		including files.exclude globs
[14:52:51 info.] (get-files) 			{**/.vscode,**/Middlewares/Third_Party/**,**/Unit_testing/Unity/**,**/Drivers/**,**/*stm32f4xx*.*,**/*freertos*.*,**/FreeRTOSConfig.h,**/.git,**/.svn,**/.hg,**/CVS,**/.DS_Store}
[14:52:51 info.] (get-files) searching for files in workspace folder 'Gpu' include:**/*.c,h exclude:{**/.vscode,**/Middlewares/Third_Party/**,**/Unit_testing/Unity/**,**/Drivers/**,**/*stm32f4xx*.*,**/*freertos*.*,**/FreeRTOSConfig.h,**/.git,**/.svn,**/.hg,**/CVS,**/.DS_Store}
[14:52:51 info.] (get-files) Discovered 0 files to format
[14:52:54 info.] (confirm-start) result: undefined
[14:52:54 error] (ext) OperationAborted::

Whereas launching from formatFiles.start.fromGlob command, using respevely **/*.c and **/*.h pattern, the extension finds the files :

[14:57:23 info.] (ext) Starting Format Files - By Glob Pattern
[14:57:23 info.] (validate-in-workspace) found workspace folders: Gpu
[14:57:23 info.] (validate-in-workspace) workspace is valid!
[14:57:23 info.] (select-workspace-folder) a single workspace folder was found, selecting Gpu
[14:57:26 info.] (request-glob) glob entered: **/*.c
[14:57:27 info.] (workspace-validator) Use default excludes?: Yes - Use 'formatFiles' settings in vscode
[14:57:27 info.] (get-files) creating exclude glob
[14:57:27 info.] (get-files) 		including files.exclude globs
[14:57:27 info.] (get-files) 			{**/.vscode,**/Middlewares/Third_Party/**,**/Unit_testing/Unity/**,**/Drivers/**,**/*stm32f4xx*.*,**/*freertos*.*,**/FreeRTOSConfig.h,**/.git,**/.svn,**/.hg,**/CVS,**/.DS_Store}
[14:57:27 info.] (get-files) searching for files in workspace folder 'Gpu' include:**/*.c exclude:{**/.vscode,**/Middlewares/Third_Party/**,**/Unit_testing/Unity/**,**/Drivers/**,**/*stm32f4xx*.*,**/*freertos*.*,**/FreeRTOSConfig.h,**/.git,**/.svn,**/.hg,**/CVS,**/.DS_Store}
[14:57:27 info.] (get-files) Discovered 29 files to format
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Unit_testing\Test_suites\TS_helloworld\src\TS_HW.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Unit_testing\Test_suites\TS_GLOBAL\src\UTmain.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Middlewares\User\Src\array_converter.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Middlewares\User\Src\utils.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Middlewares\User\Src\moteur_graphe.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Middlewares\User\Src\moteur_can.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Middlewares\User\Src\crc8.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Middlewares\User\Src\crc32.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Middlewares\User\Src\crc16.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\API_Drivers\Src\api_driver_timer_synchrone.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\API_Drivers\Src\api_driver_i2c_generique.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\API_Drivers\Src\api_driver_gpio.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\API_Drivers\Src\api_driver_can.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Graphe\Src\g_init.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Graphe\Src\g_gestion_dc.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Graphe\Src\g_etat.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Graphe\Src\g_can.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Data\Src\def_etat.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Data\Src\def_data.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\factory.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\api_led.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\api_graphe.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\api_gpio.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\api_gestion_puissance.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\api_gestion_mesure.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\api_defaut.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\App\Src\api_can.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Configuration\Src\main.c
[14:57:27 info.] (get-files) 	c:\repo\EmbeddedC\Gpu\Application\Configuration\Src\configurateur.c
[14:57:37 info.] (confirm-start) result: Nevermind
[14:57:37 error] (ext) OperationAborted::Nevermind

"Format files from workspace" doesn't work when workspace has more than 1 root folder.

Steps to reproduce:

  • using Remote SSH extension
  • add one folder to workspace and then a second one
  • right click on the directory inside the second folder that contains X files you want to format.
  • Start format files from workspace

Expected results:
Dialog should show "Start formatting X workspace files?" and then proceeds to formatting the files.

Actual results:
Dialog shows "Start formatting 0 workspace files?" and then nothing happens.

OBS: works fine if I choose the 1st folder.

Suggestion: Make "Cancel formatting" more accessible

When format-files is running the status bar offers a button "Cancel formatting". The full output looks something like this:

[Spinner icon] formatting documents: Formatting [path name] [Workspace] Cancel formatting

However, it is really hard to actually click on "Cancel formatting" because its position constantly changes based on how long [path name] is.

Suggestion: Move the button to the left of [path name], so that its position is fixed.

Extension no longer works

I can't get it to find any files, either using Start Format Files: From Glob or Start Format Files: From Workspace. The log always says

Discovered 0 files to format

Not working anymore in version 1.54.1 (user setup)

I get an outcome of:
::::::::::::::::::::::::::::::::::::::::::::::::::
[09:01:54 info.] (ext) Starting Format Files - Workspace
[09:01:54 info.] (validate-in-workspace) found workspace folders: crawler
[09:01:54 info.] (validate-in-workspace) workspace is valid!
[09:01:54 info.] (select-workspace-folder) a single workspace folder was found, selecting crawler
[09:01:54 info.] (get-files) creating include glob
[09:01:54 info.] (get-files) folder specified: /c:/Or/Web/crawler/crawler
[09:01:54 info.] (get-files) creating exclude glob
[09:01:54 info.] (get-files) including files.exclude globs
[09:01:54 info.] (get-files) {/node_modules,/.vscode,/dist/,/.chrome,/misc,/sources,/.git,/.svn,/.hg,/CVS,/.DS_Store}
[09:01:54 info.] (get-files) searching for files in workspace folder 'crawler' include:/c:/crawler//. exclude:{/node_modules,/.vscode,/dist/,/.chrome,/misc,/sources,/.git,/.svn,/.hg,/CVS,**/.DS_Store}
[09:01:54 info.] (get-files) Discovered 0 files to format
[09:01:55 info.] (confirm-start) result: Do it!
[09:01:57 info.] (ext) Format Files completed

It's disabled because of dependancies

It says it's disabled because of dependencies.
The dependency is "git" extension.

Can you make it an "optional" dependency, because I don't want this extension doing anything git related.
I have disabled Git extension in vs-code because I don't want all the git vscode commands clogging up the commands list.

I understand I wont be able to use the "ignore git ignore" feature, and that is fair enough, I had no intention of using that anyway.

Memory Leak in combination with MS C++ Plugin

Hey there,
first i would like to say thank you for the awesome extension. Its a pitty that an extension is required for such a standard feature but you really nailed it.

Sadly i discovered a problem what i think is a memory leak. It happens when i try to format my entire solution which have a lot of files (thousands). But the problem appears also a lot faster (hundred of files).

Observing the memory consumption you can see how it goes up and never comes down again, so you have to restart VSCode and format files folder by folder which i bet is not the intention.

Do you have any idea what could cause the issue?

Im working with the latest official VSCode and the latest MS C++ plugin on a CentOs 7.

Best Regards
Nick

How to Format only modified (as listed in the source control window) files

Some of the files in my project are auto generated by an external tool. They are not formatted according to the project formatting rules. I would like to:

  1. Generate the files
  2. In the source control window, right click on the modified files to choose the format operation

If it is helpful, the code generator can also generate a list (full path) of the generated files

Can't ignore folders as gitignore do

For example:

# .gitignore
node_modules

After enable formatFiles.useGitIgnore:

/myrepo/node_modules/blabla: ignored as expected.

/myrepo/packages/module-a/node_modules/blabla: BOOM!!!

Are there any solution for this?

Does not run Organize Imports

I noticed that after having run "FormatFiles" my TypeScript imports would be rearranged when saving the file.

I have this option enabled:

  "editor.codeActionsOnSave": {
    "source.organizeImports": true
  }

Example:

Result after "FormatFiles"

import {
  Directive,
  HostListener,
  Input,
  Output,
  EventEmitter
} from "@angular/core";

Result after manually saving the file

import {
  Directive,
  EventEmitter,
  HostListener,
  Input,
  Output
} from "@angular/core";

More info in Output window

I was wondering if more info can be displayed in the Output.
I'm looking for a "base path" so we have an idea where the glob starts from. And "glob used" so we can tell if something funky is going on.

Currently the output looks like this for "Start Format Files: Workspace"

[_info:16:08:32] Starting Format Files - Workspace
[_info:16:08:32] Validating workspace
[_info:16:08:32] Workspace is valid!
[_info:16:08:32] creating include glob
[_info:16:08:32] 		folder specified: /C:/Users/my-user/Source/test-format-files/bar
[_info:16:08:32] creating exclude glob
[_info:16:08:32] 			{**/node_modules,**/.vscode,**/dist/**,**/.chrome}
[_info:16:08:32] Found 0

Adding glob pattern to that

[_info:16:08:32] Starting Format Files - Workspace
[_info:16:08:32] Validating workspace
[_info:16:08:32] Workspace is valid!
[_info:16:08:32] creating include glob
[_info:16:08:32] 		folder specified: /C:/Users/my-user/Source/test-format-files/bar
[_info:16:08:32] 		glob pattern: *              <------------
[_info:16:08:32] creating exclude glob
[_info:16:08:32] 			{**/node_modules,**/.vscode,**/dist/**,**/.chrome}
[_info:16:08:32] Found 0

Currently output for "Start Format Files: From Glob"

[_info:16:16:56] Starting Format Files - By Glob Pattern
[_info:16:16:56] Validating workspace
[_info:16:16:56] Workspace is valid!
[_info:16:17:02] Found 2
[_info:16:17:02] 	/c:/Users/my-user/Source/test-format-files/foo/f1.html
[_info:16:17:02] 	/c:/Users/my-user/Source/test-format-files/bar/b1.html

Adding base path and glob pattern to that

[_info:16:16:56] Starting Format Files - By Glob Pattern
[_info:16:16:56] Validating workspace
[_info:16:16:56] Workspace is valid!
[_info:16:16:56] creating include glob
[_info:16:16:56] 		folder specified: /C:/Users/my-user/Source/test-format-files        <------------
[_info:16:16:56] 		glob pattern: *.html                                                <------------
[_info:16:17:02] Found 2
[_info:16:17:02] 	/c:/Users/my-user/Source/test-format-files/foo/f1.html
[_info:16:17:02] 	/c:/Users/my-user/Source/test-format-files/bar/b1.html

Should make it a bit easier to work out what's going on when stuff isn't behaving as you expect :)

Start Format Files: This Folder disabled in VSCode 1.87

After updating my VSCode to version 1.87, the option to start formatting from within the work tree is greyed out and cannot be clicked. "By Glob" still works.

I've tried an extension bisect and doesn't seem to be a conflict with a different extension.

`formatFiles.excludePattern` doesn't exclude all specified by glob

Given this workspace config

"settings": {
  "formatFiles.excludePattern": "**/node_modules/**"
}

I'm seeing this in the log

[14:59:02 info.] (ext) Starting Format Files - Workspace Folder
[14:59:02 info.] (validate-in-workspace) found workspace folders: Backend, Frontend
[14:59:02 info.] (validate-in-workspace) workspace is valid!
[14:59:02 info.] (files-api) searching for files in workspace c:\Users\myuser\my-project
[14:59:02 info.] (files-api) 	getting include filter
[14:59:02 warn.] (files-api) 	no filters specified
[14:59:02 info.] (files-api) 	getting exclude filter
[14:59:02 info.] (files-api) 		exclusions glob: {**/node_modules/**}
[14:59:02 info.] (files-api) 	filtering by folder: c:\Users\myuser\my-project\frontend
[14:59:02 info.] (files-api) 	executing search


[14:59:02 debug] (files-api) 			excluded:false	frontend\node_modules\.package-lock.json

[14:50:29 debug] (files-api) 			excluded:false	frontend\node_modules\@angular-devkit\build-angular\node_modules\rxjs\ReplaySubject.d.ts
[14:50:29 debug] (files-api) 			excluded:false	frontend\node_modules\@angular-devkit\build-angular\node_modules\rxjs\ReplaySubject.js
[14:50:29 debug] (files-api) 			excluded:false	frontend\node_modules\@angular-devkit\build-angular\node_modules\rxjs\ReplaySubject.js.map
[14:50:29 debug] (files-api) 			excluded:false	frontend\node_modules\@angular-devkit\build-angular\node_modules\rxjs\Rx.d.ts
[14:50:29 debug] (files-api) 			excluded:false	frontend\node_modules\@angular-devkit\build-angular\node_modules\rxjs\Rx.js
[14:50:29 debug] (files-api) 			excluded:false	frontend\node_modules\@angular-devkit\build-angular\node_modules\rxjs\Rx.js.map
[14:50:29 debug] (files-api) 			excluded:false	frontend\node_modules\@angular-devkit\build-angular\node_modules\rxjs\Scheduler.d.ts

[14:55:38 debug] (files-api) 			excluded:false	frontend\node_modules\@compodoc\compodoc\.tmp-compodoc-test-big-app\src\app\about\compodoc\compodoc.component.html
[14:55:38 debug] (files-api) 			excluded:false	frontend\node_modules\@compodoc\compodoc\.tmp-compodoc-test-big-app\src\app\about\compodoc\compodoc.component.ts
[14:55:38 debug] (files-api) 			excluded:false	frontend\node_modules\@compodoc\compodoc\.tmp-compodoc-test-big-app\src\app\about\todomvc\todomvc.component.html
[14:55:38 debug] (files-api) 			excluded:false	frontend\node_modules\@compodoc\compodoc\.tmp-compodoc-test-big-app\src\app\about\todomvc\todomvc.component.ts
[14:55:38 debug] (files-api) 			excluded:false	frontend\node_modules\@compodoc\compodoc\.tmp-compodoc-test-big-app\src\app\shared\components\dumb-component.ts
[14:55:38 debug] (files-api) 			excluded:false	frontend\node_modules\@compodoc\compodoc\.tmp-compodoc-test-big-app\src\app\shared\components\dumb-parent-component.ts
[14:55:38 debug] (files-api) 			excluded:false	frontend\node_modules\@compodoc\compodoc\.tmp-compodoc-test-big-app\src\app\shared\components\generic.component.ts

Those paths should be covered by **/node_modules/**

formatFiles.excludePattern should inherit workspace settings

It does not look like format-files is respecting VSCode's workspace settings in its formatFiles.excludePattern pattern. If I ignore files and folders in my workspace, I would expect format-files to follow that. So I guess this is a feature request? :)

Extension now longer find files after v3.1

[16:53:06 info.] (get-files) searching for files in workspace folder 'pk-next' include:/Users/jon/repos/pk-next/**/*.* exclude:{**/node_modules,**/.vscode,**/dist/**,**/.chrome,**/.git,**/.svn,**/.hg,**/CVS,**/.DS_Store,**/build,**/logs,**/node_modules,!.vscode,.*,.circleci,**/.next,*.postman_*,**/__mocks__,**/__tests__,**/_testConfig_,**/.messages,**/*.snap,**/package-lock.json,**/yarn.lock,build,docker*,lang,locales,migrations,models,pk-api-process.json,schema,scripts,shipitfile.js,testNotes.txt}
[16:53:06 info.] (get-files) Discovered 0 files to format

I'm guessing the multiple workspace changes caused single folder workspaces to break.

Html files skipped

Useful extension, but it skips certain files like .html in my Angular project.

I've updated the settings, but html files are still skipped. CSS files as well.

"formatAll.includeFileExtensions": [
".ts",
".json",
".html"
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.