Hiding lines in Atom editor?


#1

Does anyone know how to hide certain lines or parts of code in Atom editor? I’m thinking it could be based on regex. I’m not sure if it exists within Atom, a plugin exists, or how hard it would be to make one.


#2

Aside from folding?


#3

I looked at that but it doesn’t do what I want. Folding still keeps the first line on the screen where I want it to be hidden completely. Primarily I want this to remove all the comments from view for easier reading actual code.

Do you think there’s a plugin for being able to change the documents style by key (just came to mind)?


#4

As a work around I found if I add to styles.less the below code it sorta helps…
.comment { color: rgb(27, 31, 34); }


#5

Folding is what you want. You would need a package that detects comments and folds them away. There are some upcoming enhancements for folding that might give you more control (see the section on v1.9-beta):


#6

I downloaded it this weekend, I must say i’m happy they finally added in moveable panes! I hope they add a package for hiding comments, it would be super helpful.


#7

is there not a way to hide a certain “class” in a command? i.e… adding “display: none” to a certain element in the document?

I have created a package that syntax highlight the log4j log files. I want to add in the feature to allow user to hide the TRACE, DEBUG, INFO entries.

Here is my log4j highlight screen captured:


#8

Find the scope of the lines that you want to hide. Then you can add display: none or whatever you want in your styles.less file.

I just tried it out and it works, though be aware it’s as if the text itself doesn’t exist.


#9

I was able to do that in the styles.less. But I was looking for an implementation a set of commands so that the user can hide and show by running the commands or mapping the command to keys, or menus.


#10

You can use the TextEditor.toggleFoldAtBufferRow API to hide and show specific rows in a text file. Or you could use a combination of TextEditor.scan and TextEditor.foldSelectedLines to fold lines based on a pattern. This integrates with Atom much better and gives the user the ability to individually unfold lines if they want afterwards.

These APIs could be built into commands that can be used with keys or menus.


#11

How about a way to auto hide / fold all commented lines? Comments are great but they get in the way visually. A key toggle would be gravy.