Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve search addon API #705

Closed
Tyriar opened this issue Jun 14, 2017 · 8 comments
Closed

Improve search addon API #705

Tyriar opened this issue Jun 14, 2017 · 8 comments
Labels
help wanted type/plan A meta issue that consists of several sub-issues

Comments

@Tyriar
Copy link
Member

Tyriar commented Jun 14, 2017

The find API introduced in #704 can be expanded upon in the future to support:

  • Using a different selection type so that multiple instances can be highlighted at once
  • Find multiple instances on the same line
  • Find terms that are wrapped across 2 lines
  • Options: regex, case sensitivity, etc.
  • Return the number of results (may impact performance)
  • Allow "find as you type", allowing the current selection to be expanded if it matches
@Tyriar Tyriar added the type/enhancement Features or improvements to existing features label Jun 14, 2017
@Tyriar Tyriar self-assigned this Jun 14, 2017
@mofux
Copy link
Contributor

mofux commented Jun 21, 2017

It would also be great to have an api that gets the total number of matched instances, and the index of the currently active instance, as well as a mechanism to get notified when the total number or active index changes. This would allow a consumer to draw a find UI and provide some more info to the user.

@Tyriar
Copy link
Member Author

Tyriar commented Jun 21, 2017

@mofux this was one of the first thoughts I had, I left it out due to performance concerns as it's not the most efficient thing to convert a large buffer into searchable strings as each individual character is stored within it's own array. The buffer is basically structured like this: [number, string, number][][] so you need to iterate through the lines and then construct a string out of the line.

Definitely worth exploring later on whether my guesses around this are true though 👍. I added it to the list 😃

@mofux
Copy link
Contributor

mofux commented Jun 22, 2017

@Tyriar Interesting to see that a modern terminal emulator shares so many problems with code editors like ace or monaco, like line buffers, selection models, find api, tokenization. Actually, I remember that the cloud9 terminal does all the rendering through the Ace editor 😉

@Tyriar
Copy link
Member Author

Tyriar commented Jun 22, 2017

@mofux yeah it's been useful to have people who work on monaco to ask about things. A lot of stuff poses similar problems. The fact that the buffer is continuously trimmed and that it's common to run a command that get a crazy amount of data streamed in are biggest unique parts.

@Tyriar Tyriar changed the title Improve find API Improve search addon API Nov 3, 2017
@Tyriar Tyriar added the addon label Nov 4, 2017
@FGasper
Copy link
Contributor

FGasper commented Mar 1, 2018

It would be nice to have a browser-style “find-as-you-type” logic. I think it would work if a couple functions were added:

  • findCurrentOrNext(needle)
  • findCurrentOrPrevious(needle)

These would expand the current selection if the needle is present at the 0-index of the current selection; otherwise they’d do a normal findNext or findPrevious.

Thoughts?

@Tyriar
Copy link
Member Author

Tyriar commented Mar 1, 2018

@FGasper yeah this sort of thing would be good, probably best tackled after this one: Find multiple instances on the same line. Added it to the list

@jerch
Copy link
Member

jerch commented Sep 2, 2018

Coming from #1649 I suggest to split up the functionality of the search addon into:

  • search: just do something like indexOf and return a cols/rows positions, feeding this back gives the next position, as an advantage this will not need any DOM related stuff.
  • mark/highlight: takes some positions and can highlight/mark it in the output, This will depend on whatever frontend is active.

@Tyriar
Copy link
Member Author

Tyriar commented Dec 18, 2018

Most of this is done, let's track the rest in individual items: #1653, #1654, #1659

@Tyriar Tyriar closed this as completed Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted type/plan A meta issue that consists of several sub-issues
Projects
None yet
Development

No branches or pull requests

4 participants