topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday October 9, 2024, 1:35 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Request: code editor (or extension) with synced second view with filtered lines?  (Read 18028 times)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
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.visuals...erinterface#_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....qcz.text-power-tools

Markdown preview, https://code.visuals...-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.
« Last Edit: November 20, 2019, 02:57 PM by Nod5 »

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
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....runtfuggly.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....emName=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.
« Last Edit: November 20, 2019, 03:06 PM by Nod5 »

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
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

  • Member
  • Joined in 2006
  • **
  • Posts: 2,930
    • View Profile
    • Donate to Member
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

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Thanks for the suggestions, appreciated.

Eclipse has some of the features you describe
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.
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.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
I searched a bit for Sublime extensions but the closest thing I found was
sublime-filterlines, https://github.com/d.../sublime-filterlines (related SuperUser page).
But it seems to only work similarly to the VS Code extension Text Power Tools above.

Both either replaces the original text (with undo as the only way back, it seems) with the filtered lines or exports the filtered lines into a new document. The only way back from the replace alternative is undo, it seems. So not good for this three step sequence: filter lines, make a few quick manual changes, and expand all lines again. They also can't display the same document in two synced views (one filtered, one unfiltered).

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,930
    • View Profile
    • Donate to Member
I distinctly remember using Notepad++ to apply a filter to a text file, for the purpose of hiding away 80% of it's content and doing manual changes on the content that still was shown. Also tried automated content changes, but these were applied to all the content, not just the content that was being shown.

There are quite a few options how to hide/reveal content from view using the 'TextFX Viz' functionality in Notepad++. It might not be your cup of tea, of course.

Well, this functionality is available in version 6.5.5 of Notepad++ as that appears to be the version I'm currently using.

* edit: added clarification

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
I distinctly remember using Notepad++ to apply a filter to a text file, for the purpose of hiding away 80% of it's content and doing manual changes on the content that still was shown.
Thanks. I see the "Hide Lines" (alt+H) command in Notepad++ menu View. But no "unhide" keyboard shortcut, though clicking the green hidden lines markers in the linenumber column works. Will try the TextFX Viz next.

I'm also tinkering on a small AutoHotkey test script with two views where one is filterable. The two only sync on save yet, I'll try sync as you type next.

Some thoughts from playing with it so far. To be most useful I think this kind of linefilter/accordion tool will need a few extra features:
- Linenumbers is a must
- shortcuts to unhide +1 lines line above or below current position (and +5, and +N)
- smart ways to toggle between edits in the filtered view affecting only visible lines vs all content. E.g. if line 2 is hidden and we select from line 1 to 3, should Delete also remove line 2? Or only 1 and 3?; Ditto find and replace.
- negative filter syntax (e.g. toggle all code comment lines off)
- filtering lines could be very handy together with multi caret editing. You want to rename a variable name everywhere in a long code document. First filter lines with the current variable name. Then hit shortcut to start multi caret editing at the start of the filter string on each visible line. Same end result as find and replace on the filtered view lines, but different visual response and easier to backtrack and adjust the new name while typing it.

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 783
    • View Profile
    • Free Portable Apps
    • Donate to Member
How about LogViewer http://www.uvviewsoft.com/logviewer/

Regards,

Anand

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
How about LogViewer http://www.uvviewsoft.com/logviewer/
I tried it. Interesting tool but not a match here because it seems to not hide lines, only hide/replace text on lines.

Screenshots from Notepad++ to illustrate roughly the kind of line hiding I'm after.

Before hiding
1.png

After hiding
2.png

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 783
    • View Profile
    • Free Portable Apps
    • Donate to Member
The feature is available in commercial UltraEdit https://www.ultraedit.com/, but since you are interested in free one, this will not do.
I remember I had one, few years ago, which filtered the text lines as I typed, but do not remember it now.
I will keep looking.

Regards,

Anand

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
The feature is available in commercial UltraEdit https://www.ultraedit.com/

Thanks. I'm trying it now in the UE trial. This comes closest to my OP wishlist so far. The hide lines feature for any type of textfile must first be enabled in the settings. After that we doubletap control+F to get "Find and Replace". Click filter checkbox, type a string and hit Enter. Not too slow. Line hiding looks like regular code folding. We can filter in or out and regex filter.

Two drawbacks:
- Filtering/unfiltering could be quicker and fewer steps. I see no direct hotkey to toggle unhide for all the previously hidden lines. But it can be done in two steps: Control+A to select all and then unhide through hotkey or command palette. The filtering command also shares UI with the find and replace. This means that we have to check/uncheck the filter checkbox in Find and Replace window when switching from filtering mode to find and replace mode. If would be quicker if they were separate popup windows.
- UE can split view the text. But any line filtering is synced when the second view is focused. So we can't shift back and forth between views and keep only one of them filtered.

But maybe there are workarounds to these issues through settings or scripts. I'll play some more with it.

Screenshot from UE's Find and Replace window
2.png

Screenshot of UE with split view after line filtering. Notice that both views are filtered.
3.png

but since you are interested in free one, this will not do.
Free isn't required. But as a first step I mostly just want to test drive this kind of feature for a while, to figure out if and when it is most useful compared to regular find and replace and other methods.

My hunch is that the feature would be most useful, and that I'd find more use for it, if the filter/unfilter action is very quick. Ideally a keyboard shortcut for a small searchbox (not with a lot of checkboxes and other functionality) and then filter lines as you type. Similarly one step shortcuts to unfilter all lines, unfilter this line, and so on.
« Last Edit: December 03, 2019, 06:31 AM by Nod5 »

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 783
    • View Profile
    • Free Portable Apps
    • Donate to Member
Well as a user of UltraEdit for last 6 years, I can vouch UltraEdit is one of the best commercial text editor.
It has too many features, which may be overkill for you if you are just looking for filtering lines. Otherwise if you use it as code editor, you may not go back to any other editor, IMHO.

Regards,

Anand

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Well as a user of UltraEdit for last 6 years, I can vouch UltraEdit is one of the best commercial text editor.
It has too many features, which may be overkill for you if you are just looking for filtering lines. Otherwise if you use it as code editor, you may not go back to any other editor, IMHO.

Regards,

Anand

i remember UE!  i liked it, good to hear it is still good.  i remember using it a lot.  then for some reason i liked editpad pro.  then sublime text came out and now everyone likes that.  but i still use editpad when i need it.  im going to check out UE i remember liking it.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
UltraEdit is nice and capable. Sublime too. But so are VS Code and Atom, and they're both free. So I'd only switch over to UE/Sublime if it does something I need much better than Code/Atom. Will have to see how my testing with the line hide feature goes.

Digression: I love that there are so many user friendly and feature filled code editors to pick from - luxury! VS Code seem to pull ahead of all the others when it comes to user base, at least if this is a good indicator of that
https://insights.sta...lopment-environments

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Years ago I bought a license for an UltraEdit, UltraCompare, and UltraSentry bundle with lifetime upgrades. I used it for awhile but I haven't even installed it on my last two computers. Part of that is that I ended up wanting to use the same editor and setup on all of the machines I regularly work on. I don't know the process to transfer a license but I would be happy to do so if you think it would work for you.
vi vi vi - editor of the beast

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 783
    • View Profile
    • Free Portable Apps
    • Donate to Member
I don't know the process to transfer a license but I would be happy to do so if you think it would work for you.
IDM gives 3/5 computers license, AFAIK. You can check with them. They are very prompt in customer satisfaction and I have got many features and fixes done as per my requirements.

Regards,

Anand

NigelH

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 210
    • View Profile
    • Donate to Member
This probably only satisfies points 3 and 4 but read on if you're interested.

The IBM ISPF editor probably has an unparalleled ability to visually edit files - filtering lines included of course.
I still use it when other Windows editors can't cut it or I'm too lazy to code or script something.
For files I regularly change, I also keep edit macros (scripts really - sequences of commands etc.) to run against uploaded files.



This is a free Windows implementation of ISPF.
http://www.spflite.com/

Here's a very small example of the kind of things you can do from the editing interface.
If not enough, you also have the ability to write macros (scripts) using thinbasic code.


x all                           (exclude all lines)
f Timbuktoo all            (find and show all lines with that string - use C'Timbuktu' if case sensitive)
c buktoo buktu all nx   (change buktoo to buktu on all non-excluded lines)
or
c buktoo buktu all x    (make the change on excluded lines - lines containing Timbuktoo are not affected as they are not excluded)

reset                              (show all lines)
c buktu buktoo 100 200   (make this change only between lines 100 and 200)
or
c buktu buktoo .a .b        (make this change between the lines you've labeled as .a and .b)

This is really just a small subset - the full change command documented here.
http://www.spflite.com/HtmlS/CHANGE.html

Besides the change command, there are many other ways to edit a file - much more here.
http://www.spflite.c...m/HtmlS/Working.html
e.g. Regular Expressions
http://www.spflite.c...S/RegExLiterals.html
Or picture strings
http://www.spflite.c...PictureLiterals.html


A learning curve for sure and probably a little quirky if you're not used to using commands to change data.
Well, not that strange I guess if you use an editor with a pseudo command line (vi/emacs etc.)

« Last Edit: December 07, 2019, 06:14 PM by NigelH, Reason: ... lines containing Timbuktoo are not affected ... »

NigelH

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 210
    • View Profile
    • Donate to Member
Found an example of an ISPF edit session - a little over the top but still :-)
https://www.youtube..../watch?v=LHhLctqTui4

SPFlite should be very similar

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Multiple  :Thmbsup: :Thmbsup: :Thmbsup: for the ISPF editor (and SPFLite). Anyone who worked on an IBM mainframe years ago would recognize it immediately. Plus the edit macros used REXX (or Clist for the real old-timers) although SPFLite uses a Basic interpreter. There are things you could do with the editor incredibly easily that you couldn't even consider in something else and I still use it occasionally.

It's good to see this video... I considered trying to come up with a script of commands to run on a sample file to show off what ISPF could do but I was too lazy to plan it out.  :D
vi vi vi - editor of the beast

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
I've been too short on time for this, will continue later.

x16wda: Very kind of you! I'll keep on just testing the UE trial for now though, but I might take you up on it down the line.

NigelH: Neat! I hadn't heard of it. I've no experience even with vi/emacs so that kind of editor will take some getting used to. But I can see the power in those features. Will have a go. Cheers for the fun video also - I did notice that all the names in it are from Garbage Pail Kids cards ;D