ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Request: code editor (or extension) with synced second view with filtered lines?

(1/5) > >>

Nod5:
Does anyone know of a code editor or plaintext editor that has these features:

1 First view displays the full text (every editor has this!)
2 Second view of the same document side by side (many editors have this!)

3 The second view displays only filtered lines from the full text.
4 An inputfield for typing a string/regex that updates the filtered lines immediately.
5 Synced edits: edits in the full text view are synced to the filtered view, and vice versa.

bonus feature but not as important
6 Synced positions: caret position and scrolling is synced between both views.

This feature would be of use when renaming variables or repeatedly doing similar changes at various places in a document. Find/replace already exists of course, but filtering could be a useful complement and give a better overview. Another use case is to show all lines that has the string "todo" etc in them, which could give an overview of code locations you've tagged for working on later.


Some other viewing/navigating tools that, while useful, don't do the above.

Minimap, https://code.visualstudio.com/docs/getstarted/userinterface#_minimap
Instead of filtering this zooms out to show a map of the full text. The map highlights lines with matches when using find/replace, which is nice. But the minimap is too small to read the text on those lines and we can't edit inside the minimap.

Multiple views (and scroll and caret positions) for the same full (unfiltered) text. E.g. the "split editor" command in VS Code

Filtering tools that create and open a separate, non-synced file with filtered lines. E.g. Text Power Tools for VS Code, https://marketplace.visualstudio.com/items?itemName=qcz.text-power-tools

Markdown preview, https://code.visualstudio.com/docs/languages/markdown#_dynamic-previews-and-preview-locking
This syncs positions. Edits in the plaintext view immediately sync to the preview. But there is no filtering and no editing in the preview.

Nod5:
I searched some more but no perfect match yet.

The Todo Tree extension for VS Code gives a nice list of tag locations to jump to in one or more plaintext files, but it's not quite what I looked for above
https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree

There are also extensions to get a view that lists all functions in the file and can jump to the function definition. For example
https://marketplace.visualstudio.com/items?itemName=qrti.funclist

My OP searched for two views, one of which has filterable lines.

But I'm now thinking that even a single view code editor where lines can be filtered/restored quickly by typing could also be very handy.

Use case: A long code source file where some function is used in a lot of place. You're scrolled about midway in the document. You know you want to edit near some of the other function calls. How do you get there? One way: find/replace the function name and then jump up/down match by match until you find the spot to edit. Glancing at the minimap might guide you a bit too. Or just scroll around and hope you find the spot. But imagine instead doing this: type the function name in a filter box and see the text shrink, kind of like a musical accordion, to only lines that match. You get a nice, readable overview. Quickly cursor to the line you want, hit another shortcut and... all the lines around it expand again. Your cursor remains at the line your scrolled to, centered in the view. In the filtered view the lines would show their true/original linenumbers, just like for usual code folding in editors.

Bonus feature: storing some filters as favorites, to toggle with a shortcut. A bit like how some code editors let us temp bookmark lines and jump between them.

superboyac:
I would look at Sublime text.  It is extensible and people have lots of interesting plugins.  Regarding markdown, in that other thread that i am experimenting with zettel, someone made a zettel/markdown editor that completely transforms sublime text into a whole other environment, quite cool.  So it looks like sublime has the kinds of possibilities that you might be able to build on, maybe with a little development effort if it doesnt exist.

Shades:
Sounds like you are looking for a full blown IDE. Eclipse has some of the features you describe and can be extended with free/commercial extensions that make it more useful than as it comes right out of the box.

Eclipse is open source and free to use in any capacity. Although it is originally designed for Java development, it supports a lot of different programming languages. There is also IdeaJ 2019 (Community Edition) that is free to use and is similar in features, capabilities and expandibility(?) as Eclipse is. But also different enough.

VSCode, Brackets and Atom are also editors that can be used freely and have many extensions available to them. Sublime Text is indeed a very good text editor and has a lot of extensions for it. But Sublime is a commercially licensed product (that you can use for free, but with a nag screen) and extensions are mostly commercial licensed too. It might be that you "sink" a lot of money into Sublime/extensions and still not get what you want, while there are others that can be tried out for a lot less money or even free. Just saying. 

Nod5:
Thanks for the suggestions, appreciated.

Eclipse has some of the features you describe
-Shades (November 20, 2019, 11:20 PM)
--- End quote ---
Do you know if it has these two features
3 The second view displays only filtered lines from the full text.
4 An inputfield for typing a string/regex that updates the filtered lines immediately.

I would look at Sublime text.
-superboyac (November 20, 2019, 04:09 PM)
--- End quote ---
Thanks, it was years since I last checked out Sublime so worth another look now. Finding an extension for VS Code, Atom or Sublime that can do what I want here is probably the best bet. I'd guess all of them can in *principle* be made to do this, the question is if there is already some such extension out there already that has done it.

I first merely want to testdrive the feature a bit, since it is hard to know in advance if it will be super useful or not. Coding my own editor extension would be a steep learning curve, but I might instead try coding a small prototype in AutoHotkey or Javascript to get a first feel for the feature.

Brainstorming outside of my OP request now: Another use case I thought of for this kind of quick line filtering feature is in web browsers. Imagine going to a very long Wikipedia page. You search for a string and get 23 matches scattered on the page. You can visit each, jump by jump. But here too it seems useful to be able to quickly filter out everything on the page except the lines that match the search/filter phrase (maybe with one extra line above/below each match, for extra context). That way many matches can be overviewed at the same time.

Navigation

[0] Message Index

[#] Next page

Go to full version