GithubHelp home page GithubHelp logo

mjbvz / vscode-folder-source-actions Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 6.0 200 KB

VS Code extension for applying organize imports to all files in a folder

License: MIT License

TypeScript 85.11% JavaScript 14.89%

vscode-folder-source-actions's Introduction

VS Code Folder Source Actions

Adds a context menu that allows you to apply VS Code's organize imports code action to all files in a folder:

Organize imports in folder context menu

Important — Requires VS Code 1.32+

Supported languages

  • VS Code's built-in JavaScript and Typescript support.
  • Any extension that returns source.organizeImports code actions.

vscode-folder-source-actions's People

Contributors

dependabot[bot] avatar lukepighetti avatar mjbvz avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

vscode-folder-source-actions's Issues

Organize folder is not working on version 0.2.0 on vscode 1.53.2

As the tutorial explains, I attempted to use Organize Imports in Folder, but no luck working. however, when I use the command Organize Imports on a single file by myself it works as expected.
Do I need to add anything to my .editorconfig file?
VSCode version: 1.53.2

It doesn't work anymore

OS: Windows 11 Home
VS Code: 1.84.2
Folder Source Actions extension: 0.2.1

I use the extension from time to time, I find it very useful, but it doesn't work anymore, it does nothing. I just get a lot of logs like the following.

2023-12-12 13:14:20.658 [warning] vscjava.vscode-maven - Code actions of kind 'source.organizeImports 'requested but returned code action is of kind 'quickfix'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.
2023-12-12 13:14:20.660 [warning] vscjava.vscode-lombok - Code actions of kind 'source.organizeImports 'requested but returned code action is of kind 'refactor'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.

Extension does not find appropriate code actions

Extension tested on:
Mac 10.13.6
VSCode 1.26 and Insiders 1.27 (b00ab5288f314f6ef8d82923d89a0555ad15eb06)

Thank you for starting this extension. I'm running this on a project with several unused imports in JS/JSX files. As I understand it, this extension runs the command editor.action.organizeImports on a directory. My problem is that nothing appears to happen when I click "Organize Imports in Folder".

The function getAllCodeActionsForFile returns an empty array which doesn't seem right at all. Also, I'm not seeing that the command vscode.executeCodeActionProvider exists within a list from vscode.commands.getCommands(false) that's executed in the extension. This is my filtered output of getCommands names prefixed with vscode:

vscode.previewHtml
vscode.openFolder
vscode.diff
vscode.open
vscode.removeFromRecentlyOpened
vscode.setEditorLayout
vscode.previewHtml
vscode.openFolder
vscode.diff
vscode.open
vscode.removeFromRecentlyOpened
vscode.setEditorLayout

I'm entirely new to Code extension development and hope that this helps. I'm unsure where to look to fix this.

Doesn't process all files

OS: macOS 12.5.1
VS Code: 1.71.2
Folder Source Actions extension: 0.2.1
Haxe extension: 2.25.0

The Haxe extension allows to organize imports in Haxe source code (.hx files).

I tried to run it on the src dir of a somewhat large project (a directory hierarchy containing a total of 830 code files).
VS Code worked for a while, resulting in a large amount of open tabs, each marked as modified.

I did "Save All" and "Close All Editors", then checked git status. Only some 60 files had the imports organized. The rest were not touched. It seems that the extension stops at some point, it's not clear why. If I repeatedly run the extension on the src dir, without saving/closing any editors, each time it goes a bit further (e.g. there are 20-30 more open editors on each run).

I'd like to know what could make the extension bail out early when processing hundreds of files in the directory hierarchy. It could be a bug in the FSA (Folder Source Actions) extension, or the Haxe extension returning some error or throwing an exception while processing a particular file, which is then either not handled by the FSA extension, or handled by not continuing with the rest of the files. If it is a problem with some of our source code files, it is a bit strange that on each run, the process can succeed to go further. Normally the Haxe extension would show compiler errors, if there would be problems with any of the source files. In this case normally this extension complains that the compiler server couldn't initialize due to errors. There is no such error message.

Would be nice to find a way to identify why it's happening, and fix it.

Somewhat unrelated: I also think it would be much more convenient if the FSA extension would organize imports, save and close each file, rather than ending up with hundreds of open/unsaved editors. The imports organizing doesn't normally need reviewing. And if it does, the changes can be easily reviewed using the VCS (e.g. git diff). No good reason to leave a ton of open/unsaved editors. Please consider making this change.

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.