Find longest file in the project IntelliJ IDEA

Viewed 1033

Hello I want to know any trick or shortcut by which one can know which is the longest file in project. i.e which file has the longest lines of code.Is there any shortcut or plugin available?

2 Answers

I believe the OP was asking about the length of file, not the length of single line. You can try with such iteration:

(.*\n){100,}

(.*\n){1000,}

(.*\n){10000,}

Although this is kind of hacky it still works.

You can search your whole project using the regex repetition pattern. Just right-click your project folder in the project structure view and choose "Find in path...". Be sure to check "Regex" in the search window that appears. So you'll start out and match any line with any length in your project

^.$

(If you're not familiar with regex: ^ and $ are used to denote the beginning and end of a line and . matches any character)

Then you gradually increase the number of matched repetitions

^.{1,}$

^.{10,}$

^.{100,}$

^.{1000,}$

(You use {start, end} to indicate to interval of repetitions. If you leave end blank it will match anything from start)

Using this you will soon be left with the longest line(s) in your project.

As I said it's kinda hacky but it's also quick and works if you don't have to automate the task.

Hope this helps you!

Related